📄 soutput.m
字号:
function [fx]=soutput(sv,svy,svalpha,ker,bias,input)
%[fx]=svoutput(sv,svy,svalpha,ker,bias,input)
%calcaulate the output of the svm after training with the input being input(variable)
%sv -- the support vector after training
%svy -- the expect output in training
%svalpha -- the alpha corresponding the suppor vector
%ker -- the type of kernel function,as follows:
% 'linear' -
% 'poly' - p1 is degree of polynomial
% 'rbf' - p1 is width of rbfs (sigma)
% 'sigmoid' - p1 is scale, p2 is offset
% 'spline' -
% 'bspline' - p1 is degree of bspline
% 'fourier' - p1 is degree
% 'erfb' - p1 is width of rbfs (sigma)
% 'anova' - p1 is max order of terms
%bias -- the bias gained after training
%input -- the input in testing
if (nargin <2 | nargin>6) % check correct number of arguments help svoutput
else
m=size(input,1);
fx=bias.*ones(m,1);
n=size(sv,1);
for k=1:1:m
for j=1:1:n
fx(k,1)=fx(k,1)+svalpha(j,1)*svy(j,1)*svkernel(ker,input(k,:),sv(j,:));
end
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -