Initialization: Select K initial cluster centers (centroids) randomly or based on some heuristic. Assignment: Assign each data point to the nearest centroid, forming K clusters. Update: Calculate the new centroids by taking the mean of all data points assigned to each cluster. Repeat: Repeat the assignment and update steps until the centroids no longer change significantly or a maximum number of iterations is reached.
This iterative process ensures that the clusters formed are as compact and well-separated as possible, making it easier to analyze and interpret the data.