Vary k-nearest neighbor classification
10 views (last 30 days)
Hello, I have written this little model for k-nearest neighbor classification:
knn_modell = fitcknn(cars, origin, 'NumNeighbors',k)
calculated_knn1 = predict(knn_modell, cars)
truthmatrix = confusionmat(originarray, calculated_knn1)
So far so good. But now I wanna vary k between 1 and 20. How can I do that in matlab? And I want to make a graph of resubstitution loss as a function of k. Is this possible at all in Matlab?