Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

computation of L2_distances #15

Open
Bear-kai opened this issue Jun 27, 2018 · 1 comment
Open

computation of L2_distances #15

Bear-kai opened this issue Jun 27, 2018 · 1 comment

Comments

@Bear-kai
Copy link

Bear-kai commented Jun 27, 2018

I think the L2_distances in the function nearest_neighbour_correct should be computed as follows:
dis = pairs[0][i] - pairs[1][i]
dis = dis.reshape(dis.size)
L2_distances[i] = np.sqrt(dis.dot(dis))
instead of
L2_distances[i] = np.sum(np.sqrt(pairs[0][i]**2 - pairs[1][i]**2))

@jinwu07
Copy link

jinwu07 commented Jun 29, 2018

Or simply:
L2_distances[i] = np.linalg.norm((pairs[0][i]- pairs[1][i]).reshape(-1), ord=2)
The original code isn't quite right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants