Posted By

benjamin on 10/29/09


Tagged

matlab area the curve numerical under auc computing receiver operating characteristics roc


Versions (?)

true positive rate and false positive rate for receiver operating characteristics (ROC) and area under the curve


 / Published in: MatLab
 

URL: http://www.myoutsourcedbrain.com/2008/11/receiver-operating-characteristic-roc.html

i assume you have T,Y element of {-1,1}, see also my AUC function.

  1. function [TP,FP]=getfptp(T,Y)
  2. Y(Y>=0)=1;Y(Y<0)=-1; % target class (positive) is 1
  3. TP=sum( ( (Y==1) + (T==1) )==2 );
  4. FN=sum( ( (Y==-1) + (T==1) )==2 );
  5. FP=sum( ( (Y==1) + (T==-1) )==2 );
  6. TN=sum( ( (Y==-1) + (T==-1) )==2 );
  7. TP=TP/(TP+FN);
  8. FP=FP/(FP+TN);
  9. end

Report this snippet  

You need to login to post a comment.