top | item 41471809

(no title)

SomewhatLikely | 1 year ago

Something worth mentioning is that if your vectors all have the same length then cosine similarity and Euclidean distance will order most (all?) neighbors in the same order. Think of your query vector as a point on a unit sphere. The Euclidean distance to a neighbor will be a chord from the query point to the neighbor. Just as with the angle between the query-to-origin and the neighbor-to-origin vectors, the farther you move the neighbor from the query point on the surface of the sphere, the longer the chord between those points gets too.

EDIT: Here's a better treatment, and it is the case that they give the exact same orderings: https://ajayp.app/posts/2020/05/relationship-between-cosine-...

discuss

order

dontreact|1 year ago

Cosine similarity is equal to the dot product of each vector normalized