# Is there any method to find K value in KNN?

I am new to Matlab. For me the task is to perform data classification on some data set. The given data set consists of numeric values. One thing that bothers me is I have to perform all KNN, ANN, and SVM. In performing KNN, I faced a problem of how to find the value of K. If it is user defined? From which value we have to start and when to stop it?

Basically too large k may tend to underfit, while smaller k may tend to overfit. You may try to run the classification with different k within the preset range with cross-validation. Observe and find out the k that gives you the least cross validation sum-of-square error.