Skip to content

Commit 4dfe136

Browse files
committed
add cache back
1 parent 0b35c15 commit 4dfe136

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mllib/src/test/scala/org/apache/spark/mllib/regression/IsotonicRegressionSuite.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class IsotonicRegressionSuite extends FunSuite with MLlibTestSparkContext with M
120120
}
121121

122122
test("isotonic regression with unordered input") {
123-
val trainRDD = sc.parallelize(generateIsotonicInput(Seq(1, 2, 3, 4, 5)).reverse, 2)
123+
val trainRDD = sc.parallelize(generateIsotonicInput(Seq(1, 2, 3, 4, 5)).reverse, 2).cache()
124124

125125
val model = new IsotonicRegression().run(trainRDD)
126126
assert(model.predictions === Array(1, 2, 3, 4, 5))
@@ -169,7 +169,7 @@ class IsotonicRegressionSuite extends FunSuite with MLlibTestSparkContext with M
169169
test("isotonic regression prediction with duplicate features") {
170170
val trainRDD = sc.parallelize(
171171
Seq[(Double, Double, Double)](
172-
(2, 1, 1), (1, 1, 1), (4, 2, 1), (2, 2, 1), (6, 3, 1), (5, 3, 1)), 2)
172+
(2, 1, 1), (1, 1, 1), (4, 2, 1), (2, 2, 1), (6, 3, 1), (5, 3, 1)), 2).cache()
173173
val model = new IsotonicRegression().run(trainRDD)
174174

175175
assert(model.predict(0) === 1)
@@ -181,7 +181,7 @@ class IsotonicRegressionSuite extends FunSuite with MLlibTestSparkContext with M
181181
test("antitonic regression prediction with duplicate features") {
182182
val trainRDD = sc.parallelize(
183183
Seq[(Double, Double, Double)](
184-
(5, 1, 1), (6, 1, 1), (2, 2, 1), (4, 2, 1), (1, 3, 1), (2, 3, 1)), 2)
184+
(5, 1, 1), (6, 1, 1), (2, 2, 1), (4, 2, 1), (1, 3, 1), (2, 3, 1)), 2).cache()
185185
val model = new IsotonicRegression().setIsotonic(false).run(trainRDD)
186186

187187
assert(model.predict(0) === 6)
@@ -193,7 +193,7 @@ class IsotonicRegressionSuite extends FunSuite with MLlibTestSparkContext with M
193193
test("isotonic regression RDD prediction") {
194194
val model = runIsotonicRegression(Seq(1, 2, 7, 1, 2), true)
195195

196-
val testRDD = sc.parallelize(List(-2.0, -1.0, 0.5, 0.75, 1.0, 2.0, 9.0), 2)
196+
val testRDD = sc.parallelize(List(-2.0, -1.0, 0.5, 0.75, 1.0, 2.0, 9.0), 2).cache()
197197
val predictions = testRDD.map(x => (x, model.predict(x))).collect().sortBy(_._1).map(_._2)
198198
assert(predictions === Array(1, 1, 1.5, 1.75, 2, 10.0/3, 10.0/3))
199199
}

0 commit comments

Comments
 (0)