⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 knnclass.m

📁 支持向量机工具箱
💻 M
字号:
function y = knnclass(X,model)% KNNCLASS k-Nearest Neighbours classifier.%% Synopsis:%  y = knnclass(X,model)%% Description:%  The input feature vectors X are classified using the K-NN%  rule defined by the input model.% % Input:%  X [dim x num_data] Data to be classified.%  model [struct] Model of K-NN classfier:%   .X [dim x num_prototypes] Prototypes.%   .y [1 x num_prototypes] Labels of prototypes.%   .K [1x1] Number of used nearest-neighbours.%% Output:%  y [1 x num_data] Classified labels of testing data.%% Example:%  trn = load('riply_trn');%  tst = load('riply_tst');%  ypred = knnclass(tst.X,knnrule(trn,5));%  cerror( ypred, tst.y )%% See also %  KNNRULE.%% (c) Statistical Pattern Recognition Toolbox, (C) 1999-2003,% Written by Vojtech Franc and Vaclav Hlavac,% <a href="http://www.cvut.cz">Czech Technical University Prague</a>,% <a href="http://www.feld.cvut.cz">Faculty of Electrical engineering</a>,% <a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a>% Modifications:% 19-may-2003, VF% 18-sep-2002, V.FrancX=c2s(X);model=c2s(model);if ~isfield(model,'K'), model.K=1; end;y = knnclass_mex(X,model.X,model.y, model.K);return; % EOF

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -