Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/10150#discussion_r49493668
--- Diff: python/pyspark/mllib/tests.py ---
@@ -419,6 +419,17 @@ class ListTests(MLlibTestCase):
as NumPy arrays.
"""
+ def test_bisecting_kmeans(self):
+ from pyspark.mllib.clustering import BisectingKMeans
+ data = array([0.0, 0.0, 1.0, 1.0, 9.0, 8.0, 8.0, 9.0]).reshape(4,
2)
+ bskm = BisectingKMeans()
+ model = bskm.train(sc.parallelize(data, 2), k=4)
+ p = array([0.0, 0.0])
+ rdd_p = self.sc.parallelize([p])
+ self.assertEqual(model.predict(p), model.predict(rdd_p).first())
+ self.assertEqual(model.computeCost(p), model.computeCost(rdd_p))
--- End diff --
I'm surprised this works. Shouldn't you have to call first() on the RDD?
IIRC, assertEqual is from unittest, which won't understand RDDs. (I also want
to make sure this is being run.)
---
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]