true positive rate and false positive rate for receiver operating characteristics (ROC) and area under the curve
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
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
URL: http://www.myoutsourcedbrain.com/2008/11/receiver-operating-characteristic-roc.html
Report this snippet
Comments
Subscribe to comments