detection_error_tradeoff()

audmetric.detection_error_tradeoff(truth, prediction)[source]

Detection error tradeoff for verification experiments.

The detection error tradeoff (DET) is a graph showing the false non-match rate (FNMR) against the false match rate (FMR). The FNMR indicates how often an enrolled speaker was missed. The FMR indicates how often an impostor was verified as the enrolled speaker.

This function does not return a figure, but the FMR and FNMR, together with the corresponding verification thresholds at which a similarity value was regarded to belong to the enrolled speaker.

truth may only contain entries like [1, 0, True, False...], whereas prediction values can also contain similarity scores, e.g. [0.8, 0.1, ...].

The implementation was inspired by pyeer.eer_stats.calculate_roc but has been accelerated by using numpy-arrays instead of lists.

Parameters
  • truth (Sequence[Union[bool, int]]) – ground truth classes

  • prediction (Sequence[Union[bool, int, float]]) – predicted classes or similarity scores

Return type

Tuple[ndarray, ndarray, ndarray]

Returns

  • false match rate (FMR)

  • false non-match rate (FNMR)

  • verification thresholds

Raises

ValueError – if truth contains values different from 1, 0, True, False

Examples

>>> truth = [1, 0]
>>> prediction = [0.9, 0.1]
>>> detection_error_tradeoff(truth, prediction)
(array([1., 0.]), array([0., 0.]), array([0.1, 0.9]))