### Accuracy of kNN Classifier as k is varied

function [errors] = knn_error_rates(traindata,trainlabels, testdata, testlabels,kmax,plotflag)

% function [errors] = knn_error_rates(traindata,trainlabels, testdata, testlabels,kmax,plotflag)

%

% a brief description of what the function does

% ......

% Your Name, CS 175, date

%

% Inputs

% traindata: a N1 x d vector of feature data (the "memory" for kNN)

% trainlabels: a N1 x 1 vector of classlabels for traindata

% testdata: a N2 x d vector of feature data for testing the knn classifier

% testlabels: a N2 x 1 vector of classlabels for traindata

% kmax: an odd positive integer indicating the maximum number of neighbors

% plotflag: (optional argument) if 1, the error-rates versus k is plotted,

% otherwise no plot.

%

% Outputs

% errors: r x 1 vector of error-rates on testdata, where r is the

% number of values of k that are tested.

-------- Your code goes here -------