📄 msvmmot.m
字号:
function [malpha,mbias,mnsv,mexitflag,mmargin] = ... msvmmot(X,I,ker,arg,C,info)% MSVMMOT multiclass version of SVMMOT.% [malpha,mbias,mnsv,mexitflag,mmargin]=msvmmot(X,I,ker,arg,C,info)%% MSVMMOT decomposes input K-class problem is decomposed onto % K binary problems: i-th class against remaining (K-1)% classes. The binary problems are solved by SVMMOT % (see 'help svmmot') which results to the K decision rules.%% For classification use MSVMCLASS.%% Mandatory inputs:% X [2xM] set of training patterns.% I [1xM] labels (1,2,...K).% ker [string] kernel identifier (see 'help kernel').% arg [...] arguments of given kernel (see 'help kernel').% C [1x1] tradeoff between maximal margin and classification error.%% Optional inputs:% info [1x1] if == 1 then an info is printed. Default is 0.%% Output:% malpha [KxL] found Lagrange multipliers.% mbias [Kx1][real] found biases.% mnsv [Kx1] numbers of Supprot Vectors.% mexitflag [Kx1] exit flag returned by QP (see 'help qp').% mmargin [Kx1] margins.%% See also MSVMCLASS, SVMMOT, SVM.%% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz% Modifications% 19-September-2001, V. Franc, renamed to msvmmot.if nargin < 5, error('Not enough input arguments.');endif nargin < 6, info = 0;end% maximal class labelmaxclass=max(I);
L = size(X,2);% preallocate variablesmalpha=zeros(maxclass,L);mbias=zeros(maxclass,1);mnsv=zeros(maxclass,1);mexitflag=cell(maxclass,1);mmargin=zeros(maxclass,1);% decompose multi-class problem into maxclass dichotomi% problems.for class=1:maxclass, if info==1, disp(sprintf('Building rule %d of %d,', class,maxclass )); drawnow; end Idich=multi2dicho(I,class); if nargout >= 5, [malpha(class,:),mbias(class),mnsv(class),mexitflag{class},flps,... mmargin(class)] = svmmot(X,Idich,ker,arg,C); else [malpha(class,:),mbias(class),mnsv(class),mexitflag{class},flps]... = svmmot(X,Idich,ker,arg,C); endendreturn;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -