Scipy euclidean and minkowski gave same result

Viewed 29

When i tried minkowski and euclidean distance from scipy, i got the same results,

from scipy.spatial import distance
dst1= distance.euclidean(input1, input2)
dst2= distance.minkowski(input1, input2)
print(dst1==dst2)

If i checked the code, the euclidean function is calling minkowski. Github link Why is this so?

1 Answers

The Minkowski distance has a parameter p. The Euclidean distance is a special case of Minkowski distance, with p = 2.

The default value of p for scipy.distance.minkowski is p = 2, so if you don't specify p, minkowski computes the Euclidean distance.

Related