From 3782fa902b8700fd96619a36f5e23baf6b3a9a31 Mon Sep 17 00:00:00 2001 From: tkaessmann Date: Mon, 17 Nov 2014 10:09:02 +0100 Subject: [PATCH 1/4] get raw vectors for further processing --- .../org/apache/spark/mllib/feature/Word2Vec.scala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 f5f7ad613d4c4..fa6ef3644c2bc 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,13 @@ class Word2VecModel private[mllib] ( .tail .toArray } -} + + /** + * Returns the strings with it´s raw vectors for further processing + * (e.g. clustering) + * @return map of string to vector + */ + def getVectors(): Map[String, Array[Float]] = { + model + } +} \ No newline at end of file From a5be2136904acbd42600db95da07f601f1620a1c Mon Sep 17 00:00:00 2001 From: tkaessmann Date: Tue, 18 Nov 2014 20:06:36 +0100 Subject: [PATCH 2/4] fixes getVectors to fit code guidelines --- .../scala/org/apache/spark/mllib/feature/Word2Vec.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 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 fa6ef3644c2bc..34d8245d3fbcf 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 @@ -463,11 +463,11 @@ class Word2VecModel private[mllib] ( } /** - * Returns the strings with it´s raw vectors for further processing + * Returns the strings with it's raw vectors for further processing * (e.g. clustering) * @return map of string to vector */ - def getVectors(): Map[String, Array[Float]] = { + def getVectors: Map[String, Array[Float]] = { model } -} \ No newline at end of file +} From 58d3d833936bbe1bb21109b59c6bf981a203a71f Mon Sep 17 00:00:00 2001 From: tkaessmann Date: Tue, 18 Nov 2014 21:17:20 +0100 Subject: [PATCH 3/4] removes sign from comment --- .../main/scala/org/apache/spark/mllib/feature/Word2Vec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 34d8245d3fbcf..3eed9fb2887b3 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 @@ -463,7 +463,7 @@ class Word2VecModel private[mllib] ( } /** - * Returns the strings with it's raw vectors for further processing + * Returns the strings with its raw vectors for further processing * (e.g. clustering) * @return map of string to vector */ From e3a3142553dcb6728fe8443bc8ad40243cd25121 Mon Sep 17 00:00:00 2001 From: tkaessmann Date: Wed, 19 Nov 2014 12:10:05 +0100 Subject: [PATCH 4/4] changes the comment for getVectors --- .../main/scala/org/apache/spark/mllib/feature/Word2Vec.scala | 4 +--- 1 file changed, 1 insertion(+), 3 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 3eed9fb2887b3..7960f3cab576f 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 @@ -463,9 +463,7 @@ class Word2VecModel private[mllib] ( } /** - * Returns the strings with its raw vectors for further processing - * (e.g. clustering) - * @return map of string to vector + * Returns a map of words to their vector representations. */ def getVectors: Map[String, Array[Float]] = { model