Metrics¶
- bt4vt.metrics.compute_cdet_at_threshold(fprs, fnrs, thresholds, threshold_value, dcf_p_target, dcf_c_fp, dcf_c_fn)[source]¶
Computation of detection cost function at a given threshold. Computation is performed as defined in the NIST Speaker Recognition Evaluation Plan 2019
\[C_{Det}(\theta) = C_{FN} \times P_{Target} \times P_{FN}(\theta) + C_{FP} \times (1 - P_{Target}) \times P_{FP}(\theta)\]- Parameters:
fprs (ndarray) – Array of False Positive Rates
fnrs (ndarray) – Array of False Negative Rates
thresholds (ndarray) – Array of Threshold values corresponding to fprs and fnrs
threshold_value (float) – Threshold value to compute detection cost function for
dcf_p_target (float) – [description]
dcf_c_fp (float) – [description]
dcf_c_fn (float) – [description]
- Returns:
cdet_at_threshold
- Return type:
float
- bt4vt.metrics.compute_eer(fprs, fnrs, thresholds)[source]¶
Computation of the Equal Error Rate and its threshold
- Parameters:
fprs (ndarray) – Array of False Positive Rates
fnrs (ndarray) – Array of False Negative Rates
thresholds (ndarray) – Array of Threshold values corresponding to fprs and fnrs
- Returns:
eer, eer_threshold
- Return type:
float, float
- bt4vt.metrics.compute_metrics_ratios(metrics)[source]¶
Computation of metric ratios defined as the subgroup metric scores divided by the average metric score.
- Parameters:
metrics (DataFrame) – DataFrame that contains metric scores for the average evaluation and subgroup evaluations. The first row corresponds to the eer, all other rows correspond to the min_cdet scores with weights specified in the config file
- Returns:
metric_ratios
- Return type:
DataFrame
- bt4vt.metrics.compute_min_cdet(fprs, fnrs, thresholds, dcf_p_target, dcf_c_fp, dcf_c_fn)[source]¶
Computation of the minimum of the detection cost function and its threshold. Computation is performed as defined in the NIST Speaker Recognition Evaluation Plan 2019
\[C_{Det}(\theta) = C_{FN} \times P_{Target} \times P_{FN}(\theta) + C_{FP} \times (1 - P_{Target}) \times P_{FP}(\theta)\]- Parameters:
fprs (ndarray) – Array of False Positive Rates
fnrs (ndarray) – Array of False Negative Rates
thresholds (ndarray) – Array of Threshold values corresponding to fprs and fnrs
dcf_p_target (float) – [description]
dcf_c_fp (float) – [description]
dcf_c_fn (float) – [description]
- Returns:
min_cdet, min_cdet_threshold
- Return type:
float, float
- bt4vt.metrics.get_fpfn_at_threshold(fprs, fnrs, thresholds, threshold_value, ppf_norm=False)[source]¶
Get the False Positive Rate and False Negative Rate at a given threshold value.
- Parameters:
fprs (ndarray) – Array of False Positive Rates
fnrs (ndarray) – Array of False Negative Rates
thresholds (ndarray) – Array of Threshold values corresponding to fprs and fnrs
threshold_value (float) – Threshold value to get fpr and fnr for i.e. min_cdet_threshold
ppf_norm (bool) – normalise the fpr and fnr values to the percent point function. Default is set to False.
- Returns:
fpr_at_threshold, fnr_at_threshold
- Return type:
float, float