📄 pmsvm.m
字号:
function pmsvm(Xtrn,Itrn,malpha,mbias,ker,arg,background)% MPSVM vizualizes decision rule of multiclass SVM problem.% pmsvm(X,I,malpha,mbias,ker,arg )%% PMSVM vzualizes multiclass SVM problem decomposed in 2D.%% Input:% Xtrn [2xM] set of training patterns.% Itrn [1xM] labels (1,2,...K).% malpha [KxM] weights of traning patterns for each dichotomi. % Supprot Vectors are Xtrn(:,find(alpha>0)).% mbias [Kx1] bias of used discrimination function.% ker [string] identifies kernel (see help KERNEL).% arg [...] arguments of given kernel (see help KERNEL).%% See also MSVMCLASS, 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-sep-2001, V. Franc, comments changed.% 20-may-2001, V. Franc, new approach% 16-april-2001, V. Franc, createdif nargin < 7, background = 0;end% points sizePOINTSSIZE=10; % grid for x-axis and y-axisGRIDX=150;GRIDY=150;epsilon=1e-5;if nargin < 6, error('Not enough input arguments.'); return;endppatterns(Xtrn,Itrn,POINTSSIZE);hold on;V = axis;dx = (V(2)-V(1))/GRIDX;dy = (V(4)-V(3))/GRIDY;[X,Y] = meshgrid(V(1):dx:V(2),V(3):dy:V(4));% make testing pointsXtst=[reshape(X',1,prod(size(X)));reshape(Y',1,prod(size(Y)))];% classify pointsnclass=max(Itrn);D = zeros(nclass,size(Xtst,2) );for i=1:nclass, [Ipred,fpred] = svmclass2(Xtst,Xtrn,multi2dicho(Itrn,i),... malpha(i,:),mbias(i),ker,arg); D(i,:) = fpred; endpdiscrim( D, V(1):dx:V(2), V(3):dy:V(4),background );if background, ppatterns(Xtrn,'kx',POINTSSIZE);else ppatterns(Xtrn,Itrn,POINTSSIZE);endaxis(V);hold off;return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -