Ask for eight groups and you get eight, whether or not there are eight.
No labels, no answers, nothing to score. 1,851 real word vectors and one number, and it comes back with groups: some of them obviously colours and animals, some of them a shrug. Five rounds, and you say which word the algorithm put where.
- Score
- 0
- Right
- 0
- Streak
- ×0
- Group
- 1/5
Nobody labelled these. Pick the word the algorithm put in with the six.Nobody labelled these groups. An algorithm sorted the words by the company they keep in real text, and these six came out together. Pick the word it put in with them.
Six words the algorithm put together
Which of these joined them?
Right. It put rabbit in group 6, alongside red, yellow, cat.
That group has 121 words in it, and nobody named it. It exists because those vectors sat nearer to each other than to anything else.
Every word in the vocabulary, drawn at its own coordinates. There are no labels in this chapter at all. Nobody has told the algorithm what a single one of these words means, and there is no right answer for it to be measured against.
Loading the groups…
With no labels, there is nothing to be right about.
NextMore data, or a better model?+What is actually going onHow does it decide, with nothing to learn from?It alternates two easy steps: put everything with its nearest centre, then move each centre to the middle of what it got.
That is the whole algorithm, and it has not changed since MacQueen described it in 1967. Each pass can only make the total distance smaller, so it always stops eventually, and where it stops depends entirely on where the centres started.
Which is why the starting positions are chosen carefully here rather than at random. Arthur and Vassilvitskii’s method spreads the first centres out, and without it the same data can produce quite different groups on different runs, which is a fact about the algorithm rather than about your customers.
Note what is never involved: any notion of correct. Nothing in this procedure has an opinion about whether the groups it found mean anything.
Take it apart yourself: EmbeddingsMagnet · 9 min. Optional.
+What is actually going onWhy do the colours look interleaved in the picture?Because the grouping happened in fifty dimensions and the picture has two. It is a shadow.
Every distance the algorithm used was computed across all fifty numbers of each word vector. The two coordinates each dot is drawn at are a projection, chosen to make an intelligible picture, and things far apart in fifty dimensions can land on top of each other in two.
So a dot of one colour sitting inside a patch of another is usually not a mistake by the algorithm. It is the flattening. The embeddings module makes the same point about the arrow that does not quite land on the word.
This matters beyond pictures. Distances behave strangely as dimensions pile up, and the everyday intuition that near means similar gets weaker the more features you add.
Take it apart yourself: EmbeddingsMagnet · 9 min. Optional.
+Go and try this for realName the groups before you look at the count
Go and try this
Name the groups before you look at the count
If anybody near you has clustered customers, documents or events, ask to see the members of each group rather than the summary, and try to name each one out loud.
Then ask what number they asked for, and what happened when they asked for a different one.
What to watch for: Whether you can describe a group without using the word cluster. If the best description is these are the ones in group four, the group is an artefact of the number you chose.
+Check yourselfIt marks itself, and nothing is sent anywhere.
You cluster your customers into five groups and the fit improves when you ask for six. What follows?
Which of these can clustering actually tell you?
Tap an item, then tap where it belongs. Dragging works too.
Sources
- GloVe: Global Vectors for Word Representation
Pennington, Socher & Manning (EMNLP 2014)
The 1,851 word vectors every dot and group on this page is computed from, trained on Wikipedia and newswire.
Public Domain Dedication and Licence v1.0
- Some methods for classification and analysis of multivariate observations
J. MacQueen (Berkeley Symposium on Mathematical Statistics and Probability, 1967)
The algorithm this page runs, and the name k-means, from the paper that introduced it.
- k-means++: The Advantages of Careful Seeding
Arthur & Vassilvitskii (SODA 2007)
How the starting centres are chosen here, and why choosing them at random gives wildly different answers between runs.