My implementation corresponding to Tom Fawcett's algorithm 3 in "roc graphs: notes and practical considerations for researchers, " 2004. Please see blog post for explanations and leave comments there.
- function auc=areaundercurve(FPR,TPR);
- % given true positive rate and false positive rate calculates the area under the curve
- % true positive are on the y-axis and false positives on the x-axis
- % sum rectangular area between all points
- % example: auc=areaundercurve(FPR,TPR);
- x2=[x2,1]; % the trick is in inventing a last point 1,1
- auc1=sum(y2.*xdiff); % upper point area
- auc2=sum([0,y2([1:end-1])].*xdiff); % lower point area
CommentsSubscribe to comments
You need to login to post a comment.