K-Means Clustering Demo

Step-by-step visualization of the k-means clustering algorithm

Configuration

3

Help

K-Means Algorithm
  • Step 1: Initialize k random centroids
  • Step 2: Assign each point to nearest centroid
  • Step 3: Update centroids to mean of assigned points
  • Step 4: Repeat steps 2-3 until convergence
Understanding Metrics
  • WCSS: Within-Cluster Sum of Squares - lower is better
  • Elbow Method: Plot WCSS vs k to find optimal number of clusters
  • Convergence: Algorithm stops when centroids don't move
  • Local Optima: Different initializations may give different results