KNN classifier determining best K- value

3 visualizaciones (últimos 30 días)
Navya Snigdha Thumma
Navya Snigdha Thumma el 26 de Jul. de 2015
Editada: Matpar el 27 de Sept. de 2019
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.

Respuestas (1)

Image Analyst
Image Analyst el 26 de Jul. de 2015
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 comentario
Matpar
Matpar el 27 de Sept. de 2019
Editada: Matpar el 27 de Sept. de 2019
HI Image Analyst,
Can KNN be applied for classifying pixels on a single image? Can you guide me please implementing these steps in MATLAB, I am googling and it still seems challenging,
Thank you for responding!

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by