Commit c3c1ecbc authored by André Anjos's avatar André Anjos 💬

Merge branch '24-bug-in-roc-curves' into 'master'

Changed the ROC curve to implement what is required by 'The Handbook of Face Recognition'

Closes #24 

I have implemented the correct way to compute FRR values based on The Handbook of Face Recognition, i.e., counting positive scores that are exactly at the threshold to be correctly classified.

See merge request !24
parents c055afa9 fe73cee0
Pipeline #5938 failed with stages
in 2 minutes and 17 seconds
...@@ -385,7 +385,7 @@ blitz::Array<double,2> bob::measure::roc_for_far(const blitz::Array<double,1>& n ...@@ -385,7 +385,7 @@ blitz::Array<double,2> bob::measure::roc_for_far(const blitz::Array<double,1>& n
// do some fast magic to compute the FRR values ;-) // do some fast magic to compute the FRR values ;-)
do{ do{
// check whether the current positive value is less than the current negative one // check whether the current positive value is less than the current negative one
if (*pos_it <= *neg_it){ if (*pos_it < *neg_it){
// increase the positive count // increase the positive count
++pos_index; ++pos_index;
// go to the next positive value // go to the next positive value
...@@ -399,8 +399,8 @@ blitz::Array<double,2> bob::measure::roc_for_far(const blitz::Array<double,1>& n ...@@ -399,8 +399,8 @@ blitz::Array<double,2> bob::measure::roc_for_far(const blitz::Array<double,1>& n
// check, if we have reached a new FAR limit, // check, if we have reached a new FAR limit,
// i.e. if the relative number of negative similarities is greater than 1-FAR (which is the CRR) // i.e. if the relative number of negative similarities is greater than 1-FAR (which is the CRR)
if (((double)neg_index / (double)n_neg > 1. - far_list(far_index)) && if (((double)neg_index / (double)n_neg > 1. - far_list(far_index)) &&
!(bob::core::isClose ((double)neg_index / (double)n_neg, 1. - far_list(far_index), 1e-9, 1e-9))) { !(bob::core::isClose ((double)neg_index / (double)n_neg, 1. - far_list(far_index), 1e-9, 1e-9))) {
// copy the far value // copy the far value
retval(0,far_index) = far_list(far_index); retval(0,far_index) = far_list(far_index);
......
...@@ -192,9 +192,9 @@ def test_plots(): ...@@ -192,9 +192,9 @@ def test_plots():
# This example will test the ROC for FAR plot calculation functionality. # This example will test the ROC for FAR plot calculation functionality.
far = [0.01, 0.1, 1] far = [0.01, 0.1, 1]
ref = [0.48, 0.22, 0] ref = [0.42, 0.12, 0]
xy = roc_for_far(negatives, positives, far) xy = roc_for_far(negatives, positives, far)
# uncomment the next line to save a reference value
assert numpy.array_equal(xy[0], far) assert numpy.array_equal(xy[0], far)
assert numpy.array_equal(xy[1], ref) assert numpy.array_equal(xy[1], ref)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment