0 votes

In Machine learning, KNN (K-nearest neighbors) is a type of supervised learning algorithm that can be used for both classification and regression tasks. For KNN, we need to initialize the hyperparameter K. Later algorithm will calculate the distance between all the observations of the training dataset with the current observation in the test dataset. Then the algorithm picks the observations with the highest K distances. If it is a regression task, the algorithm returns the mean of K classes. If it is a classification task, the algorithm returns the mode of K classes.

You can enroll in this Machine learning online course by Intellipaat to learn Machine learning.

You can watch this video on Machine learning Full course to learn and implement KNN: