Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/10152#discussion_r46912131
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/feature/Word2Vec.scala ---
@@ -281,16 +280,17 @@ class Word2Vec extends Serializable with Logging {
val expTable = sc.broadcast(createExpTable())
val bcVocab = sc.broadcast(vocab)
val bcVocabHash = sc.broadcast(vocabHash)
-
- val sentences: RDD[Array[Int]] = words.mapPartitions { iter =>
+ //each partition is a collection of sentences, will be translated into
arrays of Index integer
+ val sentences: RDD[Array[Int]] = dataset.mapPartitions { iter =>
--- End diff --
As far as I can tell, there isn't a need for us to limit sentence length in
our implementation; I don't see anything which will blow up without the limit.
It looks like gensim uses a limit in order to collect a buffer/batch of
sentences. Also, it looks like gensim doesn't throw out the rest of the
sentence, unlike the MLlib implementation:
[https://github.com/piskvorky/gensim/blob/839513f81e3aa42f490331fa80a28d13b7b7026f/gensim/models/word2vec.py#L1548]
This is arguably a bug in MLlib, so I'd prefer to remove the limit by
default, but provide a Param for setting it to a particular value to emulate
previous behavior.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]