Skip to content

Commit d35e3db

Browse files
jonsondagmengxr
authored andcommitted
[SPARK-2417][MLlib] Fix DecisionTree tests
Fixes test failures introduced by apache#1316. For both the regression and classification cases, val stats is the InformationGainStats for the best tree split. stats.predict is the predicted value for the data, before the split is made. Since 600 of the 1,000 values generated by DecisionTreeSuite.generateCategoricalDataPoints() are 1.0 and the rest 0.0, the regression tree and classification tree both correctly predict a value of 0.6 for this data now, and the assertions have been changed to reflect that. Author: johnnywalleye <jsondag@gmail.com> Closes apache#1343 from johnnywalleye/decision-tree-tests and squashes the following commits: ef80603 [johnnywalleye] [SPARK-2417][MLlib] Fix DecisionTree tests
1 parent 0eb1152 commit d35e3db

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ class DecisionTreeSuite extends FunSuite with LocalSparkContext {
253253

254254
val stats = bestSplits(0)._2
255255
assert(stats.gain > 0)
256-
assert(stats.predict > 0.4)
257-
assert(stats.predict < 0.5)
256+
assert(stats.predict > 0.5)
257+
assert(stats.predict < 0.7)
258258
assert(stats.impurity > 0.2)
259259
}
260260

@@ -280,8 +280,8 @@ class DecisionTreeSuite extends FunSuite with LocalSparkContext {
280280

281281
val stats = bestSplits(0)._2
282282
assert(stats.gain > 0)
283-
assert(stats.predict > 0.4)
284-
assert(stats.predict < 0.5)
283+
assert(stats.predict > 0.5)
284+
assert(stats.predict < 0.7)
285285
assert(stats.impurity > 0.2)
286286
}
287287

0 commit comments

Comments
 (0)