Repository: spark Updated Branches: refs/heads/branch-1.0 21fae6d3e -> cb443cf6c
[SPARK-2417][MLlib] Fix DecisionTree tests Fixes test failures introduced by https://github.com/apache/spark/pull/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 #1343 from johnnywalleye/decision-tree-tests and squashes the following commits: ef80603 [johnnywalleye] [SPARK-2417][MLlib] Fix DecisionTree tests (cherry picked from commit d35e3db2325931492b64890125a70579bc3b587b) Signed-off-by: Xiangrui Meng <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/cb443cf6 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/cb443cf6 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/cb443cf6 Branch: refs/heads/branch-1.0 Commit: cb443cf6c3634d4416d9b708e7983c9283660724 Parents: 21fae6d Author: johnnywalleye <[email protected]> Authored: Wed Jul 9 11:06:34 2014 -0700 Committer: Xiangrui Meng <[email protected]> Committed: Wed Jul 9 11:06:48 2014 -0700 ---------------------------------------------------------------------- .../org/apache/spark/mllib/tree/DecisionTreeSuite.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/cb443cf6/mllib/src/test/scala/org/apache/spark/mllib/tree/DecisionTreeSuite.scala ---------------------------------------------------------------------- diff --git a/mllib/src/test/scala/org/apache/spark/mllib/tree/DecisionTreeSuite.scala b/mllib/src/test/scala/org/apache/spark/mllib/tree/DecisionTreeSuite.scala index 35e92d7..bcb1187 100644 --- a/mllib/src/test/scala/org/apache/spark/mllib/tree/DecisionTreeSuite.scala +++ b/mllib/src/test/scala/org/apache/spark/mllib/tree/DecisionTreeSuite.scala @@ -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) } @@ -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) }
