grafos-ml/okapi — pull request #12 by vasia (2014-07-30 18:39:49+00:00)
Title: Fix kmeans tests

Due to the non-deterministic behavior of the k-means algorithm, some of the tests would fail sometimes.
The problem is that, by randomly selecting the initial centroids, we cannot guarantee that the resulting clusters will be the same (as my tests assumed).
This PR fixes this issue, by skipping the random initialization of the centroids and uses hard-coded initial points instead.
In order to do that, I created a copy of the `KMeansMasterCompute` inside the test, which does nothing during the first superstep and initializes the `INITIAL_CENTERS` aggregator appropriately.
If you could suggest a more elegant way to do this, please let me know!