?? exroccurve.m
字號(hào):
%% Example of ROC curve with SVM % and real data%% 30/07/2004 A. Rakotomamonjyclear allclose allticdata='sonar';svm='L1'file=['../data/' data '/' data '.mat'];load(file);classcode=[1 -1];[xapp,yapp,xtest,ytest]=nfcv(x,y,10,1);[xapp,xtest]=normalizemeanstd(xapp,xtest);lambda = 1e-7; C=0.1;kernel='gaussian';kerneloption=0.5;span=1;qpsize=100;verbose=1;if strcmp(svm,'L2') if size(xapp,1)< 1000 [xsup,w,w0,pos,tps,alpha] = svmclassL2(xapp,yapp,C,lambda,kernel,kerneloption,1); else [xsup,w,w0,pos,tps,alpha] = svmclassL2LS(xapp,yapp,C,lambda,kernel,kerneloption,1,span,qpsize); end;else if size(xapp,1)< 1000 [xsup,w,w0,pos,tps,alpha] = svmclass(xapp,yapp,C,lambda,kernel,kerneloption,1); else [xsup,w,w0,pos,tps,alpha] = svmclassLS(xapp,yapp,C,lambda,kernel,kerneloption,1,span,qpsize); end;end[AUC,tpr,fpr]=svmroccurve(xtest,ytest,xsup,w,w0,kernel,kerneloption,span);[ypred]=svmval(xtest,xsup,w,w0,kernel,kerneloption,span);AUC[C,metric]=ConfusionMatrix(sign(ypred),ytest,classcode);Cfigureh=plot(fpr,tpr,'k',0:0.1:1,0:0.1:1,'k:');set(gcf,'color','white');set(h,'LineWidth',2);h=xlabel('False Positive Rate');set(h,'Fonts',16);h=ylabel('True Positive Rate');set(h,'Fonts',16);h=title('ROC curve ');set(h,'Fonts',16);
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -