Distance and Similarity

Once words have vectors, we still need to decide what makes two vectors similar. Their distance, direction, and length can give us different answers, depending on the comparison we choose.

14 sections · 15 questions · 4 coding challenges

1 / 14

How Could a Search Engine Compare Two Lists of Words?

BOTIE

A query and a document rarely contain exactly the same text. A search system therefore needs a graded comparison rather than an exact match. Once terms are represented as coordinates, the problem becomes deciding which geometric relationship reflects relevance.

Salton, Wong and Yang's 1975 vector-space work examined representations for automatic document indexing. Representing documents and requests in a common space made comparisons between them explicit numerical operations, helping establish the vector view used throughout information retrieval.

Distance measures separation between points. Cosine similarity compares direction, which can be useful when vector length reflects document size more than subject matter. A dot product retains sensitivity to length unless vectors are normalised. None of these comparisons creates meaning by itself; each interprets the representation we supplied. We therefore need to understand both the vectors and the comparison rule.

Sources for this history