aboutsummaryrefslogtreecommitdiff
path: root/docs/mllib-collaborative-filtering.md
diff options
context:
space:
mode:
authorJoseph K. Bradley <joseph@databricks.com>2015-02-27 13:00:36 -0800
committerXiangrui Meng <meng@databricks.com>2015-02-27 13:00:36 -0800
commitd17cb2ba33b363dd346ac5a5681e1757decd0f4d (patch)
treeb6bb3c0062df0d18e3121fcb12fc317627c52b72 /docs/mllib-collaborative-filtering.md
parent57566d0af3008982a1e24a763ed2f6a700b40f8f (diff)
downloadspark-d17cb2ba33b363dd346ac5a5681e1757decd0f4d.tar.gz
spark-d17cb2ba33b363dd346ac5a5681e1757decd0f4d.tar.bz2
spark-d17cb2ba33b363dd346ac5a5681e1757decd0f4d.zip
[SPARK-4587] [mllib] [docs] Fixed save,load calls in ML guide examples
Should pass spark context to save/load CC: mengxr Author: Joseph K. Bradley <joseph@databricks.com> Closes #4816 from jkbradley/ml-io-doc-fix and squashes the following commits: 83d369d [Joseph K. Bradley] added comment to save,load parts of ML guide examples 2841170 [Joseph K. Bradley] Fixed save,load calls in ML guide examples
Diffstat (limited to 'docs/mllib-collaborative-filtering.md')
-rw-r--r--docs/mllib-collaborative-filtering.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/mllib-collaborative-filtering.md b/docs/mllib-collaborative-filtering.md
index 935cd8dad3..27aa4d38b7 100644
--- a/docs/mllib-collaborative-filtering.md
+++ b/docs/mllib-collaborative-filtering.md
@@ -97,8 +97,9 @@ val MSE = ratesAndPreds.map { case ((user, product), (r1, r2)) =>
}.mean()
println("Mean Squared Error = " + MSE)
-model.save("myModelPath")
-val sameModel = MatrixFactorizationModel.load("myModelPath")
+// Save and load model
+model.save(sc, "myModelPath")
+val sameModel = MatrixFactorizationModel.load(sc, "myModelPath")
{% endhighlight %}
If the rating matrix is derived from another source of information (e.g., it is inferred from
@@ -186,8 +187,9 @@ public class CollaborativeFiltering {
).rdd()).mean();
System.out.println("Mean Squared Error = " + MSE);
- model.save("myModelPath");
- MatrixFactorizationModel sameModel = MatrixFactorizationModel.load("myModelPath");
+ // Save and load model
+ model.save(sc.sc(), "myModelPath");
+ MatrixFactorizationModel sameModel = MatrixFactorizationModel.load(sc.sc(), "myModelPath");
}
}
{% endhighlight %}