Overview:
-
The Euclidean distance between two points in n-dimensional space is given by the formula, Distance = sqrt(sum(xi-yi)2), where i varies between 1 to n.
-
The SciPy function euclidean() from the module scipy.spatial.distance accepts two points in n-dimensional space as one-dimensional arrays and returns the Euclidean distance between them.
Example:
The SciPy example assumes the height of a person as X axis and weight of the person as Y axis finding the Euclidean distance between two points. Such calculations that abstract features of persons or entities as two dimensional points and finding distances are common in algorithms like clustering.
# Example Python program that finds the Euclidean # Height and weight of two persons # Find the Euclidean distance between the points |
Overview:
Euclidean distance: 7.0710678118654755 |