Commit b9c497b3 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Add a helper eer function

parent a6e32312
Pipeline #20897 passed with stage
in 15 minutes and 37 seconds
......@@ -431,6 +431,42 @@ def false_alarm_rate(cmc_scores, threshold):
return float(incorrect) / float(counter)
def eer(negatives, positives, is_sorted=False, also_farfrr=False):
"""Calculates the Equal Error Rate (EER).
Please note that it is possible that eer != far != frr.
This function returns (far + frr) / 2 as eer.
If you also need the far and frr values, set ``also_farfrr`` to ``True``.
negatives : ``array_like (1D, float)``
The scores for comparisons of objects of different classes.
positives : ``array_like (1D, float)``
The scores for comparisons of objects of the same class.
is_sorted : bool
Are both sets of scores already in ascendantly sorted order?
also_farfrr : bool
If True, it will also return far and frr.
eer : float
The Equal Error Rate (EER).
far : float
The False Accept Rate (FAR). Returned only when ``also_farfrr`` is
frr : float
The False Reject Rate (FAR). Returned only when ``also_farfrr`` is
threshold = eer_threshold(negatives, positives, is_sorted)
far, frr = farfrr(negatives, positives, threshold)
if also_farfrr:
return (far + frr) / 2.0, far, frr
return (far + frr) / 2.0
def get_config():
"""Returns a string containing the configuration information.
......@@ -23,6 +23,7 @@ Single point measurements
.. autosummary::
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment