diff --git a/python/pyspark/ml/classification.py b/python/pyspark/ml/classification.py index c257ace02cfe9..ce6543952bf6d 100644 --- a/python/pyspark/ml/classification.py +++ b/python/pyspark/ml/classification.py @@ -874,13 +874,6 @@ class TreeClassifierParams(object): def __init__(self): 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): """ @@ -1003,6 +996,49 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre 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 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre 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 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre 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 @@ def setLossType(self, value): """ 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 6405b9fce7efb..56d6190723161 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 927cc77e201a5..349130f22fade 100644 --- a/python/pyspark/ml/regression.py +++ b/python/pyspark/ml/regression.py @@ -609,13 +609,6 @@ class TreeEnsembleParams(DecisionTreeParams): def __init__(self): 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): """ @@ -623,15 +616,6 @@ def getSubsamplingRate(self): """ 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): """ @@ -655,13 +639,6 @@ class HasVarianceImpurity(Params): def __init__(self): 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): """ @@ -685,13 +662,6 @@ class RandomForestParams(TreeEnsembleParams): def __init__(self): 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): """ @@ -843,6 +813,49 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre 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 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre 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 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre 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 @@ def setLossType(self, value): """ 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): """