Distance measurement is the bottom of supervised and unsupervised algorism. It impacts the results of machine studying. Thus, it is very important select the precise distance algorism. On this article, I’m going to introduce the frequent measurements, how they work and calculation in Python.
- Euclidean distance
In arithmetic, the Euclidean distance between two factors in Euclidean area is the size of a line section between the 2 factors. It’s the mostly used algorism as a result of it’s easy and intuitive. Most conditions can apply Euclidean distance. The method is:
Python code:
from scipy.spatial import distance
distance.euclidean(vector_1, vector_2)
There are 2 disadvantages of Euclidean distance: it cannot be utilized to the information which is greater than 3 dimensions; the information must be standardized earlier than making use of Euclidean distance.
2. Manhattan distance