aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/ml/clustering.py
diff options
context:
space:
mode:
authorYanbo Liang <ybliang8@gmail.com>2016-05-03 16:46:13 +0200
committerNick Pentreath <nickp@za.ibm.com>2016-05-03 16:46:13 +0200
commitd26f7cb0121767da678bbbbf3a0e31c63d5e3159 (patch)
tree76c2dafc74ec093ac832cf5045fbcf10f9e977e7 /python/pyspark/ml/clustering.py
parent46965cd014fd4ba68bdec15156ec9bcc27d9b217 (diff)
downloadspark-d26f7cb0121767da678bbbbf3a0e31c63d5e3159.tar.gz
spark-d26f7cb0121767da678bbbbf3a0e31c63d5e3159.tar.bz2
spark-d26f7cb0121767da678bbbbf3a0e31c63d5e3159.zip
[SPARK-14971][ML][PYSPARK] PySpark ML Params setter code clean up
## What changes were proposed in this pull request? PySpark ML Params setter code clean up. For examples, ```setInputCol``` can be simplified from ``` self._set(inputCol=value) return self ``` to: ``` return self._set(inputCol=value) ``` This is a pretty big sweeps, and we cleaned wherever possible. ## How was this patch tested? Exist unit tests. Author: Yanbo Liang <ybliang8@gmail.com> Closes #12749 from yanboliang/spark-14971.
Diffstat (limited to 'python/pyspark/ml/clustering.py')
-rw-r--r--python/pyspark/ml/clustering.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/python/pyspark/ml/clustering.py b/python/pyspark/ml/clustering.py
index 50ebf4fde1..b90daf16e2 100644
--- a/python/pyspark/ml/clustering.py
+++ b/python/pyspark/ml/clustering.py
@@ -156,8 +156,7 @@ class GaussianMixture(JavaEstimator, HasFeaturesCol, HasPredictionCol, HasMaxIte
"""
Sets the value of :py:attr:`k`.
"""
- self._set(k=value)
- return self
+ return self._set(k=value)
@since("2.0.0")
def getK(self):
@@ -272,8 +271,7 @@ class KMeans(JavaEstimator, HasFeaturesCol, HasPredictionCol, HasMaxIter, HasTol
"""
Sets the value of :py:attr:`k`.
"""
- self._set(k=value)
- return self
+ return self._set(k=value)
@since("1.5.0")
def getK(self):
@@ -287,8 +285,7 @@ class KMeans(JavaEstimator, HasFeaturesCol, HasPredictionCol, HasMaxIter, HasTol
"""
Sets the value of :py:attr:`initMode`.
"""
- self._set(initMode=value)
- return self
+ return self._set(initMode=value)
@since("1.5.0")
def getInitMode(self):
@@ -302,8 +299,7 @@ class KMeans(JavaEstimator, HasFeaturesCol, HasPredictionCol, HasMaxIter, HasTol
"""
Sets the value of :py:attr:`initSteps`.
"""
- self._set(initSteps=value)
- return self
+ return self._set(initSteps=value)
@since("1.5.0")
def getInitSteps(self):
@@ -422,8 +418,7 @@ class BisectingKMeans(JavaEstimator, HasFeaturesCol, HasPredictionCol, HasMaxIte
"""
Sets the value of :py:attr:`k`.
"""
- self._set(k=value)
- return self
+ return self._set(k=value)
@since("2.0.0")
def getK(self):
@@ -437,8 +432,7 @@ class BisectingKMeans(JavaEstimator, HasFeaturesCol, HasPredictionCol, HasMaxIte
"""
Sets the value of :py:attr:`minDivisibleClusterSize`.
"""
- self._set(minDivisibleClusterSize=value)
- return self
+ return self._set(minDivisibleClusterSize=value)
@since("2.0.0")
def getMinDivisibleClusterSize(self):