Hello.
I am using the k-nearest neighbor classifier as the below code.
Could you explain what 'NSMethod','exhaustive' are?
Is it related to distance metric learning? (It learns a metric that pulls the neighbor candidates near, while pushes near data from different classes out of the target neighbors margin.) I got a high accuracy than I expected.
clear allclose allfor i = 2:30:750 X = csvread('kth_optical_only.csv'); Y = csvread('kth_optical_only_class1.csv'); X = X(:,1:i); Mdl = fitcknn(X,Y,'NumNeighbors',3,... 'NSMethod','exhaustive','Distance','cosine',... 'Standardize',1); rng(1); % For reproducibility
CVKNNMdl = crossval(Mdl, 'KFold', 5); classAccuracy(i) = 100 - kfoldLoss(CVKNNMdl, 'LossFun', 'ClassifError')*100;end
Best Answer