diff options
author | Yanbo Liang <ybliang8@gmail.com> | 2016-05-03 16:46:13 +0200 |
---|---|---|
committer | Nick Pentreath <nickp@za.ibm.com> | 2016-05-03 16:46:13 +0200 |
commit | d26f7cb0121767da678bbbbf3a0e31c63d5e3159 (patch) | |
tree | 76c2dafc74ec093ac832cf5045fbcf10f9e977e7 /python/pyspark/ml/classification.py | |
parent | 46965cd014fd4ba68bdec15156ec9bcc27d9b217 (diff) | |
download | spark-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/classification.py')
-rw-r--r-- | python/pyspark/ml/classification.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/python/pyspark/ml/classification.py b/python/pyspark/ml/classification.py index 4331f73b73..f032963334 100644 --- a/python/pyspark/ml/classification.py +++ b/python/pyspark/ml/classification.py @@ -464,8 +464,7 @@ class TreeClassifierParams(object): """ Sets the value of :py:attr:`impurity`. """ - self._set(impurity=value) - return self + return self._set(impurity=value) @since("1.6.0") def getImpurity(self): @@ -826,8 +825,7 @@ class GBTClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol """ Sets the value of :py:attr:`lossType`. """ - self._set(lossType=value) - return self + return self._set(lossType=value) @since("1.4.0") def getLossType(self): @@ -956,8 +954,7 @@ class NaiveBayes(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol, H """ Sets the value of :py:attr:`smoothing`. """ - self._set(smoothing=value) - return self + return self._set(smoothing=value) @since("1.5.0") def getSmoothing(self): @@ -971,8 +968,7 @@ class NaiveBayes(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol, H """ Sets the value of :py:attr:`modelType`. """ - self._set(modelType=value) - return self + return self._set(modelType=value) @since("1.5.0") def getModelType(self): @@ -1098,8 +1094,7 @@ class MultilayerPerceptronClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, """ Sets the value of :py:attr:`layers`. """ - self._set(layers=value) - return self + return self._set(layers=value) @since("1.6.0") def getLayers(self): @@ -1113,8 +1108,7 @@ class MultilayerPerceptronClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, """ Sets the value of :py:attr:`blockSize`. """ - self._set(blockSize=value) - return self + return self._set(blockSize=value) @since("1.6.0") def getBlockSize(self): @@ -1162,8 +1156,7 @@ class OneVsRestParams(HasFeaturesCol, HasLabelCol, HasPredictionCol): .. note:: Only LogisticRegression and NaiveBayes are supported now. """ - self._set(classifier=value) - return self + return self._set(classifier=value) @since("2.0.0") def getClassifier(self): |