📄 svmroc.m
字号:
function [xsup,w,w0,pos,timeps,alpha,matriceind]=svmroc(x,y,C,kppv,margin,lambda,kernel,kerneloption,verbose,span,qpsize)% USAGE% % [xsup,w,w0,pos,timeps,alpha,matriceind]=svmroc(x,y,C,kppv,margin,lambda,kernel,kerneloption,verbose,span,qpsize)%%% SVM ROC Optimizer that can handle LS problem and large neighboorhood. This% algorithm uses a decomposition procedure.%% x y the learning data and labels% C penalization parameters% kppv the number of neighboor to consider% margin the margin for ranking% lambda conditioning parameter for the qp problem e.g 1e-7% kernel the kernel type e.g 'gaussian' or 'poly'% kerneloption kernel parameters% verbose verbosity of the algo 0 or 1% span type of semi parametric function e.g 1% qpsize size of qp algorithm%%% Outputs as usual for SVM except that xsup is a cell containing% the couple of positive and negative support vectors.% % see also svmrocval%% % 30/07/2004 A. Rakotomamonjyiteration=0;kkttol=1e-4;difftol=1e-7;chunksize=qpsize;indpos=find(y==1);indneg=find(y==-1);nbpos=length(indpos);nbneg=length(indneg);timeps=0;%-------------------------------------------------------------------------%% dist in feature space of each positive example to negative examples%% the idea here is to select a subset of couple for% optimizing the ranking%% % CASE 1 : select only the k-nearest negative neighbor of positive examplesfor i=1:nbpos+nbneg norme2(i)=svmkernel(x(i,:),kernel,kerneloption);end;matriceindneg=[];% select only the k-nearest positive neighbor of negative xamplesfor i=1:nbneg aux1=svmkernel(x(indneg(i),:),kernel,kerneloption,x(indpos,:)); dist=norme2(indneg(i))*ones(1,nbpos) + norme2(indpos) - 2*aux1 ; [aux,indicesorted]=sort(dist'); minim=min(length(indicesorted),kppv); matriceindneg=[matriceindneg; i*ones(minim,1) indicesorted(1:minim)];end;vect=unique(matriceindneg(:,2)); % process only these couples of nn of these positive samples.dist=[];matriceind=[];for i=1:length(vect) aux1=svmkernel(x(indpos(vect(i)),:),kernel,kerneloption,x(indneg,:)); dist=norme2(indpos(vect(i)))*ones(1,nbneg) + norme2(indneg) - 2*aux1 ; [aux,indicesorted]=sort(dist'); minim=min(length(indicesorted),kppv); matriceind=[matriceind; vect(i)*ones(minim,1) indicesorted(1:minim)];end;taille=length(matriceind);%--------Matrice stocke la liste des couples de points
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -