Github user vlad17 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14547#discussion_r78485087
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/tree/treeParams.scala ---
    @@ -465,33 +497,64 @@ private[ml] trait GBTParams extends 
TreeEnsembleParams with HasMaxIter with HasS
     }
     
     private[ml] object GBTClassifierParams {
    -  // The losses below should be lowercase.
    -  /** Accessor for supported loss settings: logistic */
    -  final val supportedLossTypes: Array[String] = 
Array("logistic").map(_.toLowerCase)
    +  // The values below should be lowercase.
    +  /** Accessor for supported loss settings: logistic, bernoulli */
    +  final val supportedLossTypes: Array[String] = Array("logistic", 
"bernoulli")
    +  /** Accessor for support entropy settings: loss-based or variance */
    +  final val supportedImpurities: Array[String] = Array("loss-based", 
"variance")
    +  final def getLossBasedImpurity(loss: String): OldImpurity = loss match {
    +    case "logistic" | "bernoulli" => ApproxBernoulliImpurity
    +    case _ => throw new RuntimeException(
    +      s"GBTClassifier does not have loss-based impurity for loss ${loss}")
    +  }
     }
     
     private[ml] trait GBTClassifierParams extends GBTParams with 
TreeClassifierParams {
     
       /**
    +   * Criterion used for information gain calculation (case-insensitive).
    +   * Also used for terminal leaf value prediction.
    +   * Supported: "loss-based" (default) and "variance"
    +   *
    +   * @group param
    +   */
    +  override val impurity: Param[String] = new Param[String](this, 
"impurity", "Criterion used for" +
    +    " information gain calculation (case-insensitive). Supported options:" 
+
    +    s" ${GBTClassifierParams.supportedImpurities.mkString(", ")}",
    +    (value: String) => 
GBTClassifierParams.supportedImpurities.contains(value.toLowerCase))
    +
    +  /** (private[ml]) convert new impurity to old impurity */
    --- 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

Reply via email to