From 180a5925012019c488d97412ba6ec6cf8b5cae26 Mon Sep 17 00:00:00 2001 From: zero323 Date: Mon, 13 Jan 2020 00:23:39 +0100 Subject: [PATCH 1/3] Remove OneVsRestModel.setClassifier --- python/pyspark/ml/classification.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/python/pyspark/ml/classification.py b/python/pyspark/ml/classification.py index af295ac008450..945896a7c89a7 100644 --- a/python/pyspark/ml/classification.py +++ b/python/pyspark/ml/classification.py @@ -2637,13 +2637,6 @@ class OneVsRestModel(Model, _OneVsRestParams, JavaMLReadable, JavaMLWritable): .. versionadded:: 2.0.0 """ - @since("2.0.0") - def setClassifier(self, value): - """ - Sets the value of :py:attr:`classifier`. - """ - return self._set(classifier=value) - def setFeaturesCol(self, value): """ Sets the value of :py:attr:`featuresCol`. From a727e3f414c9acbfacbba88ce663102cb7004259 Mon Sep 17 00:00:00 2001 From: zero323 Date: Mon, 13 Jan 2020 00:53:06 +0100 Subject: [PATCH 2/3] Remove setLabelCol and setWeightCol methods --- python/pyspark/ml/classification.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/python/pyspark/ml/classification.py b/python/pyspark/ml/classification.py index 945896a7c89a7..71fe435d3dd7a 100644 --- a/python/pyspark/ml/classification.py +++ b/python/pyspark/ml/classification.py @@ -2655,18 +2655,6 @@ def setRawPredictionCol(self, value): """ return self._set(rawPredictionCol=value) - def setLabelCol(self, value): - """ - Sets the value of :py:attr:`labelCol`. - """ - return self._set(labelCol=value) - - def setWeightCol(self, value): - """ - Sets the value of :py:attr:`weightCol`. - """ - return self._set(weightCol=value) - def __init__(self, models): super(OneVsRestModel, self).__init__() self.models = models From 82367a3f577036c657c91ee7bd3ad3c6edd4e4ce Mon Sep 17 00:00:00 2001 From: zero323 Date: Mon, 13 Jan 2020 02:42:05 +0100 Subject: [PATCH 3/3] Use _set to set labelCol --- python/pyspark/ml/classification.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/pyspark/ml/classification.py b/python/pyspark/ml/classification.py index 71fe435d3dd7a..bfed88fdcb5d5 100644 --- a/python/pyspark/ml/classification.py +++ b/python/pyspark/ml/classification.py @@ -2754,8 +2754,9 @@ def _from_java(cls, java_stage): predictionCol = java_stage.getPredictionCol() classifier = JavaParams._from_java(java_stage.getClassifier()) models = [JavaParams._from_java(model) for model in java_stage.models()] - py_stage = cls(models=models).setPredictionCol(predictionCol).setLabelCol(labelCol)\ + py_stage = cls(models=models).setPredictionCol(predictionCol)\ .setFeaturesCol(featuresCol) + py_stage._set(labelCol=labelCol) py_stage._set(classifier=classifier) py_stage._resetUid(java_stage.uid()) return py_stage