spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkbradley <...@git.apache.org>
Subject [GitHub] spark pull request #16377: [SPARK-18036][ML][MLLIB] Fixing decision trees ha...
Date Mon, 23 Jan 2017 20:15:59 GMT
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16377#discussion_r97405668
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/tree/impl/RandomForest.scala ---
    @@ -828,8 +828,27 @@ private[spark] object RandomForest extends Logging {
                 new CategoricalSplit(featureIndex, categoriesForSplit.toArray, numCategories)
               (bestFeatureSplit, bestFeatureGainStats)
             }
    -      }.maxBy(_._2.gain)
    +      }
     
    +    val (bestSplit, bestSplitStats) =
    +      if (splitsAndImpurityInfo.isEmpty) {
    +        // If no valid splits for features, then this split is invalid,
    +        // return invalid information gain stats.  Take any split and continue.
    +        // Splits is empty, so arbitrarily choose to split on any threshold
    +        val dummyFeatureIndex = featuresForNode.map(_.head).getOrElse(0)
    +        val parentImpurityCalculator = binAggregates.getImpurityCalculator(
    --- End diff --
    
    Why not use ```binAggregates.getParentImpurityCalculator```?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message