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

K-Nearest Neighbors

K-Nearest Neighbors is a simple machine learning algorithm that classifies data points based on their closest training examples in the feature space. It is a non-parametric algorithm that makes predictions based on similarities without making assumptions about the underlying data distribution. The algorithm works by finding the K number of closest training examples in the feature space and predicting the class based on the majority vote of its neighbors.

Uploaded by

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

K-Nearest Neighbors

K-Nearest Neighbors is a simple machine learning algorithm that classifies data points based on their closest training examples in the feature space. It is a non-parametric algorithm that makes predictions based on similarities without making assumptions about the underlying data distribution. The algorithm works by finding the K number of closest training examples in the feature space and predicting the class based on the majority vote of its neighbors.

Uploaded by

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

K-Nearest Neighbors

K-Nearest Neighbors
• KNN is one of the most basic yet essential classification algorithms in
machine learning. It belongs to the supervised learning domain and finds
intense application in pattern recognition, data mining, and intrusion
detection.

• It is widely disposable in real-life scenarios since it is non-parametric,


meaning it does not make any underlying assumptions about the distribution
of data (as opposed to other algorithms such as GMM, which assume a
Gaussian distribution of the given data). We are given some prior data (also
called training data), which classifies coordinates into groups identified by
an attribute.
Why Use K-Nearest
Neighbors
The KNN algorithm can compete with the most accurate models
because it makes highly accurate predictions. Therefore, you can
use the KNN algorithm for applications that require high accuracy but
that do not require a human-readable model. The quality of the
predictions depends on the distance measure.
Advantage K-Nearest
Neighbors
1: Easy to implement and understand
One of the main benefits of KNN is that it is very easy to
implement and understand. You do not need to learn any complex
mathematical formulas or optimization techniques to use KNN.

2: Lazy learning and no assumptions


Another advantage of KNN is that it is a lazy learning algorithm,
meaning that it does not build any explicit model or generalize from the
training data.
Disadvantages K-Nearest
Neighbors
1: High memory and computational cost
One of the main drawbacks of KNN is that it requires a lot of memory and
computational resources to store and process the entire training data.

2: Choice of k and distance metric


Another challenge of using KNN is that it depends on the choice of k and the distance metric.
Both of these parameters can have a significant impact on the performance and accuracy of
KNN.

3: Imbalanced classes and missing values


A final limitation of KNN is that it can struggle with imbalanced classes and missing values in
the data. Imbalanced classes occur when some classes have much more instances than others,
which can cause KNN to be biased towards the majority class and ignore the minority class.
Real World Example of K-
Nearest Neighbors
K-nearest neighbor is also used in retail to detect patterns in credit

card usage. Many new transaction-scrutinizing software

applications use KNN algorithms to analyze register data and spot

unusual patterns that indicate suspicious activity.


Algorithm Execution of K-
Nearest Neighbors
The K-NN working can be explained on the basis of the below algorithm:

• Step-1: Select the number K of the neighbors


• Step-2: Calculate the Euclidean distance of K number of neighbors
• Step-3: Take the K nearest neighbors as per the calculated Euclidean
distance.
• Step-4: Among these k neighbors, count the number of the data points in
each category.
• Step-5: Assign the new data points to that category for which the number of
the neighbor is maximum.
• Step-6: Our model is ready.
Thank you!!
Members:

Nepa, Christian mark


Olmedo, Dulce Amor
Raman, John Philip
Tagpuno, Mhel Angelo
Tan, Crystel
Cadayona, Francis Rhayl
Cacanog, Kent Ian
Celeste, Kent Harold

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy