Commit 1438376d authored by Manuel Günther's avatar Manuel Günther

Merge branch...

Merge branch '27-far-and-frr-thresholds-are-computed-even-when-there-is-no-data-support' of https://gitlab.idiap.ch/bob/bob.measure into 27-far-and-frr-thresholds-are-computed-even-when-there-is-no-data-support

Conflicts:
	bob/measure/cpp/error.cpp
	bob/measure/plot.py
	bob/measure/test_error.py
parents 8d1dd320 549f9f6c
......@@ -108,6 +108,30 @@ def test_nan_for_uncomputable_thresholds():
assert math.isnan(frr_threshold(negatives, positives, 0.09))
def test_nan_for_uncomputable_thresholds():
# in some cases, we cannot compute an FAR or FRR threshold, e.g., when we have too little data or too many equal scores
# in these cases, the methods should return NaN
from . import far_threshold, frr_threshold
# case 1: several scores are identical
positives = [0., 0., 0., 0., 0.1, 0.2, 0.3, 0.4, 0.5]
negatives = [0.5, 0.6, 0.7, 0.8, 0.9, 1., 1., 1., 1.]
# test that reasonable thresholds for reachable data points are provided
assert far_threshold(negatives, positives, 0.5) == 0.95, far_threshold(negatives, positives, 0.5)
assert frr_threshold(negatives, positives, 0.5) == 0.05, frr_threshold(negatives, positives, 0.5)
assert math.isnan(far_threshold(negatives, positives, 0.4))
assert math.isnan(frr_threshold(negatives, positives, 0.4))
# case 2: too few scores for the desired threshold
positives = numpy.arange(10.)
negatives = numpy.arange(10.)
assert math.isnan(far_threshold(negatives, positives, 0.09))
assert math.isnan(frr_threshold(negatives, positives, 0.09))
def test_indexing():
from . import correctly_classified_positives, correctly_classified_negatives
......
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