📄 msvmclass2.m
字号:
function [Ipred,mfpred] = msvmclass2(Xtst,Xtrn,Itrn,malpha,mbias,ker,arg,info)% MSVMCLASS2 muli-class version of the SVM classifier.% [Ipred,mfpred] = msvmclass2(Xtst,Xtrn,Itrn,malpha,mbias,ker,arg,info)%% MSVMCLASS2 multiclass version of SVMCLASS (see 'help svmclass').%% Input:% Xtst [DxN] test points.% Xtrn [DxM] training points.% Itrn [1xM] labels of trainign points.% malpha [KxM] Lagrange multipliers.% mbias [Kx1] bias.% ker [string] kernel identifier (see help kernel).% arg [] arguments of given kernel (see help kernel).%% Output:% Itst [1xN] labels of test points (1,2).% mfpred [KxN] value of output function for each point (If greater or% equal to 0 then class is 1 else class is 2).%% See also SVMCLASS, SVM.%% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz% Written Vojtech Franc (diploma thesis) 23.12.1999, 5.4.2000% Modifications% 19-September-2001, V. Franc, comments changed.if nargin < 8, info=0;;endif nargin < 7, arg=[];end
% get max class
maxclass=max(Itrn);
mfpred=zeros(maxclass,size(Xtst,2));
for class=1:maxclass,
if info, disp(sprintf('Class %d against the others', class )); end [tmp,mfpred(class,:)] = svmclass2(Xtst,Xtrn,multi2dicho(Itrn,class),...
malpha(class,:),mbias(class),ker,arg,info);
end
[tmp,Ipred]=max(mfpred);
return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -