Code covered by the BSD License  

Highlights from
Faster ROC-AUC

image thumbnail

Faster ROC-AUC

by

 

12 Apr 2013 (Updated )

Fast calculation of AUC of an ROC for binary classification problems, written in C++.

install.m
%% Execute this script with fastAUC.cpp in the current directory
%Compile
mex fastAUC.cpp

%Test - needs the statistics toolbox
labels   = [1,1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,1,1,1,1];
scores   = rand(1,numel(labels));
posclass = 1;
AUC = fastAUC(labels,scores,posclass);
[~,~,~,AUC2] = perfcurve(labels,scores,posclass);

if(AUC == AUC2)
    fprintf('Test succeeded, AUC=%.4f\n',AUC);
else
    fprintf('Test failed! %.4f != %.4f\n',AUC,AUC2);
end

Contact us