Classification Learner App k-Nearest Neighbor k-NN
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!