Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/8087#discussion_r36698976
--- Diff: python/pyspark/mllib/tests.py ---
@@ -1041,10 +1054,12 @@ def test_trainOn_model(self):
self.ssc.start()
# Give enough time to train the model.
- self._ssc_wait(t, 6.0, 0.01)
- finalModel = stkm.latestModel()
- self.assertTrue(all(finalModel.centers == array(initCenters)))
- self.assertEquals(finalModel.clusterWeights, [5.0, 5.0, 5.0, 5.0])
+ def termCheck():
+ finalModel = stkm.latestModel()
+ all(finalModel.centers == array(initCenters)) and \
+ finalModel.clusterWeight == [5.0, 5.0, 5.0, 5.0]
+ self._ssc_wait_checked(t, 20.0, termCheck)
+ self.assertTrue(termCheck())
--- End diff --
For these tests, they should pass whenever all batches have been processed,
so the current setup should be safe. I'm actually thinking of copying the
checks so that assertions print out more useful error messages. (I don't see a
great way to avoid copying the checks if I want them for both early stopping &
useful error messages.)
---
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]