Github user willb commented on a diff in the pull request:
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/feature/Word2Vec.scala 
    @@ -227,7 +227,7 @@ class Word2VecModel private[ml] (
       def findSynonyms(word: String, num: Int): DataFrame = {
    -    findSynonyms(wordVectors.transform(word), num)
    +    findSynonyms(wordVectors.transform(word), num, Some(word))
    --- End diff --
    In this case (and similarly in 
 I opted to call the three-argument version because the wrappers both 
explicitly convert their argument to a vector before calling `findSynonyms` on 
the underlying model (and so `wordOpt` would not be defined if the wrapper were 
invoked with a word).  If we were to make the three-argument `findSynonyms` 
private we wouldn't be able to share a code path in the wrapper classes and 
would need to duplicate the code to tidy and reformat results in both methods 
(data frame creation in this case, unzipping and `asJava` in the Python model 
wrapper) or factor it out to a separate method.  Let me know how you want me to 
proceed here.
    I agree that updating the docs makes sense and will make it clearer to 
future maintainers as well.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to