Classification Learner App k-Nearest Neighbor k-NN

조회 수: 3 (최근 30일)
Leen Al Homoud
Leen Al Homoud 2020년 10월 9일
편집: Gaurav Garg 2020년 10월 12일
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?

답변 (1개)

Gaurav Garg
Gaurav Garg 2020년 10월 12일
편집: Gaurav Garg 2020년 10월 12일
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.

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by