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

    https://github.com/apache/spark/pull/7694#discussion_r35959932
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/tree/model/InformationGainStats.scala
 ---
    @@ -76,3 +77,52 @@ private[spark] object InformationGainStats {
       val invalidInformationGainStats = new 
InformationGainStats(Double.MinValue, -1.0, -1.0, -1.0,
         new Predict(0.0, 0.0), new Predict(0.0, 0.0))
     }
    +
    +class ImpurityStats(
    +    val gain: Double,
    +    val impurity: Double,
    +    val impurityCalculator: ImpurityCalculator,
    +    val leftImpurityCalculator: ImpurityCalculator,
    +    val rightImpurityCalculator: ImpurityCalculator) extends Serializable {
    +
    +  override def toString: String = {
    +    s"gain = $gain, impurity = $impurity, left impurity = $leftImpurity, " 
+
    +      s"right impurity = $rightImpurity"
    +  }
    +
    +  def leftImpurity: Double = leftImpurityCalculator.calculate()
    +
    +  def rightImpurity: Double = rightImpurityCalculator.calculate()
    +
    +  override def equals(o: Any): Boolean = o match {
    +    case other: ImpurityStats =>
    +      gain == other.gain &&
    --- 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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to