Github user srowen commented on the pull request:
https://github.com/apache/spark/pull/8314#issuecomment-152986524
@yinxusen I'm trying to help debug the test failure in `Word2VecSuite`
added in
https://github.com/apache/spark/commit/c9d530e2e5123dbd4fd13fc487c890d6076b24bf#diff-a081b952fe8b6e09a492ef37e157b456
I find that changing the seed at all makes the result quite different and the
test fails. However the expected value is computed in a pretty clear way; I'm
trying to figure out why a particular seed is required here. Are the word
vectors chosen to work for the default seed of 42?
While looking at it I think we can fix one small thing in
`org.apache.spark.mllib.feature.Word2Vec`. The initial random vector (which is
what the seed affects) is not quite chosen uniformly:
```
Array.fill[Float](vocabSize * vectorSize)((initRandom.nextFloat() -
0.5f) / vectorSize)
```
should be more like
```
Array.fill[Float](vocabSize *
vectorSize)((initRandom.nextGaussian().toFloat) / vectorSize)
```
This isn't really the issue but something we could adjust. Of course this
also makes the test fail.
If we can't figure this out... I think we could hard-code this test to work
with the new seed behavior, on the theory that it's probably a test issue.
---
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]