Member-only story

KNN Algorithm Complete Breakdown

Nazhim Kalam
2 min readAug 1, 2021

--

KNN is a type of supervised machine learning algorithm and is also called as K Nearest Neighbor, which can be used for both classifications and regression predictive problems.

These are the following two properties that will define KNN well:

  • Lazy Learning Algorithm:- KNN is a lazy learning algorithm because it does not have a specialized training phase and uses all the data for training while classification.
  • Non-parametric Learning Algorithm:- KNN is also a non-parametric learning algorithm because it doesn’t assume anything about the underlying data.

Working of KNN Algorithm

KNN algorithm uses “feature similarity” to predict the values of new data points, which further means that the new data point will be assigned a value based on how closely it matches the points in the training set.

Step 01: we load the dataset

Step 02: we choose the perfect K value

Step 03: Depending on the K value, calculations are made tarins the model

Step 04: The trained model can be used for predictions.

So, this is a brief description of what the KNN algorithm is all about and how it works. If you need detailed in-depth content, please do let me know in the comments. See you on the next blog 😉

--

--

Nazhim Kalam
Nazhim Kalam

Written by Nazhim Kalam

Learning is a never-ending journey be it in college or in life, just enjoy it

No responses yet