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

📄 svmroccurve.m

📁 支持向量机SVM和核函数的MATLAB程序集
💻 M
字号:
function [AUC,tpr,fpr,b]=svmroccurve(xtest,ytest,xsup,w,w0,kernel,kerneloption,span)% USAGE%% [AUC,tpr,fpr,b]=svmroccurve(xtest,ytest,xsup,w,w0,kernel,kerneloption,span)%%  process the ROC curve and the AUC for SVM model (either SVMROC or SVM L2) % %  the inputs are as usual for SVM%% if nargin == 2 then the entries are% % [AUC,tpr,fpr,WMW,b]=svmroccurve(ypred,ytest);%%% the outputs%% AUC       Area under curve value% tpr,fpr   true positive and false positive vector for ROC curve plotting purpose% b         a new bias for the decision function. b can replace w0 and it has been%           processed so that the decision function corresponds to the one where the roc%            curve and the (1,0)-(0,1) diagonal meets%%%   % % 30/07/2004  A. Rakotomamonjyeps=1e-7;classcode=[1 -1];if  nargin >2    ypred = svmrocval(xtest,xsup,w,w0,kernel,kerneloption,span);else    ypred=xtest;      w0=0;end;npos=sum(ytest==1);nneg=sum(ytest==-1);%     % %WMW statistics% % indpos=find(ytest==classcode(1));% indneg=find(ytest==classcode(2));% A=0;% for i=1:npos%     A=A+ sum( (ypred(indpos(i))- ypred(indneg)) > eps);%     % end;% WMW=A/npos/nneg;% AUC=WMW;% % if nargout >1%     %     N=length(ypred);%     [ypred,ind]=sort(ypred);%     ytest=ytest(ind);%     b=[min(ypred)-1;ypred];%     for i=1:N+1;%         hi=sign(ypred-b(i)-eps);%         [Conf,metric]=ConfusionMatrix(hi,ytest,classcode);%         tp(i)=Conf(1,1);%         fp(i)=Conf(2,1);%     end;% %     %     tpr=tp/npos;%     fpr=fp/nneg;%     %     %     %     %calcul de b pour un cout erreur egale 

⌨️ 快捷键说明

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