DEV Community

Cover image for What is KNN algorithm in Machine Learning
YTTMP3
YTTMP3

Posted on

What is KNN algorithm in Machine Learning

It appears in a lot of Machine Learning interviews that, What is the KNN algorithm in Machine Learning? Today we are going to discuss it in depth. Read the full post to get a basic understanding of the KNN algorithm.

Suppose we have a test Input X and we have to classify this X into a label based on our training dataset. How can we do this? Through the KNN algorithm we have to classify X based on its K neighbours. Let’s say we are classifying X based on K=3, so in order to label the X, we will look into the 3 nearest neighbours of X, so if among the 3 neighbours if 2 labels are Yes then, we will classify X as Yes.

Read more at https://hecodesit.com/what-is-knn-algorithm-in-machine-learning/

Top comments (1)

Collapse
 
rohit254 profile image
Rohit Kumar

I also write a blog on KNN please visit it and provide me your valuable thoughts: - KNN