Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/1975#discussion_r16323074
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/tree/DecisionTree.scala ---
@@ -130,18 +129,35 @@ class DecisionTree (private val strategy: Strategy)
extends Serializable with Lo
// Find best split for all nodes at a level.
timer.start("findBestSplits")
val splitsStatsForLevel = DecisionTree.findBestSplits(treeInput,
parentImpurities,
- strategy, level, filters, splits, bins, maxLevelForSingleGroup,
timer)
+ strategy, level, nodes, splits, bins, maxLevelForSingleGroup,
unorderedFeatures, timer)
timer.stop("findBestSplits")
+ val levelNodeIndexOffset = math.pow(2, level).toInt - 1
for ((nodeSplitStats, index) <-
splitsStatsForLevel.view.zipWithIndex) {
+ val nodeIndex = levelNodeIndexOffset + index
+ val isLeftChild = level != 0 && nodeIndex % 2 == 1
+ val parentNodeIndex = if (isLeftChild) { // -1 for root node
--- End diff --
Sounds good, but I will save that for the next PR so that there are fewer
changes to propagate.
---
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]