Skip to content

Commit

Permalink
[SPARK-26127][ML] Remove deprecated setImpurity from tree regression …
Browse files Browse the repository at this point in the history
…and classification models
  • Loading branch information
mgaido91 committed Nov 20, 2018
1 parent a09d5ba commit 56d61f3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class DecisionTreeClassifier @Since("1.4.0") (

/** @group setParam */
@Since("1.4.0")
override def setImpurity(value: String): this.type = set(impurity, value)
def setImpurity(value: String): this.type = set(impurity, value)

/** @group setParam */
@Since("1.6.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class GBTClassifier @Since("1.4.0") (
* @group setParam
*/
@Since("1.4.0")
override def setImpurity(value: String): this.type = {
def setImpurity(value: String): this.type = {
logWarning("GBTClassifier.setImpurity should NOT be used")
this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class RandomForestClassifier @Since("1.4.0") (

/** @group setParam */
@Since("1.4.0")
override def setImpurity(value: String): this.type = set(impurity, value)
def setImpurity(value: String): this.type = set(impurity, value)

// Parameters from TreeEnsembleParams:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class DecisionTreeRegressor @Since("1.4.0") (@Since("1.4.0") override val uid: S

/** @group setParam */
@Since("1.4.0")
override def setImpurity(value: String): this.type = set(impurity, value)
def setImpurity(value: String): this.type = set(impurity, value)

/** @group setParam */
@Since("1.6.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class GBTRegressor @Since("1.4.0") (@Since("1.4.0") override val uid: String)
* @group setParam
*/
@Since("1.4.0")
override def setImpurity(value: String): this.type = {
def setImpurity(value: String): this.type = {
logWarning("GBTRegressor.setImpurity should NOT be used")
this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class RandomForestRegressor @Since("1.4.0") (@Since("1.4.0") override val uid: S

/** @group setParam */
@Since("1.4.0")
override def setImpurity(value: String): this.type = set(impurity, value)
def setImpurity(value: String): this.type = set(impurity, value)

// Parameters from TreeEnsembleParams:

Expand Down
14 changes: 0 additions & 14 deletions mllib/src/main/scala/org/apache/spark/ml/tree/treeParams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,6 @@ private[ml] trait TreeClassifierParams extends Params {

setDefault(impurity -> "gini")

/**
* @deprecated This method is deprecated and will be removed in 3.0.0.
* @group setParam
*/
@deprecated("This method is deprecated and will be removed in 3.0.0.", "2.1.0")
def setImpurity(value: String): this.type = set(impurity, value)

/** @group getParam */
final def getImpurity: String = $(impurity).toLowerCase(Locale.ROOT)

Expand Down Expand Up @@ -273,13 +266,6 @@ private[ml] trait HasVarianceImpurity extends Params {

setDefault(impurity -> "variance")

/**
* @deprecated This method is deprecated and will be removed in 3.0.0.
* @group setParam
*/
@deprecated("This method is deprecated and will be removed in 3.0.0.", "2.1.0")
def setImpurity(value: String): this.type = set(impurity, value)

/** @group getParam */
final def getImpurity: String = $(impurity).toLowerCase(Locale.ROOT)

Expand Down
13 changes: 9 additions & 4 deletions project/MimaExcludes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,26 @@ object MimaExcludes {

// Exclude rules for 3.0.x
lazy val v30excludes = v24excludes ++ Seq(

// [SPARK-26127] Remove deprecated setImpurity from tree regression and classification models
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.spark.ml.classification.DecisionTreeClassificationModel.setImpurity"),
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.spark.ml.classification.RandomForestClassificationModel.setImpurity"),
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.spark.ml.classification.GBTClassificationModel.setImpurity"),
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.spark.ml.regression.DecisionTreeRegressionModel.setImpurity"),
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.spark.ml.regression.GBTRegressionModel.setImpurity"),
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.spark.ml.regression.RandomForestRegressionModel.setImpurity"),

// [SPARK-26090] Resolve most miscellaneous deprecation and build warnings for Spark 3
ProblemFilters.exclude[MissingClassProblem]("org.apache.spark.mllib.stat.test.BinarySampleBeanInfo"),
ProblemFilters.exclude[MissingClassProblem]("org.apache.spark.mllib.regression.LabeledPointBeanInfo"),
ProblemFilters.exclude[MissingClassProblem]("org.apache.spark.ml.feature.LabeledPointBeanInfo"),

// [SPARK-25959] GBTClassifier picks wrong impurity stats on loading
ProblemFilters.exclude[IncompatibleResultTypeProblem]("org.apache.spark.ml.classification.GBTClassificationModel.setImpurity"),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("org.apache.spark.ml.tree.HasVarianceImpurity.org$apache$spark$ml$tree$HasVarianceImpurity$_setter_$impurity_="),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("org.apache.spark.ml.tree.HasVarianceImpurity.org$apache$spark$ml$tree$HasVarianceImpurity$_setter_$impurity_="),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("org.apache.spark.ml.tree.HasVarianceImpurity.org$apache$spark$ml$tree$HasVarianceImpurity$_setter_$impurity_="),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("org.apache.spark.ml.tree.HasVarianceImpurity.org$apache$spark$ml$tree$HasVarianceImpurity$_setter_$impurity_="),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("org.apache.spark.ml.tree.HasVarianceImpurity.org$apache$spark$ml$tree$HasVarianceImpurity$_setter_$impurity_="),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("org.apache.spark.ml.regression.DecisionTreeRegressionModel.setImpurity"),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("org.apache.spark.ml.regression.GBTRegressionModel.setImpurity"),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("org.apache.spark.ml.regression.RandomForestRegressionModel.setImpurity"),

// [SPARK-25908][CORE][SQL] Remove old deprecated items in Spark 3
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.spark.BarrierTaskContext.isRunningLocally"),
Expand Down

0 comments on commit 56d61f3

Please sign in to comment.