Whether it is a supervised or unsupervised algorithm, distance metrics play an important role in Machine Learning. Different distance measures are to be chosen depending on the types of data. So it is important that we understand these metrics and how to implement/calculate them. In this article, we will go through 5 of the most commonly used distance metrics.
Euclidean distance is the straight line distance between two data points in Euclidean space. It is also called as L2 norm or L2 distance.
Source: Wikipedia
If p=(p1, p2) and q=(q1, q2) are two points in the Euclidean space, the Euclidean distance is given by -
If p=(p1, p2, p3), q=(q1, q2, q3) are two points in Euclidean space, the Euclidean distance is given by -
If p=(p1, p2…pn) and q=(q1, q2…qn) are two points in Euclidean space, the Euclidean distance is given by -
As you might have guessed by now, this formula looks a lot similar to the Pythagoras theorem formula. So, this is also called the Pythagoras Theorem.
#machine-learning #data-science #metrics