Current location - Recipe Complete Network - Complete recipe book - How to calculate Euclidean distance?
How to calculate Euclidean distance?
Background: When understanding the principle of machine learning algorithm, the Euclidean distance mentioned in KNN classification algorithm.

Explanation: Euclidean distance is also called Euclidean metric. Used to define the distance of multidimensional space.

Understand:

1. Firstly, the coordinates of two points X and Y in n-dimensional space are defined as () and () respectively.

For example, in one dimension, and

In two-dimensional space, sum

etc ...

In the n dimension, sum.

2. Calculate the Euclidean distance between two points.

In two-dimensional space, the distance between two points is:

?

In the n dimension, the distance between two points is:

?