Cosine similarity measures the angle between two vectors, ignoring their magnitude. Vectors pointing in the same direction score 1; the measure commonly ranges from 0 to 1 for nonnegative vectors. section 3.1.2
The calculation divides the dot product by both vector lengths. This makes cosine similarity useful when direction matters more than the amount of data represented by a vector. section 3.1.2
Recommendation systems apply cosine similarity in several retrieval pipelines:
- Represent users and items in a sparse user-item matrix, transpose it so items become vectors, and compute item-item similarity. section 2.2.2
- Use TF-IDF vectors built from titles and genres to retrieve content-similar items, including items without behavioral ratings. section 2.3.1
- Compare embedding vectors to support similarity search in high-dimensional spaces. section 3.1.2
Movie retrieval
Given a seed movie, compute its similarity row, exclude the seed itself, sort scores in descending order, and return the top k movie identifiers with similarity values.
Similarity quality depends on representation. Sparse metadata can make many items appear identical—for example, movies sharing only the Drama genre—while richer descriptions provide more meaningful distinctions. section 2.3.1
For normalized embedding vectors, cosine similarity and dot product produce the same ranking. Using the cheaper dot product avoids repeated normalization when comparing millions of items. section 3.1.2
























