I have a problem for finding a distance of 3D float array with very large matrix of size 1M x 3. The distance has to be computed 10 times per second. Therefore, I need to implement LSH or related technique. For given query q of size 1 x 3 or 3 x 1, I have to find the nearest neighbor index in matrix D of size 1M x 3. I just need the index from for given query .
I implemented lshash to find the nearest neighbor (NN) very fast. However, I am not able to find the index since lshash return distance and the respective vector.
Here is my code.
from lshash import LSHash
lsh = LSHash(16,3)
for a in D:
lsh.index(a)
To search the NN of , here is the simple way
a = lsh.query(q,distance_func='euclidean') %% or
a = lsh.query(q,num_results=1,distance_func='euclidean')
But I want the index from which is nearest to .
any suggestions..
