diff options
author | tkaessmann <tobias.kaessmann@s24.com> | 2014-11-24 19:58:01 -0800 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2014-11-24 19:58:01 -0800 |
commit | 9ce2bf3821784cded5c2f1e1a75d038f7677be74 (patch) | |
tree | b6360a6bdfe7b0333ec29f6c1f1d62d93697c652 | |
parent | f0afb623dc51fd3008bd80496b8d1eaa991323d6 (diff) | |
download | spark-9ce2bf3821784cded5c2f1e1a75d038f7677be74.tar.gz spark-9ce2bf3821784cded5c2f1e1a75d038f7677be74.tar.bz2 spark-9ce2bf3821784cded5c2f1e1a75d038f7677be74.zip |
[SPARK-4582][MLLIB] get raw vectors for further processing in Word2Vec
This is #3309 for the master branch.
e.g. clustering
Author: tkaessmann <tobias.kaessmanns24.com>
Closes #3309 from tkaessmann/branch-1.2 and squashes the following commits:
e3a3142 [tkaessmann] changes the comment for getVectors
58d3d83 [tkaessmann] removes sign from comment
a5be213 [tkaessmann] fixes getVectors to fit code guidelines
3782fa9 [tkaessmann] get raw vectors for further processing
Author: tkaessmann <tobias.kaessmann@s24.com>
Closes #3437 from mengxr/SPARK-4582 and squashes the following commits:
6c666b4 [tkaessmann] get raw vectors for further processing in Word2Vec
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/feature/Word2Vec.scala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/feature/Word2Vec.scala b/mllib/src/main/scala/org/apache/spark/mllib/feature/Word2Vec.scala index f5f7ad613d..7960f3cab5 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/feature/Word2Vec.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/feature/Word2Vec.scala @@ -461,4 +461,11 @@ class Word2VecModel private[mllib] ( .tail .toArray } + + /** + * Returns a map of words to their vector representations. + */ + def getVectors: Map[String, Array[Float]] = { + model + } } |