K-Means Clustering

Discover patterns in data through unsupervised learning

K-Means is an unsupervised learning algorithm that partitions data into K clusters. Watch as the algorithm iteratively assigns points to the nearest centroid and updates centroid positions until convergence.

Algorithm Steps:

1
Initialize K random centroids
2
Assign each point to nearest centroid
3
Update centroids to cluster means
4
Repeat until convergence

Iterations

0

Total Inertia

-

Status

Ready

Understanding K-Means Clustering

K-Means clustering aims to partition n observations into k clusters where each observation belongs to the cluster with the nearest mean (centroid). The algorithm works as follows:

  1. Initialization: Choose K initial cluster centers (centroids), either randomly or using methods like K-means++
  2. Assignment: Assign each data point to the nearest centroid based on Euclidean distance
  3. Update: Recalculate centroids as the mean of all points assigned to each cluster
  4. Repeat: Continue steps 2-3 until centroids no longer move significantly

Key Concepts:

  • Inertia: Sum of squared distances from each point to its assigned centroid
  • Convergence: Algorithm stops when centroids stabilize
  • Local Optima: Results can vary based on initial centroid positions