This is an automated email from the ASF dual-hosted git repository. srowen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new 72c80ee [SPARK-28243][PYSPARK][ML] Remove setFeatureSubsetStrategy and setSubsamplingRate from Python TreeEnsembleParams 72c80ee is described below commit 72c80ee81ca4c3c9569749b54e2db0ec91b128a5 Author: Huaxin Gao <huax...@us.ibm.com> AuthorDate: Sat Jul 20 10:44:33 2019 -0500 [SPARK-28243][PYSPARK][ML] Remove setFeatureSubsetStrategy and setSubsamplingRate from Python TreeEnsembleParams ## What changes were proposed in this pull request? Remove deprecated setFeatureSubsetStrategy and setSubsamplingRate from Python TreeEnsembleParams ## How was this patch tested? Use existing tests. Closes #25046 from huaxingao/spark-28243. Authored-by: Huaxin Gao <huax...@us.ibm.com> Signed-off-by: Sean Owen <sean.o...@databricks.com> --- python/pyspark/ml/classification.py | 157 +++++++++++++++++++++++++++++-- python/pyspark/ml/param/shared.py | 36 -------- python/pyspark/ml/regression.py | 180 ++++++++++++++++++++++++++++++------ 3 files changed, 300 insertions(+), 73 deletions(-) diff --git a/python/pyspark/ml/classification.py b/python/pyspark/ml/classification.py index c257ace..ce65439 100644 --- a/python/pyspark/ml/classification.py +++ b/python/pyspark/ml/classification.py @@ -875,13 +875,6 @@ class TreeClassifierParams(object): super(TreeClassifierParams, self).__init__() @since("1.6.0") - def setImpurity(self, value): - """ - Sets the value of :py:attr:`impurity`. - """ - return self._set(impurity=value) - - @since("1.6.0") def getImpurity(self): """ Gets the value of impurity or its default value. @@ -1003,6 +996,49 @@ class DecisionTreeClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, HasWeig def _create_model(self, java_model): return DecisionTreeClassificationModel(java_model) + def setMaxDepth(self, value): + """ + Sets the value of :py:attr:`maxDepth`. + """ + return self._set(maxDepth=value) + + def setMaxBins(self, value): + """ + Sets the value of :py:attr:`maxBins`. + """ + return self._set(maxBins=value) + + def setMinInstancesPerNode(self, value): + """ + Sets the value of :py:attr:`minInstancesPerNode`. + """ + return self._set(minInstancesPerNode=value) + + def setMinInfoGain(self, value): + """ + Sets the value of :py:attr:`minInfoGain`. + """ + return self._set(minInfoGain=value) + + def setMaxMemoryInMB(self, value): + """ + Sets the value of :py:attr:`maxMemoryInMB`. + """ + return self._set(maxMemoryInMB=value) + + def setCacheNodeIds(self, value): + """ + Sets the value of :py:attr:`cacheNodeIds`. + """ + return self._set(cacheNodeIds=value) + + @since("1.4.0") + def setImpurity(self, value): + """ + Sets the value of :py:attr:`impurity`. + """ + return self._set(impurity=value) + @inherit_doc class DecisionTreeClassificationModel(DecisionTreeModel, JavaClassificationModel, JavaMLWritable, @@ -1133,6 +1169,63 @@ class RandomForestClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPred def _create_model(self, java_model): return RandomForestClassificationModel(java_model) + def setMaxDepth(self, value): + """ + Sets the value of :py:attr:`maxDepth`. + """ + return self._set(maxDepth=value) + + def setMaxBins(self, value): + """ + Sets the value of :py:attr:`maxBins`. + """ + return self._set(maxBins=value) + + def setMinInstancesPerNode(self, value): + """ + Sets the value of :py:attr:`minInstancesPerNode`. + """ + return self._set(minInstancesPerNode=value) + + def setMinInfoGain(self, value): + """ + Sets the value of :py:attr:`minInfoGain`. + """ + return self._set(minInfoGain=value) + + def setMaxMemoryInMB(self, value): + """ + Sets the value of :py:attr:`maxMemoryInMB`. + """ + return self._set(maxMemoryInMB=value) + + def setCacheNodeIds(self, value): + """ + Sets the value of :py:attr:`cacheNodeIds`. + """ + return self._set(cacheNodeIds=value) + + @since("1.4.0") + def setImpurity(self, value): + """ + Sets the value of :py:attr:`impurity`. + """ + return self._set(impurity=value) + + @since("1.4.0") + def setNumTrees(self, value): + """ + Sets the value of :py:attr:`numTrees`. + """ + return self._set(numTrees=value) + + @since("1.4.0") + def setSubsamplingRate(self, value): + """ + Sets the value of :py:attr:`subsamplingRate`. + """ + return self._set(subsamplingRate=value) + @since("2.4.0") def setFeatureSubsetStrategy(self, value): """ @@ -1317,6 +1410,49 @@ class GBTClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol def _create_model(self, java_model): return GBTClassificationModel(java_model) + def setMaxDepth(self, value): + """ + Sets the value of :py:attr:`maxDepth`. + """ + return self._set(maxDepth=value) + + def setMaxBins(self, value): + """ + Sets the value of :py:attr:`maxBins`. + """ + return self._set(maxBins=value) + + def setMinInstancesPerNode(self, value): + """ + Sets the value of :py:attr:`minInstancesPerNode`. + """ + return self._set(minInstancesPerNode=value) + + def setMinInfoGain(self, value): + """ + Sets the value of :py:attr:`minInfoGain`. + """ + return self._set(minInfoGain=value) + + def setMaxMemoryInMB(self, value): + """ + Sets the value of :py:attr:`maxMemoryInMB`. + """ + return self._set(maxMemoryInMB=value) + + def setCacheNodeIds(self, value): + """ + Sets the value of :py:attr:`cacheNodeIds`. + """ + return self._set(cacheNodeIds=value) + + @since("1.4.0") + def setImpurity(self, value): + """ + Sets the value of :py:attr:`impurity`. + """ + return self._set(impurity=value) + @since("1.4.0") def setLossType(self, value): """ @@ -1324,6 +1460,13 @@ class GBTClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol """ return self._set(lossType=value) + @since("1.4.0") + def setSubsamplingRate(self, value): + """ + Sets the value of :py:attr:`subsamplingRate`. + """ + return self._set(subsamplingRate=value) + @since("2.4.0") def setFeatureSubsetStrategy(self, value): """ diff --git a/python/pyspark/ml/param/shared.py b/python/pyspark/ml/param/shared.py index 6405b9f..56d6190 100644 --- a/python/pyspark/ml/param/shared.py +++ b/python/pyspark/ml/param/shared.py @@ -765,72 +765,36 @@ class DecisionTreeParams(Params): def __init__(self): super(DecisionTreeParams, self).__init__() - def setMaxDepth(self, value): - """ - Sets the value of :py:attr:`maxDepth`. - """ - return self._set(maxDepth=value) - def getMaxDepth(self): """ Gets the value of maxDepth or its default value. """ return self.getOrDefault(self.maxDepth) - def setMaxBins(self, value): - """ - Sets the value of :py:attr:`maxBins`. - """ - return self._set(maxBins=value) - def getMaxBins(self): """ Gets the value of maxBins or its default value. """ return self.getOrDefault(self.maxBins) - def setMinInstancesPerNode(self, value): - """ - Sets the value of :py:attr:`minInstancesPerNode`. - """ - return self._set(minInstancesPerNode=value) - def getMinInstancesPerNode(self): """ Gets the value of minInstancesPerNode or its default value. """ return self.getOrDefault(self.minInstancesPerNode) - def setMinInfoGain(self, value): - """ - Sets the value of :py:attr:`minInfoGain`. - """ - return self._set(minInfoGain=value) - def getMinInfoGain(self): """ Gets the value of minInfoGain or its default value. """ return self.getOrDefault(self.minInfoGain) - def setMaxMemoryInMB(self, value): - """ - Sets the value of :py:attr:`maxMemoryInMB`. - """ - return self._set(maxMemoryInMB=value) - def getMaxMemoryInMB(self): """ Gets the value of maxMemoryInMB or its default value. """ return self.getOrDefault(self.maxMemoryInMB) - def setCacheNodeIds(self, value): - """ - Sets the value of :py:attr:`cacheNodeIds`. - """ - return self._set(cacheNodeIds=value) - def getCacheNodeIds(self): """ Gets the value of cacheNodeIds or its default value. diff --git a/python/pyspark/ml/regression.py b/python/pyspark/ml/regression.py index 927cc77..349130f 100644 --- a/python/pyspark/ml/regression.py +++ b/python/pyspark/ml/regression.py @@ -610,13 +610,6 @@ class TreeEnsembleParams(DecisionTreeParams): super(TreeEnsembleParams, self).__init__() @since("1.4.0") - def setSubsamplingRate(self, value): - """ - Sets the value of :py:attr:`subsamplingRate`. - """ - return self._set(subsamplingRate=value) - - @since("1.4.0") def getSubsamplingRate(self): """ Gets the value of subsamplingRate or its default value. @@ -624,15 +617,6 @@ class TreeEnsembleParams(DecisionTreeParams): return self.getOrDefault(self.subsamplingRate) @since("1.4.0") - def setFeatureSubsetStrategy(self, value): - """ - Sets the value of :py:attr:`featureSubsetStrategy`. - - .. note:: Deprecated in 2.4.0 and will be removed in 3.0.0. - """ - return self._set(featureSubsetStrategy=value) - - @since("1.4.0") def getFeatureSubsetStrategy(self): """ Gets the value of featureSubsetStrategy or its default value. @@ -656,13 +640,6 @@ class HasVarianceImpurity(Params): super(HasVarianceImpurity, self).__init__() @since("1.4.0") - def setImpurity(self, value): - """ - Sets the value of :py:attr:`impurity`. - """ - return self._set(impurity=value) - - @since("1.4.0") def getImpurity(self): """ Gets the value of impurity or its default value. @@ -686,13 +663,6 @@ class RandomForestParams(TreeEnsembleParams): super(RandomForestParams, self).__init__() @since("1.4.0") - def setNumTrees(self, value): - """ - Sets the value of :py:attr:`numTrees`. - """ - return self._set(numTrees=value) - - @since("1.4.0") def getNumTrees(self): """ Gets the value of numTrees or its default value. @@ -843,6 +813,49 @@ class DecisionTreeRegressor(JavaEstimator, HasFeaturesCol, HasLabelCol, HasWeigh def _create_model(self, java_model): return DecisionTreeRegressionModel(java_model) + def setMaxDepth(self, value): + """ + Sets the value of :py:attr:`maxDepth`. + """ + return self._set(maxDepth=value) + + def setMaxBins(self, value): + """ + Sets the value of :py:attr:`maxBins`. + """ + return self._set(maxBins=value) + + def setMinInstancesPerNode(self, value): + """ + Sets the value of :py:attr:`minInstancesPerNode`. + """ + return self._set(minInstancesPerNode=value) + + def setMinInfoGain(self, value): + """ + Sets the value of :py:attr:`minInfoGain`. + """ + return self._set(minInfoGain=value) + + def setMaxMemoryInMB(self, value): + """ + Sets the value of :py:attr:`maxMemoryInMB`. + """ + return self._set(maxMemoryInMB=value) + + def setCacheNodeIds(self, value): + """ + Sets the value of :py:attr:`cacheNodeIds`. + """ + return self._set(cacheNodeIds=value) + + @since("1.4.0") + def setImpurity(self, value): + """ + Sets the value of :py:attr:`impurity`. + """ + return self._set(impurity=value) + @inherit_doc class DecisionTreeModel(JavaModel, JavaPredictionModel): @@ -1036,6 +1049,63 @@ class RandomForestRegressor(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredi def _create_model(self, java_model): return RandomForestRegressionModel(java_model) + def setMaxDepth(self, value): + """ + Sets the value of :py:attr:`maxDepth`. + """ + return self._set(maxDepth=value) + + def setMaxBins(self, value): + """ + Sets the value of :py:attr:`maxBins`. + """ + return self._set(maxBins=value) + + def setMinInstancesPerNode(self, value): + """ + Sets the value of :py:attr:`minInstancesPerNode`. + """ + return self._set(minInstancesPerNode=value) + + def setMinInfoGain(self, value): + """ + Sets the value of :py:attr:`minInfoGain`. + """ + return self._set(minInfoGain=value) + + def setMaxMemoryInMB(self, value): + """ + Sets the value of :py:attr:`maxMemoryInMB`. + """ + return self._set(maxMemoryInMB=value) + + def setCacheNodeIds(self, value): + """ + Sets the value of :py:attr:`cacheNodeIds`. + """ + return self._set(cacheNodeIds=value) + + @since("1.4.0") + def setImpurity(self, value): + """ + Sets the value of :py:attr:`impurity`. + """ + return self._set(impurity=value) + + @since("1.4.0") + def setNumTrees(self, value): + """ + Sets the value of :py:attr:`numTrees`. + """ + return self._set(numTrees=value) + + @since("1.4.0") + def setSubsamplingRate(self, value): + """ + Sets the value of :py:attr:`subsamplingRate`. + """ + return self._set(subsamplingRate=value) + @since("2.4.0") def setFeatureSubsetStrategy(self, value): """ @@ -1180,6 +1250,49 @@ class GBTRegressor(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol, def _create_model(self, java_model): return GBTRegressionModel(java_model) + def setMaxDepth(self, value): + """ + Sets the value of :py:attr:`maxDepth`. + """ + return self._set(maxDepth=value) + + def setMaxBins(self, value): + """ + Sets the value of :py:attr:`maxBins`. + """ + return self._set(maxBins=value) + + def setMinInstancesPerNode(self, value): + """ + Sets the value of :py:attr:`minInstancesPerNode`. + """ + return self._set(minInstancesPerNode=value) + + def setMinInfoGain(self, value): + """ + Sets the value of :py:attr:`minInfoGain`. + """ + return self._set(minInfoGain=value) + + def setMaxMemoryInMB(self, value): + """ + Sets the value of :py:attr:`maxMemoryInMB`. + """ + return self._set(maxMemoryInMB=value) + + def setCacheNodeIds(self, value): + """ + Sets the value of :py:attr:`cacheNodeIds`. + """ + return self._set(cacheNodeIds=value) + + @since("1.4.0") + def setImpurity(self, value): + """ + Sets the value of :py:attr:`impurity`. + """ + return self._set(impurity=value) + @since("1.4.0") def setLossType(self, value): """ @@ -1187,6 +1300,13 @@ class GBTRegressor(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol, """ return self._set(lossType=value) + @since("1.4.0") + def setSubsamplingRate(self, value): + """ + Sets the value of :py:attr:`subsamplingRate`. + """ + return self._set(subsamplingRate=value) + @since("2.4.0") def setFeatureSubsetStrategy(self, value): """ --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org