The below code for calculating the Euclidean distance between two points returns [[9.]]
:
from scipy import spatial
d1 = [[11 , 3]]
d2 = [[2 , 3]]
print(spatial.distance.cdist(d1 , d2 , "euclidean"))
But the Euclidean distance between these two points is 3?
Has the Euclidean distance been implemented correctly?
The formula for Euclidean distance is the following: dist((x, y), (a, b)) = √((x - a)² + (y - b)²)
Which gives: = √((11 - 2)² + (3 - 3)²) = √(9)² = 9