Vectors, Distance and Similarity
Which Question Are You Actually Asking
Last timeFinding the Nearest Ones
Distance, dot product and angle disagree about which pairs are close. The choice follows from one question about your data and one about how the vectors were produced.
Three measures, all reasonable, all disagreeing about which pairs are close. This
lesson is the decision procedure, and it is shorter than the arguments people
usually have about it.
The first question
Does length mean anything in your collection?
Length usually means something mechanical rather than meaningful. A longer
document, more occurrences counted, more tokens in the passage. Those are
nuisances and the cosine removes them. But it is not universal: in some models
the length of a vector tracks how strongly the model detected something, and
dividing that out means a tentative match and an emphatic one score the same.
The lesson stops here
6 more paragraphs to go
You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.
The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.
See the planThe contentsThis is the reading half
Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.
The contents