You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by sethah <gi...@git.apache.org> on 2017/01/01 21:03:38 UTC
[GitHub] spark pull request #16377: [SPARK-18036][ML][MLLIB] Fixing decision trees ha...
Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/16377#discussion_r94288764
--- Diff: mllib/src/main/scala/org/apache/spark/ml/tree/impl/RandomForest.scala ---
@@ -713,6 +713,15 @@ private[spark] object RandomForest extends Logging {
binAggregates.metadata.numSplits(featureIndex) != 0
}
+ // If no valid splits for features, then this split is invalid,
+ // return invalid information gain stats. Take any split and continue.
+ if (validFeatureSplits.isEmpty) {
+ val parentImpurityCalculator = binAggregates.getImpurityCalculator(0, 0)
--- End diff --
Here, you're using feature index zero, even though this node might have a feature subset that does not include zero. The code still works, but it might be better to use `val dummyIndex = featuresForNode.map(_.head).getOrElse(0)`
---
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