Return to Snippet

Revision: 19729
at October 29, 2009 15:15 by benjamin


Initial Code
function [TP,FP]=getfptp(T,Y)
    Y(Y>=0)=1;Y(Y<0)=-1;  % target class (positive) is 1
    TP=sum( ( (Y==1) + (T==1) )==2 );
    FN=sum( ( (Y==-1) + (T==1) )==2 );
    FP=sum( ( (Y==1) + (T==-1) )==2 );
    TN=sum( ( (Y==-1) + (T==-1) )==2 );
    TP=TP/(TP+FN);
    FP=FP/(FP+TN);
end

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

Initial Description
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>.

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

Initial Tags


Initial Language
MatLab