Cosine distance has a call to sqrt
Closed this issue · 2 comments
danr commented
PaCMAP/source/pacmap/pacmap.py
Lines 53 to 63 in 8e22b7c
Cosine distance as defined does not have a square root call. I think the np.sqrt
should be removed here.
hyhuang00 commented
Hi Dan! Thank you for your interest in PaCMAP!
Here, we chose to follow the definition of angular distance provided in annoy
for consistency. The angular distance is defined as the Euclidean distance of the two normalized vector u, v
.
euclidean(u, v) = sqrt(u^2 + v^2 - 2uv) = sqrt(2-2uv) = sqrt(2-2 cos theta)
Let me know if you have further questions!
danr commented
Thanks, then it makes sense!