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

📄 errors.m

📁 一个关于adaboost和NN的matlab程序
💻 M
字号:
function [area,roc] = errors(netans,answer,outfile)% WBL 23 August 2002 Caculate true positive and false positive rates for all tresholds%                    Returning the ROC and the area under its convex hull.% $Revision: 1.6 $  $Date: 2002/10/31 11:24:12 $%Inputs: netans two neurons%        answer actual class (0 or 1)%        outfile FID of a stream for output% WBL 20 Sep calculate and save errors at Threshold=0.5% WBL 16 Sep based on errors.m Caclculate complete ROC not just 11 sample points[Qx,ntestsx] = size(answer);        %Q is junk%use difference between both neurons as probability of 1%then rescale for comparison with threshold Tx.netconf = (0.5 + 0.5*( netans(2,:) - netans(1,:) ) );%[netans; netconf][B,index] = sort(netconf);roc = zeros(ntestsx,2);for i=1:ntestsx-1    tn = sum(~answer(index(1:i)));    fn = i-tn;    tp = sum(answer(index(i+1:ntestsx)));    fp = (ntestsx-i)-tp;    TP = tp/sum(answer);    FP = fp/sum(~answer);    roc(i,1) = TP;    roc(i,2) = FP;endTX = 0.5;AAx = netconf > TX;%TX= median(netconf);%AAx = netconf > median(netconf);e  = sum(abs(AAx-answer))/ntestsx;tn = sum(~answer & ~AAx);fn = sum( answer & ~AAx);fp = sum(~answer &  AAx);tp = sum( answer &  AAx);TP = tp/sum(answer);FP = fp/sum(~answer);fprintf('%f %f %f %3d %3d %3d %3d %f ',...        TX,TP,FP,tn,fn,fp,tp,e);fprintf(outfile,'%2f %f %f %3d %3d %3d %3d %f ',...        TX,TP,FP,tn,fn,fp,tp,e); area=auroc(roc,TP,FP);fprintf('Area under ROC %f\n',area);

⌨️ 快捷键说明

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