Skip to content

Commit 733d6dd

Browse files
committed
fixed tests
Signed-off-by: Manish Amde <[email protected]>
1 parent 02c595c commit 733d6dd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class DecisionTreeSuite extends FunSuite with BeforeAndAfterAll {
5353
assert(bins.length==2)
5454
assert(splits(0).length==99)
5555
assert(bins(0).length==100)
56-
println(splits(1)(98))
56+
//println(splits(1)(98))
5757
}
5858

5959
test("stump with fixed label 0 for Gini"){
@@ -68,7 +68,10 @@ class DecisionTreeSuite extends FunSuite with BeforeAndAfterAll {
6868
assert(bins(0).length==100)
6969
assert(splits(0).length==99)
7070
assert(bins(0).length==100)
71-
val bestSplits = DecisionTree.findBestSplits(rdd,Array(0.0),strategy,0,Array[List[Filter]](),splits,bins)
71+
72+
strategy.numBins = 100
73+
val bestSplits = DecisionTree.findBestSplits(rdd,new Array(7),strategy,0,Array[List[Filter]](),splits,bins)
74+
println("here")
7275
assert(bestSplits.length == 1)
7376
assert(0==bestSplits(0)._1.feature)
7477
assert(10==bestSplits(0)._1.threshold)
@@ -91,6 +94,8 @@ class DecisionTreeSuite extends FunSuite with BeforeAndAfterAll {
9194
assert(bins(0).length==100)
9295
assert(splits(0).length==99)
9396
assert(bins(0).length==100)
97+
98+
strategy.numBins = 100
9499
val bestSplits = DecisionTree.findBestSplits(rdd,Array(0.0),strategy,0,Array[List[Filter]](),splits,bins)
95100
assert(bestSplits.length == 1)
96101
assert(0==bestSplits(0)._1.feature)
@@ -115,6 +120,8 @@ class DecisionTreeSuite extends FunSuite with BeforeAndAfterAll {
115120
assert(bins(0).length==100)
116121
assert(splits(0).length==99)
117122
assert(bins(0).length==100)
123+
124+
strategy.numBins = 100
118125
val bestSplits = DecisionTree.findBestSplits(rdd,Array(0.0),strategy,0,Array[List[Filter]](),splits,bins)
119126
assert(bestSplits.length == 1)
120127
assert(0==bestSplits(0)._1.feature)
@@ -138,6 +145,8 @@ class DecisionTreeSuite extends FunSuite with BeforeAndAfterAll {
138145
assert(bins(0).length==100)
139146
assert(splits(0).length==99)
140147
assert(bins(0).length==100)
148+
149+
strategy.numBins = 100
141150
val bestSplits = DecisionTree.findBestSplits(rdd,Array(0.0),strategy,0,Array[List[Filter]](),splits,bins)
142151
assert(bestSplits.length == 1)
143152
assert(0==bestSplits(0)._1.feature)

0 commit comments

Comments
 (0)