Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get raw vectors for further processing in Word2Vec #3309

Closed
wants to merge 4 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -461,4 +461,13 @@ class Word2VecModel private[mllib] (
.tail
.toArray
}

/**
* Returns the strings with its raw vectors for further processing
* (e.g. clustering)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for making one more iteration! The doc could be more concise, e.g.

Returns a map of words to their vector representations.

for further processing (e.g. cluster) is not necessary because we don't restrict how users will use it.

Usually, if Returns ... contains all the information, we don't need @return.

Another question I have is on the return type. We use Array[Float] to save space in computation. Shall we return Map[String, Vector] here, just to be consistent with others? @Ishiihara

* @return map of string to vector
*/
def getVectors: Map[String, Array[Float]] = {
model
}
}