computeauc.m

来自「Continuous Profile Models (CPM) Matlab T」· M 代码 · 共 36 行

M
36
字号
%% function AUC = computeAUC(w)%%%% compute the AUC, assuming that:%% y=w(:,1);%% x=w(:,2);%% or... computeAUC([yVec;xVec]);%%%% function AUC = computeAUC(w)y=w(:,1);x=w(:,2);%% make sure x's are in increasing order[sortVal sortInd]=sort(x,'ascend');x=x(sortInd);y=y(sortInd);%% figure, plot(x(1:5),y(1:5))%% figure, plot(x,y);numChunks = length(x)-1;total = 0;%% calculate from left->right SAME AS smallest->biggestfor ch = 2:numChunks    ch1 = ch-1;    ch2 = ch;    width = x(ch2)-x(ch1);    height = mean(y(ch1:ch2));    contrib = width*height;    total = total + contrib;endAUC = total;

⌨️ 快捷键说明

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