1
$\begingroup$

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

$\endgroup$

1 Answer 1

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)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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