Hacker News new | ask | show | jobs
by paulfharrison 619 days ago
The article mentions equivalent ranking from cosine similarity and Euclidean distance. The derivation is very simple. For vectors A and B, the squared Euclidean distance is:

(A-B).(A-B) = A.A-2A.B+B.B

A and B only interact through a dot product, just like cosine similarity. If A and B are normalized, A.A=B.B=1.

For Pearson Correlation, we would just need to center and scale A and B as a pre-processing step.