Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

true_angular is not a distance? #232

Open
jlmelville opened this issue Nov 12, 2023 · 0 comments
Open

true_angular is not a distance? #232

jlmelville opened this issue Nov 12, 2023 · 0 comments

Comments

@jlmelville
Copy link
Collaborator

jlmelville commented Nov 12, 2023

This may be based on my lack of understanding as covered in #231 but it seems like the true_angular function returns a similarity and not a distance, i.e.:

from sklearn.datasets import load_iris

iris = np.float32(load_iris().data)

import pynndescent.distances as dist

dist.cosine(iris[0], iris[0]), dist.cosine(iris[0], iris[1])
(0.0, 0.0014208250387670596)

dist.true_angular(iris[0], iris[0]), dist.true_angular(iris[0], iris[1])
(1.0, 0.9830298038991578)

Edited to add that alternative_cosine is a distance, which is what is actually used for finding nearest neighbors when metric = "true_angular", although it gets transformed back into a similarity via true_angular_from_alt_cosine at the end).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant