diff options
author | Xiangrui Meng <meng@databricks.com> | 2015-04-01 16:47:18 -0700 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2015-04-01 16:54:41 -0700 |
commit | bc04fa2e2ade3343f0fdc20cd9702260c717dea7 (patch) | |
tree | 21da7d05b848695d8da1fa856c7096d3c62fea7d /python/pyspark | |
parent | 1c31ebd125df14361f14fe4a744d87575eb22e4c (diff) | |
download | spark-bc04fa2e2ade3343f0fdc20cd9702260c717dea7.tar.gz spark-bc04fa2e2ade3343f0fdc20cd9702260c717dea7.tar.bz2 spark-bc04fa2e2ade3343f0fdc20cd9702260c717dea7.zip |
[SPARK-6642][MLLIB] use 1.2 lambda scaling and remove addImplicit from NormalEquation
This PR changes lambda scaling from number of users/items to number of explicit ratings. The latter is the behavior in 1.2. Slight refactor of NormalEquation to make it independent of ALS models. srowen codexiang
Author: Xiangrui Meng <meng@databricks.com>
Closes #5314 from mengxr/SPARK-6642 and squashes the following commits:
dc655a1 [Xiangrui Meng] relax python tests
f410df2 [Xiangrui Meng] use 1.2 scaling and remove addImplicit from NormalEquation
(cherry picked from commit ccafd757eda478913f783f3127be715bf6413740)
Signed-off-by: Xiangrui Meng <meng@databricks.com>
Conflicts:
mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala
Diffstat (limited to 'python/pyspark')
-rw-r--r-- | python/pyspark/mllib/recommendation.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/python/pyspark/mllib/recommendation.py b/python/pyspark/mllib/recommendation.py index b094e50856..c5c4c13dae 100644 --- a/python/pyspark/mllib/recommendation.py +++ b/python/pyspark/mllib/recommendation.py @@ -52,7 +52,7 @@ class MatrixFactorizationModel(JavaModelWrapper, JavaSaveable, JavaLoader): >>> ratings = sc.parallelize([r1, r2, r3]) >>> model = ALS.trainImplicit(ratings, 1, seed=10) >>> model.predict(2, 2) - 0.43... + 0.4... >>> testset = sc.parallelize([(1, 2), (1, 1)]) >>> model = ALS.train(ratings, 2, seed=0) @@ -82,14 +82,14 @@ class MatrixFactorizationModel(JavaModelWrapper, JavaSaveable, JavaLoader): >>> model = ALS.trainImplicit(ratings, 1, nonnegative=True, seed=10) >>> model.predict(2,2) - 0.43... + 0.4... >>> import os, tempfile >>> path = tempfile.mkdtemp() >>> model.save(sc, path) >>> sameModel = MatrixFactorizationModel.load(sc, path) >>> sameModel.predict(2,2) - 0.43... + 0.4... >>> sameModel.predictAll(testset).collect() [Rating(... >>> try: |