aboutsummaryrefslogtreecommitdiff
path: root/mllib/src/test
diff options
context:
space:
mode:
authorXiangrui Meng <meng@databricks.com>2015-02-02 23:49:09 -0800
committerXiangrui Meng <meng@databricks.com>2015-02-02 23:49:09 -0800
commit0cc7b88c99405db99bc4c3d66f5409e5da0e3c6e (patch)
tree954be2e5603e919a268ea9d68262586b2eb77ed4 /mllib/src/test
parentb8ebebeaaa259be4fcddf65b3280d23165b011a1 (diff)
downloadspark-0cc7b88c99405db99bc4c3d66f5409e5da0e3c6e.tar.gz
spark-0cc7b88c99405db99bc4c3d66f5409e5da0e3c6e.tar.bz2
spark-0cc7b88c99405db99bc4c3d66f5409e5da0e3c6e.zip
[SPARK-5536] replace old ALS implementation by the new one
The only issue is that `analyzeBlock` is removed, which was marked as a developer API. I didn't change other tests in the ALSSuite under `spark.mllib` to ensure that the implementation is correct. CC: srowen coderxiang Author: Xiangrui Meng <meng@databricks.com> Closes #4321 from mengxr/SPARK-5536 and squashes the following commits: 5a3cee8 [Xiangrui Meng] update python tests that are too strict e840acf [Xiangrui Meng] ignore scala style check for ALS.train e9a721c [Xiangrui Meng] update mima excludes 9ee6a36 [Xiangrui Meng] merge master 9a8aeac [Xiangrui Meng] update tests d8c3271 [Xiangrui Meng] remove analyzeBlocks d68eee7 [Xiangrui Meng] add checkpoint to new ALS 22a56f8 [Xiangrui Meng] wrap old ALS c387dff [Xiangrui Meng] support random seed 3bdf24b [Xiangrui Meng] make storage level configurable in the new ALS
Diffstat (limited to 'mllib/src/test')
-rw-r--r--mllib/src/test/scala/org/apache/spark/ml/recommendation/ALSSuite.scala2
-rw-r--r--mllib/src/test/scala/org/apache/spark/mllib/recommendation/ALSSuite.scala18
2 files changed, 1 insertions, 19 deletions
diff --git a/mllib/src/test/scala/org/apache/spark/ml/recommendation/ALSSuite.scala b/mllib/src/test/scala/org/apache/spark/ml/recommendation/ALSSuite.scala
index ee08c3c327..acc447742b 100644
--- a/mllib/src/test/scala/org/apache/spark/ml/recommendation/ALSSuite.scala
+++ b/mllib/src/test/scala/org/apache/spark/ml/recommendation/ALSSuite.scala
@@ -414,7 +414,7 @@ class ALSSuite extends FunSuite with MLlibTestSparkContext with Logging {
val (training, test) =
genExplicitTestData(numUsers = 20, numItems = 40, rank = 2, noiseStd = 0.01)
for ((numUserBlocks, numItemBlocks) <- Seq((1, 1), (1, 2), (2, 1), (2, 2))) {
- testALS(training, test, maxIter = 4, rank = 2, regParam = 0.01, targetRMSE = 0.03,
+ testALS(training, test, maxIter = 4, rank = 3, regParam = 0.01, targetRMSE = 0.03,
numUserBlocks = numUserBlocks, numItemBlocks = numItemBlocks)
}
}
diff --git a/mllib/src/test/scala/org/apache/spark/mllib/recommendation/ALSSuite.scala b/mllib/src/test/scala/org/apache/spark/mllib/recommendation/ALSSuite.scala
index e9fc37e000..8775c0ca9d 100644
--- a/mllib/src/test/scala/org/apache/spark/mllib/recommendation/ALSSuite.scala
+++ b/mllib/src/test/scala/org/apache/spark/mllib/recommendation/ALSSuite.scala
@@ -24,9 +24,7 @@ import scala.util.Random
import org.scalatest.FunSuite
import org.jblas.DoubleMatrix
-import org.apache.spark.SparkContext._
import org.apache.spark.mllib.util.MLlibTestSparkContext
-import org.apache.spark.mllib.recommendation.ALS.BlockStats
import org.apache.spark.storage.StorageLevel
object ALSSuite {
@@ -189,22 +187,6 @@ class ALSSuite extends FunSuite with MLlibTestSparkContext {
testALS(100, 200, 2, 15, 0.7, 0.4, false, false, false, -1, -1, false)
}
- test("analyze one user block and one product block") {
- val localRatings = Seq(
- Rating(0, 100, 1.0),
- Rating(0, 101, 2.0),
- Rating(0, 102, 3.0),
- Rating(1, 102, 4.0),
- Rating(2, 103, 5.0))
- val ratings = sc.makeRDD(localRatings, 2)
- val stats = ALS.analyzeBlocks(ratings, 1, 1)
- assert(stats.size === 2)
- assert(stats(0) === BlockStats("user", 0, 3, 5, 4, 3))
- assert(stats(1) === BlockStats("product", 0, 4, 5, 3, 4))
- }
-
- // TODO: add tests for analyzing multiple user/product blocks
-
/**
* Test if we can correctly factorize R = U * P where U and P are of known rank.
*