-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-5692] [MLlib] Word2Vec save/load #5291
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
Conversation
ping @mengxr @jkbradley |
Test build #29473 has started for PR 5291 at commit |
Test build #29473 has finished for PR 5291 at commit
|
Test FAILed. |
Test build #29476 has started for PR 5291 at commit |
Test build #29476 has finished for PR 5291 at commit
|
Test PASSed. |
try { | ||
model.save(sc, path) | ||
val sameModel = Word2VecModel.load(sc, path) | ||
assert(sameModel.getVectors.keys === model.getVectors.keys) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ordering of keys are not guaranteed. We could test map equals directly.
assert(sameModel.getVectors.mapValues(_.toSeq) === model.getVectors.mapValues(_.toSeq))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Why does this not work for a raw array?
@MechCoder Could you please add a quick description to the PR for record-keeping? Thanks! |
Test build #29495 has started for PR 5291 at commit |
@mengxr I have fixed your comments and @jkbradley I have updated the PR description. |
Test build #29495 has finished for PR 5291 at commit
|
Test PASSed. |
LGTM. Merged into master. Thanks! |
Word2Vec model now supports saving and loading.
a] The Metadata stored in JSON format consists of "version", "classname", "vectorSize" and "numWords"
b] The data stored in Parquet file format consists of an Array of rows with each row consisting of 2 columns, first being the word: String and the second, an Array of Floats.