Skip to content
AI.info

Kinds of learning

Clustering and Segmentation: Useful Groups Without Invented Essences

Learn the main clustering assumptions, how segmentation differs from discovery, and how to evaluate stability and practical usefulness.

By the end you can

Visual

Four lenses on what a cluster can mean

Clustering methods favor different geometric stories. The reason no single story fits every dataset is a theorem, not a matter of taste.

Three elementary requirements each look reasonable on their own. Scale-Invariance is the requirement that f(d) = f(α·d) for any α > 0: changing the units of measurement must not change the partition. The other two are Richness and Consistency. In 2002 Jon Kleinberg proved that no method can hold all three at once: “For each n ≥ 2, there is no clustering function f that satisfies Scale-Invariance, Richness, and Consistency.”

So the four lenses below are not four tastes. Each is a way of giving up one of three properties nobody can keep together.

FigureHierarchy · 4 levels
  • Centroid view

    A group is compact around a representative center.

    • Hierarchy view

      Groups form nested branches at several resolutions.

      • Density view

        Dense regions are separated by sparse space and may include noise.

        • Mixture view

          Observations arise probabilistically from overlapping components.

Example

A segmentation can be useful without being natural

A retailer groups purchasing histories to plan campaigns. Several defensible segmentations answer different questions, and the data do not choose between them.

  • Frequency segmentation separates frequent and occasional buyers.
  • Category segmentation emphasizes what people buy rather than how often.
  • Seasonality segmentation distinguishes holiday, weekly, and event-driven behavior.
  • Value segmentation focuses on revenue or margin, which may dominate every other feature.
  • Lifecycle segmentation uses recency and change over time instead of static totals.
  • Operational segmentation groups customers by the action the business can realistically take.

Distance begins with units

If one feature ranges from zero to one and another ranges into thousands, ordinary distance may be dominated by the larger numerical scale. Standardization changes the geometry and can change the clusters.

Which standardization is not a matter of habit. It has been measured, and the habitual answer lost. Milligan and Cooper compared eight standardization strategies in 1988, and the familiar z-score was not the winner: “approaches which standardize by division by the range of the variable gave consistently superior recovery of the underlying cluster structure”. An independent simulation study reproduced the result in 2020 — “Scaling with the range does fairly well, which is in line with the findings of Milligan and Cooper (1988)” — and reports that Steinley (2004) had reached the same conclusion for k-means.

Scaling is not a cosmetic preprocessing step. It expresses which differences should count as comparable, and domain-specific weighting may be more appropriate than automatic equalization.

Comparison

Which assumptions are you willing to make?

The method should reflect plausible group shape, noise, scale, and the intended interpretation. The parameters below are set by people, not read off the data.

Take the density column's dependence on density parameters literally. DBSCAN arrived in 1996 with one of its two knobs set by fiat: “Therefore, we eliminate the parameter MinPts by setting it to 4 for all databases (for 2-dimensional data).” Eps itself was left to the user, to be read by eye off a sorted 4-dist graph. Twenty-one years later four of the same authors, joined by Erich Schubert, revisited the method and recommended minPts = 2·dim instead. On the UCI Household data they report that “there is no clearly visible 'valley,' 'knee,' or 'elbow' in this plot”, and settle on ε somewhere between roughly 500 and 2,000. scikit-learn, meanwhile, ships eps=0.5 and min_samples=5, its documentation saying of eps: “This is the most important DBSCAN parameter to choose appropriately for your data set and distance function.”

Three numbers, one algorithm, none of them supplied by the data.

FigureComparison · 4 columns

Centroid-based

Efficient for roughly compact groups.

  • Requires a cluster count
  • Sensitive to scale and outliers
  • Produces a representative center
  • Struggles with irregular shapes

Hierarchical

Shows nested relationships through a tree.

  • Supports several resolutions
  • Cut level is a decision
  • Linkage changes the geometry
  • Useful for exploratory taxonomy

Density-based

Finds connected dense regions and labels noise.

  • Handles irregular shapes
  • Depends on density parameters
  • Can struggle with varying density
  • Useful when outliers matter

Probabilistic mixture

Assigns soft membership under a distributional model.

  • Represents overlap
  • Relies on component assumptions
  • Provides membership probabilities
  • Useful for uncertain boundaries

Key idea

An elbow is evidence, not an oracle

Curves such as within-cluster variation may bend gradually rather than reveal one obvious cluster count. The published procedures for locating the bend fail together rather than disagreeing usefully.

Eight of those procedures were run on a uniform-noise dataset whose true number of clusters is 1: Jump, L-Method, iterative L-Method, Kneedle, curvature, pyclustering, Shi angles and AutoElbow. With the candidate range capped at k ≤ 10, all eight returned k = 4. Erich Schubert, who ran them in 2022, put it flatly: “For the data set with many clusters as well as the uniform data set, all the elbow-based methods failed.” He also notes that scaling the whole dataset by a factor α changes SSE by α², which moves the “optimum” most geometric elbow methods report. So the bend is not even invariant to the units — exactly as Kleinberg's Scale-Invariance would demand.

None of this is new. Milligan and Cooper compared 30 stopping rules by Monte Carlo in 1985 and found them to differ widely in accuracy, even on data containing 2–5 distinct non-overlapping clusters.

Compare several counts and inspect whether the resulting groups remain interpretable, stable, and actionable. The right answer may be a hierarchy, or no segmentation at all.

