-
Notifications
You must be signed in to change notification settings - Fork 650
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
is_kdtree_distance restrictions? #143
Comments
If both your vectors |
They're not, but I could pre-normalize vectors before sending them to FLANN, good idea. Still curious about adding cossim directly though. What would be the proper way to go about that, so that autotune&co work? |
The cosine similarity is not a kd-tree distance (dimension-wise additive On Tue, Nov 19, 2013 at 7:53 AM, Radim Řehůřek notifications@github.comwrote:
|
Thanks Marius! Maybe these two restrictions (dim-wise additive and non-decreasing) could appear in the docs? Or appear more prominently, in case I missed them :) What are the FLANN restrictions for a "vector-space distance"? |
It's basically a distance over a normed vector space ( On Tue, Nov 19, 2013 at 9:38 AM, Radim Řehůřek notifications@github.comwrote:
|
Ok, thanks. I'll go with @sromberg's suggestion then. |
In case anyone stumbles upon this issue later: The way to convert between what comes out of FLANN (squared euclidean distance on L2 normalized input) and cosine similarity is simply: |
@piskvorky thanks for point this out: cossim = 1 - flann_dist / 2 |
Sorry if I missed this in the docs: what properties must a FLANN distance function have, in order to work correctly with autotune & kdtree?
I'm thinking of adding the cosine distance,
1 - xy/|x||y|
(not a metric!), as another type of distance. Implementing the distance itself is fairly trivial, but I'm not sure how to make it play nicely with the rest of FLANN (index types etc).Is it a
is_vector_space_distance
, ais_kdtree_distance
?Cossim is a very popular measure, so I assume there some problem, since it's not in FLANN yet?
The text was updated successfully, but these errors were encountered: