Skip to content

Commit

Permalink
update py
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengruifeng committed Dec 2, 2019
1 parent 4667c45 commit 5e898e2
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions python/pyspark/ml/clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def numIter(self):

@inherit_doc
class _GaussianMixtureParams(HasMaxIter, HasFeaturesCol, HasSeed, HasPredictionCol,
HasProbabilityCol, HasTol, HasAggregationDepth):
HasProbabilityCol, HasTol, HasAggregationDepth, HasWeightCol):
"""
Params for :py:class:`GaussianMixture` and :py:class:`GaussianMixtureModel`.
Expand Down Expand Up @@ -277,18 +277,20 @@ class GaussianMixture(JavaEstimator, _GaussianMixtureParams, JavaMLWritable, Jav
Row(mean=DenseVector([0.825, 0.8675]))
>>> model2.gaussiansDF.select("cov").head()
Row(cov=DenseMatrix(2, 2, [0.0056, -0.0051, -0.0051, 0.0046], False))
>>> gm2.setWeightCol("weight")
GaussianMixture...
.. versionadded:: 2.0.0
"""

@keyword_only
def __init__(self, featuresCol="features", predictionCol="prediction", k=2,
probabilityCol="probability", tol=0.01, maxIter=100, seed=None,
aggregationDepth=2):
aggregationDepth=2, weightCol=None):
"""
__init__(self, featuresCol="features", predictionCol="prediction", k=2, \
probabilityCol="probability", tol=0.01, maxIter=100, seed=None, \
aggregationDepth=2)
aggregationDepth=2, weightCol=None)
"""
super(GaussianMixture, self).__init__()
self._java_obj = self._new_java_obj("org.apache.spark.ml.clustering.GaussianMixture",
Expand All @@ -304,11 +306,11 @@ def _create_model(self, java_model):
@since("2.0.0")
def setParams(self, featuresCol="features", predictionCol="prediction", k=2,
probabilityCol="probability", tol=0.01, maxIter=100, seed=None,
aggregationDepth=2):
aggregationDepth=2, weightCol=None):
"""
setParams(self, featuresCol="features", predictionCol="prediction", k=2, \
probabilityCol="probability", tol=0.01, maxIter=100, seed=None, \
aggregationDepth=2)
aggregationDepth=2, weightCol=None)
Sets params for GaussianMixture.
"""
Expand Down Expand Up @@ -350,6 +352,13 @@ def setProbabilityCol(self, value):
"""
return self._set(probabilityCol=value)

@since("3.0.0")
def setWeightCol(self, value):
"""
Sets the value of :py:attr:`weightCol`.
"""
return self._set(weightCol=value)

@since("2.0.0")
def setSeed(self, value):
"""
Expand Down

0 comments on commit 5e898e2

Please sign in to comment.