1
$\begingroup$

I have n 3-dimensional vectors. Is there a way to find distance between all using euclidean distance?

$\endgroup$
3
$\begingroup$

You can use sklearn's euclidean_distances function.

http://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.euclidean_distances.html#sklearn.metrics.pairwise.euclidean_distances

In [1]: from sklearn.metrics.pairwise import euclidean_distances

In [2]: import numpy as np

In [3]: x = np.random.rand(10, 3)

In [4]: euclidean_distances(x)
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.