"We all know we are unique individuals, but we tend to see others as representatives of groups."
- Deborah Tannen
In the previous section, we discussed the constraint we put on our objective function by specifying the number of clusters we need. This is what the K stands for: the number of clusters. We also discussed the cluster's centroid, hence the word means. The algorithm works as follows:
- It starts by picking K random points and setting them as the cluster centroids.
- Then, it assigns each data point to the nearest centroid to it to form K clusters.
- Then, it calculates a new centroid for the newly formed clusters.
- Since the centroids have been updated, we need to go back to step 2 to reassign the samples to their new clusters based on the updated centroids. However, if the centroids didn't move much, we know that the algorithm has converged, and we stop.