#24 Infinite loop in KMeans

open
Thomas Abeel
Algorithms (11)
5
2013-01-29
2013-01-29
Roman Bliznets
No

I used JavaML 0.1.7
Some datas cause infinite loop during a clusterization with KMeans. I cannot provide data to test the issue but I debugged and found what problem is.
There is a loop: while ((randomCentroids) || ((iterationCount < this.numberOfIterations) && (centroidsChanged)))

When iterationCount exeded this.numberOfIterations, the randomCentroids variable still can be true. This cause infine loop when countPosition array contains a zero (0) values, e.g. [0, 400, 0, 0].

Discussion