📄 weightedknnrule.m
字号:
% Learns classifier and classifies test set% using weighted k-NN rule% Usage% [trainError, testError, estTrainLabels, estTestLabels] = ...% weightedKNNRule_VC(trainFeatures, trainLabels,params ,testFeatures, testLabels)% where%% Inputs:% trainFeatures - the training set vectors, one vector per column% trainLabels - the labels of the above% params - k, the number of nearest neighbors% weightFile, a file with the weights, a% a vector having k (non-increasing) entries. % Entry 1 is the weight of the nearest neighbor,% while entry k is the weight of the farthest neighbor% IF weightFile IS NOT PROVIDED, DEFAULT weights are% provided using the MacLeod, Luk and Titterington% weights with parameters s = 2k, and alpha = .5% (see lecture notes)% testFeatures - test set, one column per vector% testLabels - labels for test set%% Outputs% trainError - the error rate on the training set (one entry per% class + total error)% testError - the error rate on the test set (one entry per class% + total error)% estTrainLabels - the labels produced by the algorithm for the% training samples% estTestLabels - the labels produced by the algorithm for the% test samplesfunction [features, targets] = weightedKNNRule(train_features, train_targets, params, region, plot_on)fprintf('The method has not been implemented\n');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -