i have euclidean distance code but its running very slow since the data is big. can i get faster with python multiprocessing ?
this is my code
def euclidean_distance(self,x1, x2):
distance = 0.0
for i in range(len(x1)):
distance += pow( x1[i] - x2[i], 2)
return math.sqrt(distance)
how to use multipocessing pool ? can i go with pool.map for this function ?
#multiprocessing
pool = multiprocessing.pool(processes=2)
dist = pool.map(self.euclidean_distance(test.vector,point.vector),range(len(x1))
it doesnt work since range(len(x1) is outside def. any help appreciated for quicken that function, thanks