weightedknnrule.m

来自「最新的模式识别分类工具箱,希望对朋友们有用!」· M 代码 · 共 37 行

M
37
字号
% 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 + =
减小字号Ctrl + -
显示快捷键?