Assignment step (E-step): For each point, compute its distance to every centroid (usually Euclidean distance). Assign the point to the nearest centroid.
Update step (M-step): The new centroid of each cluster is the mean vector of all points in that cluster.
Empty clusters: If a centroid gets no points, a common fix is to move the farthest point from its own centroid into that cluster, or reinitialize the centroid at random. Mentioning this proactively is a plus.
The objective is the within-cluster sum of squares (WCSS). Alternating the two steps makes WCSS decrease monotonically, but it only guarantees convergence to a local optimum.
Get asked follow-ups live, then receive a scored report — like a real MLE interview loop.
Start AI mock interview