Filter löschen
Filter löschen

Classification Learner App k-Nearest Neighbor k-NN

2 Ansichten (letzte 30 Tage)
Leen Al Homoud
Leen Al Homoud am 9 Okt. 2020
Bearbeitet: Gaurav Garg am 12 Okt. 2020
I was using the Classification Learner App and testing k-Nearest Neighbor. My results showed that the highest accuracy is when the neighbor is 1 and it keeps on decreasing as the number of neighbors is increased. These results don't make sense and don't match the k-NN code I wrote. Did anyone face this problem? What was the reason?

Antworten (1)

Gaurav Garg
Gaurav Garg am 12 Okt. 2020
Bearbeitet: Gaurav Garg am 12 Okt. 2020
Hi,
The accuracy for any ML model (including KNN) is decided by mutiple factors, one of which is the dataset and its features.
It could be possible that your dataset is well suited for kNN with k=1, while might not give good accuracy for other number of neighbours. So, I would recommend you to try testing your dataset with other models (like SVM, Regression) too and see how are these models behaving.
Moreover, this is not a problem with the model or the dataset. Some models (with some hyper-parameters) overfit the data, some of them underfit the data, while some of them prove to be the perfect choices and this choice has to be analyzed.

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by