Github user vlad17 commented on a diff in the pull request: https://github.com/apache/spark/pull/14547#discussion_r78484752 --- Diff: mllib/src/main/scala/org/apache/spark/ml/tree/treeParams.scala --- @@ -220,32 +222,42 @@ private[ml] object TreeClassifierParams { final val supportedImpurities: Array[String] = Array("entropy", "gini").map(_.toLowerCase) } +private[ml] trait TreeClassifierParamsWithDefault extends TreeClassifierParams { + /** + * Criterion used for information gain calculation (case-insensitive). + * Also used for terminal leaf value prediction. + * Supported: "gini" (default) and "entropy" + * + * @group param + */ + override val impurity: Param[String] = new Param[String](this, "impurity", "Criterion used for" + + " information gain calculation (case-insensitive). Supported options:" + + s" ${TreeClassifierParams.supportedImpurities.mkString(", ")}", + (value: String) => TreeClassifierParams.supportedImpurities.contains(value.toLowerCase)) + + setDefault(impurity -> "gini") +} + private[ml] trait DecisionTreeClassifierParams - extends DecisionTreeParams with TreeClassifierParams + extends DecisionTreeParams with TreeClassifierParamsWithDefault /** * Parameters for Decision Tree-based regression algorithms. */ private[ml] trait TreeRegressorParams extends Params { + // Impurity should be overriden when setting a default. This should be a def, but has --- End diff -- done
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org