aboutsummaryrefslogtreecommitdiff
path: root/docs/mllib-feature-extraction.md
diff options
context:
space:
mode:
authorYuhao Yang <hhbyyh@gmail.com>2015-05-31 11:51:49 -0700
committerJoseph K. Bradley <joseph@databricks.com>2015-05-31 11:51:49 -0700
commit0674700303da3e4737d73f5fabd2a925ec712f63 (patch)
treeaccc878afed083e7603a6ff11ad7f5be71e45555 /docs/mllib-feature-extraction.md
parente1067d0ad1c32c678c23d76d7653b51770795831 (diff)
downloadspark-0674700303da3e4737d73f5fabd2a925ec712f63.tar.gz
spark-0674700303da3e4737d73f5fabd2a925ec712f63.tar.bz2
spark-0674700303da3e4737d73f5fabd2a925ec712f63.zip
[SPARK-7949] [MLLIB] [DOC] update document with some missing save/load
add save load for examples: KMeansModel PowerIterationClusteringModel Word2VecModel IsotonicRegressionModel Author: Yuhao Yang <hhbyyh@gmail.com> Closes #6498 from hhbyyh/docSaveLoad and squashes the following commits: 7f9f06d [Yuhao Yang] add missing imports c604cad [Yuhao Yang] Merge remote-tracking branch 'upstream/master' into docSaveLoad 1dd77cc [Yuhao Yang] update document with some missing save/load
Diffstat (limited to 'docs/mllib-feature-extraction.md')
-rw-r--r--docs/mllib-feature-extraction.md6
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/mllib-feature-extraction.md b/docs/mllib-feature-extraction.md
index 1f6ad8b13d..4fe470a8de 100644
--- a/docs/mllib-feature-extraction.md
+++ b/docs/mllib-feature-extraction.md
@@ -188,7 +188,7 @@ Here we assume the extracted file is `text8` and in same directory as you run th
import org.apache.spark._
import org.apache.spark.rdd._
import org.apache.spark.SparkContext._
-import org.apache.spark.mllib.feature.Word2Vec
+import org.apache.spark.mllib.feature.{Word2Vec, Word2VecModel}
val input = sc.textFile("text8").map(line => line.split(" ").toSeq)
@@ -201,6 +201,10 @@ val synonyms = model.findSynonyms("china", 40)
for((synonym, cosineSimilarity) <- synonyms) {
println(s"$synonym $cosineSimilarity")
}
+
+// Save and load model
+model.save(sc, "myModelPath")
+val sameModel = Word2VecModel.load(sc, "myModelPath")
{% endhighlight %}
</div>
<div data-lang="python">