⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svmclasslib.m

📁 我用于脑机接口P300拼写范例中的程序
💻 M
字号:
function [xsup,w,b]=svmclasslib(x,y,C,lambda,kernel,kerneloption,verbose,span)


% USAGE
%
% [xsup,w,b]=svmclasslib(x,y,C,lambda,kernel,kerneloption)
%
% simple interface to SVM LIB code for C-SVM


switch kernel
    case  'gaussian'
        kerneltype=2;
    case   'poly'
        kerneltype=1;
    otherwise
        kerneltype=0;
        degree=1;
 end;
coefficient=0;
gamma=0;
if kerneltype==2
    degree=0;
    gamma= 1/2/kerneloption.^2;
end;
if kerneltype==1 & kerneloption==1;
    coefficient=0;
    degree=1;
    gamma=1;
end;
if kerneltype==1 & kerneloption>1;
    coefficient=1;
    degree=kerneloption;
    gamma=1;
end;
Cache=40;
epsilon=1e-7;
svmtype=0;
parameters=[kerneltype degree gamma coefficient C Cache epsilon svmtype];


  %  [AlphaY, SVs, Bias, Parameters, nSV, nLabel] = mexSVMTrain(Samples, Labels, Parameters, Weight);
  
  [w, xsup, b ] = mexSVMTrain(x',y', parameters);
  
  w=w';
  xsup=xsup';
  b=-b;  % This is for compatibility with SVM-KM toolbox 
    
  % This is for compatibility with SVM-KM toolbox 
  % This is because it seems that the 1rst need to be positive
    if y(1)==-1 
        w=-w;
        b=-b;
    end;
    
    

⌨️ 快捷键说明

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