Distance Formulas

 
In the Machine Learning literature very often we can see the terms of distance computing. Some of the machine learning algorithms built upon this formulas such KNN, clustering etc.
Here we are going to briefly see several types of the distance formulas which used by the machine learning algorithms.
 

Euclidean Distance


 

According to Wikipedia;

In mathematics, the Euclidean distance or Euclidean metric is the "ordinary" straight-line distance between two points in Euclidean space. With this distance, Euclidean space becomes a metric space. The associated norm is called the Euclidean norm. Older literature refers to the metric as a Pythagorean metric. A generalized term for the Euclidean norm is the L2 norm or L2 distance.
Briefly, Euclidean distance is the straight line distance between two points which are in the Euclidean Space.
Distances between two points according to Euclidean Distance Formula is;



 

Manhattan Distance



The Manhattan distance formula computes the distance between the points by assuming that grid-like path as the distance between the points.
Distance between two points according to Manhattan Distance Formula is;



 

Cosine Distance

Cosine distance formulate computes angular cosine distance between the points.
Distance between two points according to Cosine Distance Formula is;
 






Thanks for reading.

 

Recommended Articles

Check out some recommended articles based on the article which you read

Matrix
Matrix

Matrix

Math

Matrix is one of the mathematical models which is very useful while working...

Matrix

Matrix is one of the mathematical models which is very useful while working on data set which we feed machine learning algorithms. Simply, we can call matrix as an array of object in machine learning case (from the mathematical side we can call it as an array of numbers).

Machine Learning
Machine Learning

Machine Learning

Generic

Machine Learning is a type of artificial intelligence that allows software ...

Machine Learning

Machine Learning is a type of artificial intelligence that allows software to become able to make prediction of output by using various algorithm via learning from the input training data. To sum up, machine learning is the way to make software find out patterns for the solution by using the trained input data. The algorithm which we use to make software smarter are called “Machine Learning Algorithms”.

K-Nearest Neighbor
K-Nearest Neighbor

K-Nearest Neighbor

Classification

K-Nearest Neighbor is the one of the well-known and easy machine algorithm ...

K-Nearest Neighbor

K-Nearest Neighbor is the one of the well-known and easy machine algorithm which is very suitable for a lot of real world problems such product recommendation, social media friend recommendation based on interest or social network of person.