kNN is a unique machine learning algorithm with its own pros and cons. The good news is it’s very simple to understand and implement kNN making kNN a good option to include in the Machine Learning or Data Science toolbox.
1- High Accuracy
kNN is a surprisingly accurate algorithm. It is so simple that one simply doesn’t expect kNN to perform so well but it does.
If machine learning project is not related to outlier prediction or data doesn’t have outliers in it kNN’s accuracy might shock you.
kNN algorithm is very simple to understand, implement and tune.
Because of such characteristics kNN is a perfect machine learning algorithm for beginners and also for teachers to help their students get going with machine learning.
Aside of learning purposes, kNN can be very useful to quickly cross validate results as a benchmark algorithm.
Being able to work with non-linear data as well as perform both classification and regression kNN offers some versatility as well.
Compared to a linear model algorithm such as Logistic regression which will only work on linear classification problems kNN is much more adaptable giving Data Scientists and Machine Learning Engineers another reason to continue utilizing in specific cases.
4- Ain't nobody got time for training
Because there is no training! Instead of training, kNN algorithm calculates distances for each sample point during the inference phase (prediction). This means kNN won’t require any training.
However, benefits of nonexistent training are more than counterbalanced by a somewhat sluggish prediction complexity. See:
k-Nearest Neighbor is a unique algorithm that can be very pleasant to work with if you can look beyond its shortcomings.
In this machine learning tutorial, we have elaborated some of the pro points for it such as simplicity, high accuracy and overall versatility.
If you need a really fast machine learning algorithm following options can satisfy your needs for classification tasks
And for both classification and regression solutions you may want to explore following machine learning models: