KNN classifier determining best K- value
2 次查看(过去 30 天)
显示 更早的评论
Hello, I am working on KNN classifier and I have to comment on the best K value on over all output. But I cant find what is the best K value as the outputs for the data sets are different from one another. Is there any generalised best K value for KNN classifier for a data set with N features or it varies with each dataset. Thankyou.
0 个评论
回答(1 个)
Image Analyst
2015-7-26
You should have a training set that you have "ground truth" for - known values. Try different K and see which K gives you the highest accuracy. Sure, the best K might be different for a different data set, but you'll never know because you don't know what the right answers are for those data - if you did you would have used them in the training because it's best to use as much training data as you can if you want to find the best K. If you use a small portion of your data to train, then how much confidence can you have that the K you find will be the best? So you use all your know data in training. Anyway, that's how I see it, but I'm not a Ph.D. Statistician so I could be wrong but I still think that to know what's "best" you have to know what it got right and what it got wrong.
1 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!