Choosing a cluster count is a modeling decision, not a hidden integer waiting to be uncovered.

Case

Consensus clustering finds stable clusters in data that has none

Consensus clustering was built to tell you whether your clusters are real. Resample the data repeatedly, cluster each resample, and count how often two samples land together. Four researchers at the Broad Institute/MIT introduced it in 2003, explicitly as a way “to assess the stability of the discovered clusters” and to “inspect cluster number, membership, and boundaries”.

Eleven years later, in 2014, three researchers ran that same procedure on data they had generated with no clusters in it. Their finding: “CC is able to divide randomly generated unimodal data into apparently stable clusters for a range of K, essentially reporting chance partitions of cluster-less data.” They proposed the proportion of ambiguously clustered pairs — the fraction of sample pairs whose consensus index sits in the ambiguous middle — as a stability measure that does not fail this way.

A stability plot is a claim to be tested against a null, not a certificate.

Steps

Review clusters before assigning names

Naming creates confidence. Evidence should come first — and step 5, the one most often skipped, is something you can actually measure.

Four sepsis phenotypes were derived by consensus k-means from 20,189 patients: α, n=6625 (33%); β, n=5512 (27%); γ, n=5385 (27%); δ, n=2667 (13%). They were validated in 43,086 more patients, with 28-day mortality of 5%, 13%, 24% and 40% respectively. Seymour and colleagues published that in JAMA in 2019. Then, instead of arguing about what the four groups are, they tested what the groups do: “In simulation models, the proportion of RCTs reporting benefit, harm, or no effect changed considerably (eg, varying the phenotype frequencies within an RCT of early goal-directed therapy changed the results from >33% chance of benefit to >60% chance of harm).”

Same treatment, same trial design, a different mix of clusters enrolled, and the verdict inverts. That is what validating the use looks like when it is done.

FigureProcess · 6 steps
  1. 1. Inspect feature contribution

    Check which variables and scales drive separation.

  2. 2. Examine members

    Read typical, boundary, and noise examples from every group.

  3. 3. Test stability

    Resample data and vary reasonable preprocessing and parameters.

  4. 4. Compare alternatives

    Use different methods and resolutions rather than one favored output.

  5. 5. Validate the use

    Measure whether groups improve analysis, intervention, or communication.

  6. 6. Name cautiously

    Choose descriptive labels and preserve overlap and uncertainty.

Analogy

Organizing a library

A library can be reorganized in several defensible ways. Shelves can follow author, genre, language, era, readership, or current demand, and each organization makes some tasks easier.

Clustering resembles this purposeful grouping. A data point is not a book. It can hold soft membership, carry noisy measurements, and change behavior from one month to the next, while the book stays on its one shelf.

A grouping is judged by what it helps people understand or do.

Case

Six subtypings of one cancer, negotiated down to four

Colorectal cancer had six shelving schemes before it had one. Six research groups had each published their own gene-expression subtyping of the disease, on overlapping data and with non-overlapping names. An international consortium pooled the underlying samples to reconcile them.

The settlement was four consensus molecular subtypes: CMS1 at 14% of samples, CMS2 at 37%, CMS3 at 13% and CMS4 at 23%. Guinney and colleagues published it in Nature Medicine in 2015. The arithmetic leaves 13% with mixed features, which the authors read as “a transition phenotype or intratumoral heterogeneity” rather than as a fifth shelf.

Six defensible partitions of the same tumours, one negotiated settlement, and a residue that fits nowhere. That is what a real segmentation looks like from the inside.

Figure

A negotiated taxonomy, drawn sample by sample — including the samples it could not place.

Segmentation may be designed rather than discovered

Organizations sometimes need groups for staffing, pricing, or communication. In that case, operational constraints can define a useful segmentation even when the data contain no natural clusters.

The clearest designed partitions carry a date. On 28 March 2024 the US Office of Management and Budget revised Statistical Policy Directive No. 15, which fixes the minimum race and ethnicity categories for federal reporting. It was the first revision since 1997. Five categories plus a separate ethnicity question became seven, collected in one combined question: “American Indian or Alaska Native, Asian, Black or African American, Hispanic or Latino, Middle Eastern or North African, Native Hawaiian or Pacific Islander, and White.” The revision adds “Middle Eastern or North African” as a category distinct from White. The US Department of Education describes the change to its own collections as “Shifting from the two-part race/ethnicity question to use a single combined race and ethnicity question that allows multiple responses”, to be complied with “no later than March 28, 2029”.

Nobody ran a clustering algorithm on the population and discovered a seventh group. A named body decided, on a stated day, where the lines go. Every federal collection has until 28 March 2029 to redraw them.

State whether the project is discovering structure or constructing a manageable partition. Confusing those aims can make arbitrary business bins appear scientifically inevitable.

Case

Enterotypes: three gut clusters in 2011, continuous gradients in 2014

The gut microbiome had this argument in public. Newly sequenced faecal metagenomes from individuals in four countries were combined with published datasets, and three robust clusters came out. Arumugam and colleagues named them enterotypes in Nature in 2011, and concluded that intestinal microbiota variation is “generally stratified, not continuous”.

Three years later the same kind of data was read the other way. Dan Knights, Rob Knight and colleagues found in 2014 that “most human gut microbiome data collected to date support continuous gradients of dominant taxa rather than discrete enterotypes”, noting that one person's microbiome could traverse several of the putative clusters within a single year.

The bacteria did not change between 2011 and 2014. The decision about whether to draw lines did.

Key takeaways