How did the point initialized in green region end up in blue? isnt this type of case should be rejected by comparing the cost function J of the different random initializations.
Hello @tarunsaxena1000,
I don’t think our K-mean function has implemented anything to reject a certain initialization.
The colors of the data points should be based on their final classes. Therefore, your screenshot should be showing that there was a centroid locating at the green area at first, then shifted to the blue area finally.

Cheers,
Raymond
hi @rmwkwok thanks for the response, so you are saying that its not possible for 2 centroids to converge at a same point.
It’s possible, because it’s not prohitbited by the algorithm. Rejecting some initial randomized conditions won’t 100% eliminate that possibility either. However, if you run 100 K-means on the dataset, it is much less likely to happen to all of the trials. Try it out yourself and see if you can come up with a way to use “running more K-means” to get rid of that unwanted situation.
When you set the initial centroids, it is best to use a “unique” sorting, so that none of the initial centroids are duplicates.
You are welcome, @tarunsaxena1000!
