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!
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!