When does convergence happen?



In the context of this exercise, describing step 4 of K-Means clustering, when does convergence happen?


Convergence happens when the positions of all the centroids are no longer updated, meaning that they must have converged on some clusters.

We do this in our code by calculating the change in distance for each centroid from its previous position and storing these values inside of an array, called errors. When all the values in this array become 0, there has been convergence.