Cosine Similarity and Euclidean Ranking

Derive the distance relationship for normalized vectors and identify when a nearest-neighbor ranking changes with the metric.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Unit norms make the ranking equivalent
  2. Normalization changes what is retained

Unit norms make the ranking equivalent

For unit vectors \(x,y\),

\[ \|x-y\|_2^2=2-2x^\top y. \]

Maximizing cosine similarity therefore gives the same ordering as minimizing Euclidean distance in that normalized space, with consistent tie handling. For unnormalized vectors the relation includes separate squared norms. A high-norm candidate can dominate raw dot product while pointing in a less similar direction.

Normalization changes what is retained

A zero vector has no cosine direction and requires a rule. If norms carry confidence or magnitude information, normalization may discard part of the intended signal. Document which metric defines the exact retrieval reference before measuring an index’s recall. Approximate nearest neighbors compare graph and compressed retrieval under a chosen metric. Kernel geometry defines another way for inner products to represent similarity.[1][2]

References

  1. Gareth James et al., An Introduction to Statistical Learning ↩
  2. Trevor Hastie, Robert Tibshirani and Jerome Friedman, The Elements of Statistical Learning ↩