Answers · How models work
How can I tell whether my clusters are real or just something the algorithm made up?
In shortCheck whether clusters survive refitting on different rows and whether they predict a held-out column; a convincing 2D plot is weak evidence because such plots can invent clusters.
Check whether the clusters survive being refitted on different rows, and whether they predict a column you deliberately kept out. Those are the only two tests that give honest evidence when there is no true labelling to compare against. A convincing two-dimensional plot is the weakest evidence available, because the methods that draw such plots can produce separated islands from data that contains no groups at all.
Surviving a refit
Take nine tenths of the rows at random, run the whole clustering method, and record which pairs of rows end up in the same group. Do this again with a different nine tenths. For every pair of rows that appears in both samples, ask whether the two runs agreed: either both put the pair together or both put them apart. The share of pairs that agree is . Raw agreement is misleading because two unrelated groupings already agree about half the pairs when there are two equal groups. Correct for chance using the formula below, where is the agreement expected by chance given the number and sizes of groups in each run.
With two groups of 50 rows each from 100 rows, the probability that two distinct rows fall in the same group is , since there are within-group pairs out of total pairs. If two independent runs both use two equal groups, the chance agreement is . A raw agreement of 0.5 then gives a corrected agreement of , which is no agreement at all. Always use the corrected figure. A value near one means the two runs are essentially identical; a value near zero means they are unrelated.
| Data | Groups asked | Average corrected agreement | Verdict |
|---|---|---|---|
| Four separated blobs | 4 | 0.94 | real |
| Four separated blobs | 7 | 0.52 | too many groups asked for |
| Two overlapping blobs | 2 | 0.71 | real but the boundary is arbitrary |
| Points spread evenly, no groups | 4 | 0.11 | imposed |
| One long band of points | 3 | 0.08 | imposed |
The last two rows are the ones that matter. Both produced four tidy regions and a confident chart, yet their agreement sits barely above chance because nothing in the data determined where the boundaries went; each refit put them somewhere else. The second row shows the same test diagnosing too many groups: the four real groups are stable, but the three extra splits land differently every time. A very unstable result is more informative than a stable one, because it is a definite finding that the question was wrong. A stable result can still be meaningless: if the data contains two obvious groups and somebody asks for two, the answer is stable whether or not two is the interesting division.
The picture that convinces everybody
The natural guess is to judge the grouping by how convincing it looks on a two-dimensional plot. This fails because the neighbourhood preserving methods used to draw such plots are built to pull near points together and push far points apart, which produces separated islands on data with no group structure whatsoever. Run one on points scattered uniformly in a cube and it will return a picture of distinct islands, every time. Three things in that picture are artefacts rather than findings: the sizes of the islands, which depend on the settings and not on how many points are in each; the gaps between them, which carry no information about how different the groups are; and the positions, since two islands side by side are no more related than two across the page.
Predicting something kept out
The stronger test uses information the method never had. Choose a column that is known for each row and deliberately exclude it from the clustering. Run everything. Then ask whether the resulting groups differ on that column. A grouping built from purchase history alone, whose groups turn out to have cancellation rates of three, eleven and thirty-one per cent, has found something real about the customers. The spread is percentage points. No internal measure can produce that conclusion and no amount of chart polishing can fake it.
| Grouping | Groups found | Held-out column | Spread across groups (percentage points) | Useful? |
|---|---|---|---|---|
| Customers grouped on purchases | 3 | cancellation rate within six months | 28 | yes |
| Customers grouped on demographics | 5 | cancellation rate within six months | 3 | no |
| Sensors grouped on readings | 4 | needed repair within a year | 41 | yes |
The second row is the honest negative result: five stable groups, cleanly separated, that predict nothing anybody cares about. The grouping is real and useless. That distinction is invisible to every measure in the earlier lessons. The held-out column is the only test that uses information the method could not see, so it cannot be gamed by the method.
Compared against nothing
The scrambling comparison applies to every number produced. Scramble each column independently among the rows, so every column keeps its exact distribution but all relationships between columns are destroyed. Compute whatever number you were going to report on the real data and on twenty scrambled copies, and report both. For a grouping, compare the within-group spread or the corrected agreement under resampling; for a reduction, compare the share of variation carried by the first few directions; for a flagging score, compare the share of known cases appearing in the top flags. This costs twenty extra runs of something that takes seconds, and it converts every number from a description of what the method did into a statement about whether there was anything there. For a grouping, you look for a clear gap at the right number of groups and none elsewhere.
The picture illustrates a claim and never supports one. The legitimate sequence is to establish the result with the two tests above and then draw the picture so that people can see what was established. Drawing it first and reasoning from it is how a great deal of published work came to describe groups that were not there.
Worth keeping
- A clustering that survives refitting on different rows and predicts a held-out column is real; one that only looks tidy on a two-dimensional plot is not.
- Corrected agreement near one means the groups are determined by the data; near zero means the method imposed them.
Where this goes next
This question is one step of Finding Structure Without Labels, a course that works through its subject from the beginning. The page that teaches this part of it is Judging a Result With No Truth to Check, and it reads the whole way through whether or not you have an account.
What an account changes is the practice: problems standing under every idea, marked with a reason rather than a tick, in a copy of the course that is yours.
Read that pageThe whole courseOther questions people ask about this
- How many principal components should I keep?There is no single correct number: keep the smallest number whose combined variation you can afford to lose, and report the share you discarded.
- Why does k-means split one long stretched-out group into two?Because k-means keeps only one centre per group, so a long group's ends end up closer to a second centre and the group is cut across its length.
- How does DBSCAN decide that some points are noise and just leave them out?A point is left out when too few neighbours lie close to it and no dense point is close enough to attach it to a group.
- Why can't I just measure accuracy on data that has no labels?There is no accuracy to measure, because accuracy compares predictions with true answers and unlabelled data has none.
- Why does the model get stuck repeating the same sentence over and over?The model is not stuck in a memory loop: once it has written a phrase, that phrase is in its context and makes writing it again more likely, so a decoder that always picks the top word cannot leave.
- Why does diffusion add Gaussian noise instead of any random corruption?Diffusion adds Gaussian noise because Gaussian errors combine exactly: each step keeps the spread fixed and gives a closed-form noisy picture at any later step, which makes the reverse step learnable.