Compute roc using roc_for_far internally

parent 4281a0c2
Pipeline #14105 passed with stages
in 16 minutes and 40 seconds
 ... ... @@ -214,18 +214,15 @@ double bob::measure::minWeightedErrorRateThreshold( blitz::Array bob::measure::roc(const blitz::Array &negatives, const blitz::Array &positives, size_t points) { double min = std::min(blitz::min(negatives), blitz::min(positives)); double max = std::max(blitz::max(negatives), blitz::max(positives)); double step = (max - min) / ((double)points - 1.0); blitz::Array retval(2, points); for (int i = 0; i < (int)points; ++i) { std::pair ratios = bob::measure::farfrr(negatives, positives, min + i * step); // preserve X x Y ordering (FAR x FRR) retval(0, i) = ratios.first; retval(1, i) = ratios.second; // Uses roc_for_far internally // Create an far_list blitz::Array far_list((int)points); int min_far = -8; // minimum FAR in terms of 10^(min_far) double counts_per_step = points / (-min_far) ; for (int i = 1-(int)points; i <= 0; ++i) { far_list(i+(int)points-1) = std::pow(10., (double)i/counts_per_step); } return retval; return bob::measure::roc_for_far(negatives, positives, far_list, false); } blitz::Array ... ... @@ -445,9 +442,9 @@ bob::measure::roc_for_far(const blitz::Array &negatives, if (far_index >= 0) { // walk to the end of both lists; at least one of both lists should already // have reached its limit. while (pos_it++ != pos.end()) while (pos_it != pos.end() && pos_it++ != pos.end()) ++pos_index; while (neg_it++ != neg.end()) while (neg_it != neg.end() && neg_it++ != neg.end()) ++neg_index; // fill in the remaining elements of the CAR list do { ... ...
No preview for this file type
No preview for this file type
 ... ... @@ -251,7 +251,7 @@ def test_plots(): # This example will test the ROC plot calculation functionality. xy = roc(negatives, positives, 100) # uncomment the next line to save a reference value # save('nonsep-roc.hdf5', xy) # save(F('nonsep-roc.hdf5'), xy) xyref = bob.io.base.load(F('nonsep-roc.hdf5')) assert numpy.array_equal(xy, xyref) ... ... @@ -273,7 +273,7 @@ def test_plots(): # This example will test the DET plot calculation functionality. det_xyzw = det(negatives, positives, 100) # uncomment the next line to save a reference value # save('nonsep-det.hdf5', det_xyzw) # save(F('nonsep-det.hdf5'), det_xyzw) det_xyzw_ref = bob.io.base.load(F('nonsep-det.hdf5')) assert numpy.allclose(det_xyzw, det_xyzw_ref, atol=1e-15) ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!