0% found this document useful (0 votes)
22 views9 pages

K-Nearest Neighbor (KNN) Algorithm

KNN

Uploaded by

Bhakti Vankhde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views9 pages

K-Nearest Neighbor (KNN) Algorithm

KNN

Uploaded by

Bhakti Vankhde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

K-Nearest Neighbor(KNN)

Algorithm
KNN Algorithm

1. K-Nearest Neighbour is one of the simplest


Machine Learning algorithms based on
Supervised Learning technique.
2. K-NN algorithm assumes the similarity between
the new case/data and available cases and put
the new case into the category that is most
similar to the available categories.
3. K-NN is a non-parametric algorithm, which
means it does not make any assumption on
data.
4. It is also called a lazy learner algorithm because
it does not learn from the training set
immediately instead it stores the dataset and at
the time of classification, it performs an action
on the dataset.
Naive Bayes Algorithm

Types of Distance Metrics –


1. Euclidean Distance.
2. Manhattan Distance.
3. Minkowski Distance.
4. Hamming Distance.
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

• Advantages of KNN Algorithm:


1. It is simple to implement.
2. It is robust to the noisy training data
3. It can be more effective if the training data
is large.
• Disadvantages of KNN Algorithm:
1. Always needs to determine the value of K
which may be complex some time.
2. The computation cost is high because of
calculating the distance between the data
points for all the training samples.
Thank You…
Mr Abhay Chougule

You might also like