Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5296#discussion_r27502588
  
    --- Diff: python/pyspark/mllib/tests.py ---
    @@ -620,6 +621,42 @@ def test_right_number_of_results(self):
             self.assertEqual(len(chi), num_cols)
             self.assertIsNotNone(chi[1000])
     
    +
    +class Word2VecTests(PySparkTestCase):
    +    def test_word2vec_setters(self):
    +        data = [
    +            ["I", "have", "a", "pen"],
    +            ["I", "like", "soccer", "very", "much"],
    +            ["I", "live", "in", "Tokyo"]
    +        ]
    +        model = None
    +        try:
    +            model = Word2Vec()\
    +                .setVectorSize(2)\
    +                .setLearningRate(0.01)\
    +                .setNumPartitions(2)\
    +                .setNumIterations(10)\
    +                .setSeed(1024)\
    +                .setMinCount(3)
    +        except:
    +            self.fail()
    +        self.assertEquals(model.vectorSize, 2)
    +        self.assertTrue(model.learningRate < 0.02)
    +        self.assertEquals(model.numPartitions, 2)
    +        self.assertEquals(model.numIterations, 10)
    +        self.assertEquals(model.seed, 1024)
    +        self.assertEquals(model.minCount, 3)
    +
    +    def test_word2vec_get_vectors(self):
    +        data = [
    +            ["I", "have", "a", "pen"],
    +            ["I", "like", "soccer", "very", "much"],
    +            ["I", "live", "in", "Tokyo"]
    +        ]
    +        model = Word2Vec().fit(self.sc.parallelize(data))
    +        self.assertEquals(len(model.getVectors()), 0)
    --- End diff --
    
    Why is the length 0?


---
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]

Reply via email to