@@ -635,8 +635,8 @@ object DecisionTree extends Serializable with Logging {
635635 0
636636 } else {
637637 val globalNodeIndex = predictNodeIndex(nodes(0 ), treePoint.binnedFeatures)
638- // Get index for this level.
639- globalNodeIndex - levelOffset
638+ // Get index for this ( level, group) .
639+ globalNodeIndex - levelOffset - groupShift
640640 }
641641 }
642642
@@ -660,12 +660,6 @@ object DecisionTree extends Serializable with Logging {
660660 numClasses * numBins * featureIndex +
661661 numClasses * treePoint.binnedFeatures(featureIndex) +
662662 treePoint.label.toInt
663- if (aggIndex >= agg.size) {
664- println(s " nodeIndex = $nodeIndex, featureIndex = $featureIndex, " +
665- s " treePoint.binnedFeatures(featureIndex) = ${treePoint.binnedFeatures(featureIndex)}, " +
666- s " label = ${treePoint.label.toInt}, agg.size = ${agg.size}" )
667- println(s " numClasses = $numClasses, numFeatures = $numFeatures, numBins = $numBins" )
668- }
669663 agg(aggIndex) += 1
670664 }
671665
@@ -808,7 +802,10 @@ object DecisionTree extends Serializable with Logging {
808802 */
809803 def binSeqOp (agg : Array [Double ], treePoint : TreePoint ): Array [Double ] = {
810804 val nodeIndex = treePointToNodeIndex(treePoint)
811- if (nodeIndex >= 0 ) { // Otherwise, example does not reach this level.
805+ // If the example does not reach this level, then nodeIndex < 0.
806+ // If the example reaches this level but is handled in a different group,
807+ // then either nodeIndex < 0 (previous group) or nodeIndex >= numNodes (later group).
808+ if (nodeIndex >= 0 && nodeIndex < numNodes) {
812809 strategy.algo match {
813810 case Classification =>
814811 if (isMulticlassClassificationWithCategoricalFeatures) {
@@ -825,7 +822,6 @@ object DecisionTree extends Serializable with Logging {
825822 // Calculate bin aggregate length for classification or regression.
826823 val binAggregateLength = numNodes * getElementsPerNode(numFeatures, numBins, numClasses,
827824 isMulticlassClassificationWithCategoricalFeatures, strategy.algo)
828- println(" binAggregateLength = " + binAggregateLength)
829825 logDebug(" binAggregateLength = " + binAggregateLength)
830826
831827 /**
0 commit comments