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”.

Microsoft ML .NET
Microsoft ML .NET

Microsoft ML .NET

Generic

ML .NET is the new framework which is developed by the Microsoft and releas...

Microsoft ML .NET

ML .NET is the new framework which is developed by the Microsoft and released May 6th,2019 for the .Net ecosystem. It allows developers to create custom ML models using C# or F# without having to leave the .NET ecosystem. It is an open source and cross-platform machine learning framework which is designed as an extensible platform to consume other popular ML frameworks like Tensor-Flow, ONNX, Infer.NET, and more).