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

📄 exroccurve.m

📁 支持向量机SVM和核函数的MATLAB程序集
💻 M
字号:
%%    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);

⌨️ 快捷键说明

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