ker.m

来自「It is for Face Recognition」· M 代码 · 共 19 行

M
19
字号
% type = 'poly', 'grbf', 'norm'
%function [v]=ker(kerType, x1, x2)
function [v]=ker(kerType, x1, x2)
 % const
 % polynomial  
 c1     = 0.0001; theta  = 0; 
 % gaussian RBF
 c2      = 400;

 if kerType=='poly'                % polynomial    
    v = (c1*(x1'*x2)+theta)^2;
 elseif kerType == 'grbf'             % gaussian RBF
    v = exp(-norm((x1-x2), 2)/c2);
 elseif kerType == 'norm'
    v = x1'*x2;
 else
    v = 0.0;
 end

⌨️ 快捷键说明

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