Skip to content

Commit 7ad7a71

Browse files
committed
fix unit test
1 parent 822c912 commit 7ad7a71

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mllib/src/test/scala/org/apache/spark/mllib/tree/DecisionTreeSuite.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ class DecisionTreeSuite extends FunSuite with LocalSparkContext {
722722
val treeInput = TreePoint.convertToTreeRDD(input, bins, metadata)
723723
val baggedInput = BaggedPoint.convertToBaggedRDDWithoutSampling(treeInput)
724724

725-
val topNode = Node.emptyNode(nodeIndex = 0)
725+
val topNode = Node.emptyNode(nodeIndex = 1)
726726
assert(topNode.predict.predict === Double.MinValue)
727727
assert(topNode.impurity === -1.0)
728728
assert(topNode.isLeaf === false)
@@ -745,6 +745,8 @@ class DecisionTreeSuite extends FunSuite with LocalSparkContext {
745745
// set impurity and predict for child nodes
746746
assert(topNode.leftNode.get.predict.predict === 0.0)
747747
assert(topNode.rightNode.get.predict.predict === 1.0)
748+
assert(topNode.leftNode.get.impurity === 0.0)
749+
assert(topNode.rightNode.get.impurity === 0.0)
748750
}
749751
}
750752

0 commit comments

Comments
 (0)