Clustering model
K-Means Clustering
Partitioning data into K clusters by minimizing within-cluster variance.
K-Means Clustering is an unsupervised learning algorithm that partitions n observations into k clusters, where each observation belongs to the cluster with the nearest centroid. It iteratively assigns points to clusters and updates centroids until convergence.
Formula
min โแตข โโโCแตข ||x - ฮผแตข||ยฒ
How it works
- Initialize k cluster centroids (randomly or using k-means++)
- Assign each data point to nearest centroid
- Recalculate centroids as mean of assigned points
- Repeat steps 2-3 until convergence
- Convergence when assignments no longer change
When to use it
- When number of clusters is known or estimable
- For customer segmentation
- When clusters are roughly spherical
- For data compression
- As preprocessing for other algorithms
Advantages
- Simple and easy to implement
- Fast and scalable
- Works well for spherical clusters
- Easy to interpret results
- Guaranteed convergence
Limitations
- Must specify k in advance
- Sensitive to initialization
- Assumes spherical clusters
- Sensitive to outliers
- May converge to local minimum
Example uses
- Customer segmentation
- Image compression
- Document clustering
- Anomaly detection
- Market segmentation
Related models
Need a model built on your data?
Tell us the decision you want to improve. We will tell you whether your data can support it and which approach fits.