AI Dictionary › AI Fundamentals
K-means is the most widespread and widely taught clustering algorithm: it splits a set of points into a predefined number k of groups, each represented by its own center, called a centroid, trying to minimize the distance between each point and the centroid of the group it belongs to. The number k must be chosen in advance by whoever uses the algorithm, and it is often the trickiest parameter in the whole procedure.
The algorithm proceeds through iterations: k initial centroids are chosen, usually at random, then every point is assigned to the nearest centroid, the centroids are recomputed as the average of their assigned points, and the cycle repeats until the centroids stop moving meaningfully. The result depends on the initial centroids, so in practice multiple runs with different starting points are tried and the best one is kept. Choosing the most suitable number of clusters is often left to heuristics such as the elbow method, which observes how overall error decreases as k increases.
It is used to segment customers by similar behavior, compress images by reducing the number of distinct colors, identify homogeneous zones in geographic data, and as a preliminary step in more complex pipelines, for example to build a visual vocabulary in computer vision. Its speed and simplicity often make it the first choice before trying more sophisticated clustering algorithms.
The name literally describes what it does: k is the number of groups to find, means are the averages used to compute the centroids. The underlying ideas trace back to the 1950s, with independent work in statistics and signal processing; the iterative algorithm known today as k-means is generally credited to Stuart Lloyd, who described it in a 1957 Bell Labs technical report published only in 1982, and to James MacQueen, who coined the name k-means in a 1967 paper.
From our network
Magellano GPS: Fleet Tracking Made Simple
Real-time GPS tracking, remote engine lock, fuel and CO₂ reporting for your fleet.
Visit magellanogps.com →From the Agora Intelligence blog
📱 Download the Android app (beta) iOS coming soon
Say what you mean. Get what you need.
Grace Certified, the AI coach that trains and certifies your prompt engineering, by Agora Intelligence.