K-Nearest Neighbor (KNN) Algorithm
K-Nearest Neighbor (KNN) Algorithm
Algorithm
KNN Algorithm
Euclidean Distance –
1. We mostly use this distance measurement
technique to find the distance between
consecutive points. It is generally used to
find the distance between two real-valued
vectors.
2. Euclidean distance is used when we have to
calculate the distance of real values like
integer, float, etc…
3. Formula -
KNN Algorithm
Manhattan Distance –
1. Manhattan Distance is the sum of absolute
differences between points across all the
dimensions.
2. We use Manhattan Distance if we need to
calculate the distance between two data
points in a grid-like path.
3. Formula –
KNN Algorithm
Minkowski Distance –
1. Minkowski Distance is the generalized form
of Euclidean and Manhattan Distance.
2. We can calculate Minkowski distance only in
a normed vector space, which is a fancy way
of saying: “in a space where distances can be
represented as a vector that has a length.”
3. Formula -
KNN Algorithm
Hamming Distance –
1. Hamming Distance measures the similarity
between two strings of the same length.
2. The Hamming Distance between two strings of
the same length is the number of positions at
which the corresponding characters are different.
3. Formula -
KNN Algorithm