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.
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
- Choose the number of clusters, k.
- Place k starting centroids (k-means++ spreads them out to give a better start).
- Assign every point to its nearest centroid.
- Move each centroid to the mean of the points assigned to it.
- 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
- BERT (Bidirectional Encoder Representations from Transformers)Google's 2018 transformer language model that reads text in both directions to produce context-aware embedding…
- BERTopicA modular topic modelling technique that clusters transformer embeddings and labels each cluster with class-ba…
- BIRCH (Balanced Iterative Reducing and Clustering using Hierarchies)BIRCH (Balanced Iterative Reducing and Clustering using Hierarchies) clusters very large numeric datasets by s…
- BM25A classic ranking function that scores documents by how often query words appear, adjusted for word rarity and…
- Boyer-MooreA fast exact string-search algorithm that compares a pattern from right to left and skips ahead after mismatch…
- c-TF-IDFClass-based TF-IDF: treats each cluster as one document to find the words that best describe it, used by BERTo…
- Convolutional Neural Network (CNN)A deep learning architecture that scans data with small learned filters to detect local patterns; the classic…
- DBSCANDensity-based clustering that groups closely packed points, finds the number of clusters itself and labels iso…
- Decision TreeA supervised model that predicts by asking a series of yes/no questions about the data, branching like a flowc…