LSHash icon indicating copy to clipboard operation
LSHash copied to clipboard

Any know how to change or add distance function?

Open hsingchenlee opened this issue 5 years ago • 0 comments

lshash.py line 298 like that:
@staticmethod def euclidean_dist(x, y): """ This is a hot function, hence some optimizations are made. """ diff = np.array(x)-y return np.sqrt(np.dot(diff, diff))

I change the diff like that:
diff = np.array(x)-y change to np.array(x)-(mean(x)-mean(y))-y

But when I print(lsh.query([3,4,5,3,4,5,3,4],distance_func="euclidean")) Compare to the origin euclidean_dist , the result is same . It seems that it's not a correct method to change distance function. Anyone could tell me how to change distance function? Thanks a lot!

hsingchenlee avatar May 10 '20 06:05 hsingchenlee