FALCONN icon indicating copy to clipboard operation
FALCONN copied to clipboard

Is it possible to return distance using find_k_nearest_neighbors() function?

Open willard-yuan opened this issue 8 years ago • 5 comments
trafficstars

Hi @ludwigschmidt, I find the find_k_nearest_neighbors() function only returns the index of the search result, with no distance returned. Is it possible to return distance using find_k_nearest_neighbors() function?

Looking forward to your reply.

Thanks.

willard-yuan avatar Jan 04 '17 13:01 willard-yuan

Currently we don't return distances in find_k_nearest_neighbors (or any other method). We made that decision because it is not hard to compute the distances for a given set of point indices outside FALCONN. Since we do compute the distances internally, we would have that information. For a future version, it would be good to change the function interfaces so that they optionally also return distances.

ludwigschmidt avatar Jan 04 '17 14:01 ludwigschmidt

@ludwigschmidt Yeah, I have noticed the library compute the distances internally, and it will be great to return the distances in future version.

By the way, the current version does not support the dynamic data. So for a outer data point, it can't insert to the built index. nmslib and mrpt also face the problem. LSH is a data-dependent hashing method, does the problem can be solved by saving the hashing functions, so for a new (outer) data, it can be encoding by the hashing functions.

willard-yuan avatar Jan 04 '17 15:01 willard-yuan

The hash functions used in FALCONN at the moment are not data dependent. Adding a dynamic data structure is on the TODO list (see issue #2 ).

ludwigschmidt avatar Jan 04 '17 23:01 ludwigschmidt

@ludwigschmidt Hi, could you give the update about how's adding a dynamic data structure going on now?

JRCondeNast avatar Aug 29 '17 14:08 JRCondeNast

i also need a dynamic data structure, for examples, dataset could be appended. currently, LSHIndex had a function "setup", if dataset changed, need recall function "setup", it need lots of time

beimingmaster avatar Dec 23 '17 05:12 beimingmaster