3 ms·
>you will get the same results using a simple matmul, because euclidean distance over normalized vectors is a linear transform of the cosine distance. Squared
by meindnoch 9mo ago
>you will get the same results using a simple matmul, because euclidean distance over normalized vectors is a linear transform of the cosine distance.
Squared euclidean distance of normalized vectors is an affine transform of their cosine similarity (the cosine of the angle between them).
EuclideanDistance(x, y) = sqrt(dot(x - y, x - y)) = sqrt(dot(x, x) - 2dot(x, y) + dot(y, y)) = sqrt(2 - 2dot(x, y))
- stephantul 9mo agoyes, you are right. I realized my mistake afterwards but it was after the edit window.