aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorXiangrui Meng <meng@databricks.com>2015-04-01 16:47:18 -0700
committerXiangrui Meng <meng@databricks.com>2015-04-01 16:47:18 -0700
commitccafd757eda478913f783f3127be715bf6413740 (patch)
tree96459c20b8183b5742fb55fa31e030bf5daabf0f /python
parentf084c5de14eb10a6aba82a39e03e7877926ebb9e (diff)
downloadspark-ccafd757eda478913f783f3127be715bf6413740.tar.gz
spark-ccafd757eda478913f783f3127be715bf6413740.tar.bz2
spark-ccafd757eda478913f783f3127be715bf6413740.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
Diffstat (limited to 'python')
-rw-r--r--python/pyspark/mllib/recommendation.py6
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: