Watch the K-Means algorithm cluster data points in real-time! Click to add points or generate random clusters.
K-Means is one of the most popular unsupervised machine learning algorithms. It partitions data into K distinct, non-overlapping clusters where each data point belongs to the cluster with the nearest mean (centroid).
K (Number of Clusters): The number of groups you want to divide your data into. This must be specified beforehand.
Centroid: The center point of each cluster, calculated as the mean of all points in that cluster.
Inertia: Sum of squared distances of samples to their closest cluster center. Lower is better.
Convergence: When centroids stop moving between iterations, the algorithm has converged.
• Customer Segmentation: Group customers by purchasing behavior
• Image Compression: Reduce color palette in images
• Document Classification: Organize documents by topics
• Anomaly Detection: Identify unusual patterns in data
• Recommendation Systems: Group users or items with similar characteristics
• Market Research: Identify distinct market segments
Use the Elbow Method: Plot inertia vs. K and look for the "elbow" point where adding more clusters doesn't significantly reduce inertia. You can experiment with different K values using the slider above!