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


/ Published in: MatLab
Save to your folder(s)

i assume you have T,Y element of {-1,1}, see also my <a href="http://snipplr.com/view/22109/area-under-the-curve-auc/">AUC function</a>.


Copy this code and paste it in your HTML
  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

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.