Skip to content

ML Models & Algorithms

Centroid-based Clustering

In shortA clustering family that groups data around central points (centroids), each the average of its cluster's members. K-means is the best-known example.

Updated 24 Oct 2026· 2 min read

Centroid-based clustering groups data points around a set of central points called centroids. Each centroid is the arithmetic mean of the points in its cluster, and every point belongs to the cluster whose centroid is nearest. K-means is the flagship algorithm, and it is usually the first clustering method marketers learn because it is fast and easy to explain.

How it works

  1. Choose the number of clusters, k.
  2. Place k starting centroids (k-means++ spreads them out to give a better start).
  3. Assign every point to its nearest centroid.
  4. Move each centroid to the mean of the points assigned to it.
  5. Repeat steps 3 and 4 until the assignments stop changing.

The result is a set of flat, non-overlapping groups, so it is a form of hard clustering with no hierarchy. Google’s clustering guide describes the family as efficient but sensitive to initial conditions and outliers, which is why libraries run the algorithm several times from different starting points and keep the best result.

How it’s used in SEO and marketing

  • Customer segmentation. MLforSEO’s segmentation practical runs K-means on recency, frequency and monetary (RFM) values to produce segments such as “Champions” and “At Risk”.
  • Image organisation. K-means on pixel colours finds each image’s dominant colours, and a second round clusters images with similar palettes.
  • Keyword grouping. Turn keywords into embeddings and partition them into a fixed number of groups.
  • Competitor mapping. Cluster competitor domains by traffic, links and keywords to see who is really in your space.

Example

You export customers with days since last order, number of orders and total spend. After scaling the three columns so spend does not dominate, you run K-means with k = 4. One centroid sits at recent, frequent, high spend (your champions), another at long ago, one order, low spend (lapsed one-off buyers). Each centroid’s values become the plain-language description of the segment.

Limitations and things to watch

  • You must pick k in advance. Use the elbow method or silhouette scores, then sanity-check the segments with the business.
  • It assumes roughly round, similarly sized clusters, so long or irregular shapes get split badly.
  • Outliers pull centroids away from where most points sit.
  • Every point is forced into a cluster. If your data has noise, a density-based method such as DBSCAN can label it as noise instead.
  • Features must be on comparable scales, and the algorithm never names the clusters for you.

Learn it on MLforSEO

Sources and further reading

Other terms from ML Models & Algorithms

See all 55 ML Models & Algorithms terms →