Skip to content

Commit

Permalink
[SPARK-2417][MLlib] Fix DecisionTree tests
Browse files Browse the repository at this point in the history
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 <[email protected]>

Closes apache#1343 from johnnywalleye/decision-tree-tests and squashes the following commits:

ef80603 [johnnywalleye] [SPARK-2417][MLlib] Fix DecisionTree tests
  • Loading branch information
jonsondag authored and mengxr committed Jul 9, 2014
1 parent 0eb1152 commit d35e3db
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ class DecisionTreeSuite extends FunSuite with LocalSparkContext {

val stats = bestSplits(0)._2
assert(stats.gain > 0)
assert(stats.predict > 0.4)
assert(stats.predict < 0.5)
assert(stats.predict > 0.5)
assert(stats.predict < 0.7)
assert(stats.impurity > 0.2)
}

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

val stats = bestSplits(0)._2
assert(stats.gain > 0)
assert(stats.predict > 0.4)
assert(stats.predict < 0.5)
assert(stats.predict > 0.5)
assert(stats.predict < 0.7)
assert(stats.impurity > 0.2)
}

Expand Down

0 comments on commit d35e3db

Please sign in to comment.