Verification scores: EER, detection cost and the DET curve
A verification system answers "same source or not?" for pairs of things. Score its trials with the equal error rate, the detection cost at the prior and costs you care about, and the DET curve, and know when the numbers are optimistic.
What runs in CodeSplash
- Evaluate verification scores (EER, DCF, DET) Verified in Python and R
You will be able to
- Turn a table of trials (a score and whether the pair really matches) into an equal error rate and a detection cost
- Choose a target prior and error costs, and tell the minimum cost from the actual cost at a fixed threshold
- Explain why the ROC-convex-hull EER is never above the linear one, and why trial-level intervals are too narrow
Read first
Same or different?
ReadSpeaker verification, face matching and fraud checks all answer one question for a pair of things: do they come from the same source? Each comparison is a trialVerification trialOne comparison of two items (two voices, a claim and a recording) with a score; a target trial is a real match. with a score; a target trial really is a match. Two errors are possible: a miss (a real match rejected) and a false alarm (a different source accepted).
The example table holds 600 simulated speaker trials over three recording channels: 120 target and 480 non-target, scored by a cosine similarity.
Make a guess
PredictPredict first
Target trials score well above non-target trials on average, but the two overlap a little, most on the noisy street channel. Where do you expect the two error rates to meet?
Make your guess between 0 and 50 %, then reveal.
Reveal
The equal error rate is 2.5%: at that threshold the share of missed targets equals the share of accepted non-targets.
The equal error rate and the DET curve
ReadOn 120 target and 480 non-target trials, the equal error rate was 2.50% (95% CI 1.25% to 3.75%) and the minimum detection cost 0.308 at π = 0.01, C_miss = 1, C_fa = 1.
- EER
- 2.5%
- Minimum DCF
- 0.3083
- Miss rate at 1% false alarms
- 14.2%
Plots
View data
| Miss rate (false rejects) | False alarm rate (false accepts) | Trials |
|---|---|---|
| 0 | 1 | All trials |
| 0 | 0.9979 | All trials |
| 0 | 0.9958 | All trials |
| 0 | 0.9938 | All trials |
| 0 | 0.9917 | All trials |
| 0 | 0.9896 | All trials |
| 0 | 0.9875 | All trials |
| 0 | 0.9854 | All trials |
| 0 | 0.9833 | All trials |
| 0 | 0.9812 | All trials |
| 0 | 0.9792 | All trials |
| 0 | 0.9771 | All trials |
| 0 | 0.9750 | All trials |
| 0 | 0.9729 | All trials |
| 0 | 0.9708 | All trials |
| 0 | 0.9667 | All trials |
| 0 | 0.9646 | All trials |
| 0 | 0.9625 | All trials |
| 0 | 0.9604 | All trials |
| 0 | 0.9583 | All trials |
| 0 | 0.9542 | All trials |
| 0 | 0.9521 | All trials |
| 0 | 0.9500 | All trials |
| 0 | 0.9479 | All trials |
| 0 | 0.9458 | All trials |
| 0 | 0.9437 | All trials |
| 0 | 0.9417 | All trials |
| 0 | 0.9396 | All trials |
| 0 | 0.9375 | All trials |
| 0 | 0.9333 | All trials |
| 0 | 0.9292 | All trials |
| 0 | 0.9229 | All trials |
| 0 | 0.9208 | All trials |
| 0 | 0.9187 | All trials |
| 0 | 0.9167 | All trials |
| 0 | 0.9146 | All trials |
| 0 | 0.9125 | All trials |
| 0 | 0.9104 | All trials |
| 0 | 0.9083 | All trials |
| 0 | 0.9063 | All trials |
| 0 | 0.9042 | All trials |
| 0 | 0.9021 | All trials |
| 0 | 0.9000 | All trials |
| 0 | 0.8979 | All trials |
| 0 | 0.8958 | All trials |
| 0 | 0.8917 | All trials |
| 0 | 0.8875 | All trials |
| 0 | 0.8833 | All trials |
| 0 | 0.8812 | All trials |
| 0 | 0.8792 | All trials |
| 0 | 0.8771 | All trials |
| 0 | 0.8729 | All trials |
| 0 | 0.8708 | All trials |
| 0 | 0.8667 | All trials |
| 0 | 0.8646 | All trials |
| 0 | 0.8625 | All trials |
| 0 | 0.8604 | All trials |
| 0 | 0.8562 | All trials |
| 0 | 0.8521 | All trials |
| 0 | 0.8500 | All trials |
First 60 of 393 rows.
View data
| Trial | cosine |
|---|---|
| Non-target | 0.2010 |
| Non-target | 0.3850 |
| Non-target | 0.3840 |
| Non-target | 0.2920 |
| Non-target | 0.1320 |
| Target | 0.7800 |
| Non-target | 0.0460 |
| Non-target | 0.2990 |
| Non-target | 0.1560 |
| Target | 0.5810 |
| Non-target | 0.1420 |
| Target | 0.7880 |
| Non-target | 0.2190 |
| Non-target | 0.3400 |
| Target | 0.6650 |
| Non-target | 0.1770 |
| Non-target | 0.2680 |
| Non-target | 0.1140 |
| Non-target | 0.1120 |
| Non-target | 0.1060 |
| Non-target | 0.0700 |
| Non-target | 0.1600 |
| Non-target | 0.0750 |
| Target | 0.5230 |
| Target | 0.7550 |
| Non-target | 0.1600 |
| Non-target | 0.0440 |
| Non-target | 0.2420 |
| Non-target | 0.2490 |
| Non-target | 0.1260 |
| Non-target | 0.2680 |
| Non-target | 0.2330 |
| Non-target | 0.1860 |
| Non-target | 0.2620 |
| Target | 0.7300 |
| Target | 0.6190 |
| Non-target | 0.0450 |
| Non-target | 0.1300 |
| Non-target | 0.1830 |
| Non-target | 0.1420 |
| Target | 0.6450 |
| Non-target | 0.3110 |
| Non-target | 0.2200 |
| Non-target | 0.2510 |
| Non-target | 0.2220 |
| Non-target | 0.4550 |
| Non-target | 0.2000 |
| Non-target | 0.2160 |
| Target | 0.7740 |
| Target | 0.5580 |
| Target | 0.7230 |
| Target | 0.8650 |
| Non-target | 0.2250 |
| Non-target | 0.1050 |
| Non-target | 0.2870 |
| Target | 0.5110 |
| Non-target | 0.1620 |
| Non-target | 0.1110 |
| Non-target | 0.1560 |
| Non-target | 0.0790 |
First 60 of 600 rows.
Assumptions
- Scores come from a fixed system — Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance.
- Trials are not independent — Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give.
- Enough errors at the EER — About 3 misses and 12 false alarms at the EER; with fewer than 30 of either the rates are rough (Doddington's rule of 30).
Verification metrics (95% intervals from resampling trials)
| Measure | Value | 95% CI low | 95% CI high | Threshold | False alarm rate | Miss rate |
|---|---|---|---|---|---|---|
| Equal error rate (EER) | 0.0250 | 0.0125 | 0.0375 | 0.4360 | 0.0250 | 0.0250 |
| Minimum DCF (threshold picked on these trials) | 0.3083 | 0.1167 | 0.3896 | 0.5620 | 0 | 0.3083 |
Miss rate at fixed false alarm rates
| False alarm rate at most | Miss rate | Threshold |
|---|---|---|
| 0.0010 | 0.3083 | 0.5620 |
| 0.0100 | 0.1417 | 0.5020 |
| 0.0500 | 0.0083 | 0.3890 |
| 0.1000 | 0 | 0.3360 |
- A trial is accepted when cosine ≥ the threshold; target trials: same = true. EER: linear interpolation on the operating points. DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = 0.01. Intervals: 1000 resamples of trials within each class on the shared seeded stream (seed 42).
The exact R script · R R version 4.5.1 (2025-06-13)
# Evaluate verification scores (EER, DCF, DET)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method evaluate.verification 1.0.0 · spec b3990d6ff44d22ee
# Dataset: aud3_trials (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
library(codesplashr) # cs_verif_* (DET points, EER, DCF, Cllr)
# %% Data
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/aud3_trials.parquet", col_select = c("cosine", "same")))
n_input <- nrow(df)
df[["same"]] <- factor(df[["same"]], levels = c("false", "true")) # stored level order
df <- df[stats::complete.cases(df[c("cosine", "same")]), , drop = FALSE] # listwise deletion
df[] <- lapply(df, function(x) if (is.factor(x)) droplevels(x) else x)
n_dropped <- n_input - nrow(df)
warnings <- list()
if (n_dropped > 0) {
warnings <- c(warnings, cs_warning("CS_W_ROWS_DROPPED", dropped = n_dropped, total = n_input))
}
if (n_input > 0 && nrow(df) == 0) cs_error("CS_E_NO_ROWS")
cs_check_finite_columns(df, c("cosine", "same")) # infinite values stop the run (registry/errors.yaml)
# %% Trials
sc <- "cosine"
lc <- "same"
gc <- NULL
present <- levels(df[[lc]]) # levels with data, in stored order
cs_check_groups(df[[lc]], lc, minimum = 2, exactly = 2)
target_level <- present[length(present)] # default: the last level ("true")
s <- as.numeric(df[[sc]])
pos <- as.character(df[[lc]]) == target_level
p_target <- 0.01 # NULL: the share of target trials
c_miss <- 1
c_fa <- 1
eer_method <- "linear" # linear | rocch
llr <- FALSE
fixed_threshold <- NULL
reps <- as.integer(1000)
conf <- 0.95
seed <- 42 # portable Wichmann-Hill stream: Python resamples the same trials
# %% Verification metrics
res <- cs_verif_summary(s, pos, p_target, c_miss, c_fa, eer_method, if (llr) NULL else fixed_threshold, llr)
ci <- cs_verif_bootstrap(s, pos, reps, seed, conf, p_target, c_miss, c_fa, eer_method)
pts <- cs_verif_det_points(s, pos)
prior <- res$prior
n_t <- res$n_target
n_n <- res$n_nontarget
op_rows <- lapply(c(0.001, 0.01, 0.05, 0.1), function(target) {
o <- cs_verif_fnr_at_fpr(pts, target)
list(fpr_target = target, fnr = o$fnr, threshold = o$threshold)
})
fnr_01 <- op_rows[[2]]$fnr
# %% Conditions
groups <- if (!is.null(gc)) levels(df[[gc]]) else character(0)
gcol <- if (!is.null(gc)) as.character(df[[gc]]) else NULL
g_rows <- list()
g_curves <- list()
for (lv in groups) {
m <- gcol == lv
nt <- sum(pos & m)
nn <- sum(!pos & m)
if (nt == 0 || nn == 0) {
g_rows[[length(g_rows) + 1L]] <- list(group = lv, n_target = nt, n_nontarget = nn, eer = NULL, min_dcf = NULL)
next
}
r <- cs_verif_summary(s[m], pos[m], p_target, c_miss, c_fa, eer_method)
g_rows[[length(g_rows) + 1L]] <- list(group = lv, n_target = nt, n_nontarget = nn, eer = r$eer, min_dcf = r$min_dcf)
if (length(g_curves) < 7) g_curves[[length(g_curves) + 1L]] <- list(name = lv, pts = cs_verif_det_points(s[m], pos[m]))
}
# %% Assumptions
e_t <- res$eer * n_t
e_n <- res$eer * n_n
few <- min(e_t, e_n) < 30
assumptions <- list(
list(key = "held_out", label = "Scores come from a fixed system", status = "info",
detail = "Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance."),
list(key = "independence", label = "Trials are not independent", status = "info",
detail = "Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give."),
list(key = "errors", label = "Enough errors at the EER", status = if (few) "warn" else "pass",
detail = paste0(sprintf("About %.0f misses and %.0f false alarms at the EER", e_t, e_n),
if (few) "; with fewer than 30 of either the rates are rough (Doddington's rule of 30)." else "."))
)
if (res$eer > 0.5) warnings <- c(warnings, "The equal error rate is above 50%: higher scores go with different-source trials. Check the same-source level.")
# %% Result
pct <- sprintf("%.0f%%", conf * 100)
f3 <- function(v) if (is.null(v)) "—" else sprintf("%.3f", v)
fp <- function(v) if (is.null(v)) "—" else sprintf("%.2f%%", 100 * v)
values <- list(n = nrow(df), n_target = n_t, n_nontarget = n_n, target_level = target_level, p_target = prior,
c_miss = c_miss, c_fa = c_fa, eer_method = eer_method,
eer = res$eer, eer_low = ci$eer_low, eer_high = ci$eer_high, eer_threshold = res$eer_threshold,
min_dcf = res$min_dcf, min_dcf_low = ci$min_dcf_low, min_dcf_high = ci$min_dcf_high,
min_dcf_threshold = res$min_dcf_threshold, min_dcf_fpr = res$min_dcf_fpr, min_dcf_fnr = res$min_dcf_fnr,
actual_threshold = res$actual_threshold, actual_dcf = res$actual_dcf, actual_fpr = res$actual_fpr,
actual_fnr = res$actual_fnr, cllr = res$cllr, fnr_at_fpr_01 = fnr_01, n_groups = length(groups))
metric_rows <- list(
list(measure = "Equal error rate (EER)", value = res$eer, low = ci$eer_low, high = ci$eer_high,
threshold = res$eer_threshold, fpr = res$eer, fnr = res$eer),
list(measure = "Minimum DCF (threshold picked on these trials)", value = res$min_dcf, low = ci$min_dcf_low,
high = ci$min_dcf_high, threshold = res$min_dcf_threshold, fpr = res$min_dcf_fpr, fnr = res$min_dcf_fnr)
)
if (!is.null(res$actual_dcf)) metric_rows[[length(metric_rows) + 1L]] <- list(
measure = if (llr) "Actual DCF (Bayes threshold)" else "Actual DCF (fixed threshold)", value = res$actual_dcf,
low = NULL, high = NULL, threshold = res$actual_threshold, fpr = res$actual_fpr, fnr = res$actual_fnr)
if (!is.null(res$cllr)) metric_rows[[length(metric_rows) + 1L]] <- list(
measure = "Cllr (bits)", value = res$cllr, low = NULL, high = NULL, threshold = NULL, fpr = NULL, fnr = NULL)
tables <- list(
list(key = "metrics", title = sprintf("Verification metrics (%s intervals from resampling trials)", pct),
columns = list(list(key = "measure", label = "Measure", type = "string"), list(key = "value", label = "Value", type = "number"),
list(key = "low", label = paste(pct, "CI low"), type = "number"), list(key = "high", label = paste(pct, "CI high"), type = "number"),
list(key = "threshold", label = "Threshold", type = "number"), list(key = "fpr", label = "False alarm rate", type = "number"),
list(key = "fnr", label = "Miss rate", type = "number")),
rows = metric_rows),
list(key = "operating_points", title = "Miss rate at fixed false alarm rates",
columns = list(list(key = "fpr_target", label = "False alarm rate at most", type = "number"), list(key = "fnr", label = "Miss rate", type = "number"),
list(key = "threshold", label = "Threshold", type = "number")),
rows = op_rows)
)
if (length(groups)) tables[[length(tables) + 1L]] <- list(key = "groups", title = sprintf("By %s", gc),
columns = list(list(key = "group", label = gc, type = "string"), list(key = "n_target", label = "Target trials", type = "integer"),
list(key = "n_nontarget", label = "Non-target trials", type = "integer"), list(key = "eer", label = "EER", type = "number"),
list(key = "min_dcf", label = "Minimum DCF", type = "number")),
rows = g_rows)
series <- c(list(list(name = "All trials", pts = pts)), g_curves)
det_f <- numeric(0)
det_m <- numeric(0)
det_s <- character(0)
for (se in series) {
inner <- which(is.finite(se$pts$threshold))
j <- inner[cs_verif_thin(length(inner))]
det_f <- c(det_f, se$pts$fpr[j])
det_m <- c(det_m, se$pts$fnr[j])
det_s <- c(det_s, rep(se$name, length(j)))
}
charts <- list(cs_chart("det", "det-curve", "Detection error tradeoff: miss rate against false alarm rate", list(
fpr = cs_col("False alarm rate (false accepts)", det_f),
fnr = cs_col("Miss rate (false rejects)", det_m),
model = cs_col("Trials", det_s, "categorical", levels = vapply(series, function(se) se$name, character(1)))),
controls = list(eer = res$eer, minDcf = res$min_dcf, minDcfFpr = res$min_dcf_fpr, minDcfFnr = res$min_dcf_fnr,
actualDcf = res$actual_dcf, actualFpr = res$actual_fpr, actualFnr = res$actual_fnr)))
keep <- cs_verif_thin(nrow(df), 20000L)
charts[[length(charts) + 1L]] <- cs_chart("scores", "density", "Scores of target and non-target trials", list(
x = cs_col(sc, s[keep]),
group = cs_col("Trial", ifelse(pos[keep], "Target", "Non-target"), "categorical", levels = c("Non-target", "Target"))),
controls = list(compare = FALSE))
summary <- sprintf("On %d target and %d non-target trials, the equal error rate was %s (%s CI %s to %s) and the minimum detection cost %s at π = %s, C_miss = %s, C_fa = %s.",
as.integer(n_t), as.integer(n_n), fp(res$eer), pct, fp(ci$eer_low), fp(ci$eer_high), f3(res$min_dcf),
format(prior, digits = 6), format(c_miss, digits = 6), format(c_fa, digits = 6))
if (!is.null(res$actual_dcf)) summary <- paste(summary, sprintf("At the %s threshold %s the actual cost was %s.",
if (llr) "Bayes" else "fixed", formatC(res$actual_threshold, digits = 3, format = "g"), f3(res$actual_dcf)))
if (!is.null(res$cllr)) summary <- paste(summary, sprintf("Cllr = %.3f bits.", res$cllr))
cs_publish(list(
method = "evaluate.verification",
methodVersion = "1.0.0",
title = "Verification scores",
engine = cs_engine_info("stats", "nanoparquet"),
n = nrow(df),
summary = summary,
statistics = list(list(key = "eer", label = "EER", value = res$eer, format = "percent"),
list(key = "min_dcf", label = "Minimum DCF", value = res$min_dcf),
list(key = "fnr_at_fpr_01", label = "Miss rate at 1% false alarms", value = fnr_01, format = "percent")),
tables = tables,
assumptions = assumptions,
warnings = warnings,
notes = list(paste0(sprintf("A trial is accepted when %s ≥ the threshold; target trials: %s = %s. ", sc, lc, target_level),
sprintf("EER: %s. ", if (eer_method == "linear") "linear interpolation on the operating points" else "the crossing on the ROC convex hull"),
sprintf("DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = %s", format(prior, digits = 6)),
if (is.null(p_target)) " (the share of target trials)." else ".",
sprintf(" Intervals: %d resamples of trials within each class on the shared seeded stream (seed %d).", reps, as.integer(seed)))),
charts = charts,
values = values
))
On 120 target and 480 non-target trials, the equal error rate was 2.50% (95% CI 1.25% to 3.75%) and the minimum detection cost 0.308 at π = 0.01, C_miss = 1, C_fa = 1.
- EER
- 2.5%
- Minimum DCF
- 0.3083
- Miss rate at 1% false alarms
- 14.2%
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Scores come from a fixed system — Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance.
- Trials are not independent — Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give.
- Enough errors at the EER — About 3 misses and 12 false alarms at the EER; with fewer than 30 of either the rates are rough (Doddington's rule of 30).
Verification metrics (95% intervals from resampling trials)
| Measure | Value | 95% CI low | 95% CI high | Threshold | False alarm rate | Miss rate |
|---|---|---|---|---|---|---|
| Equal error rate (EER) | 0.0250 | 0.0125 | 0.0375 | 0.4360 | 0.0250 | 0.0250 |
| Minimum DCF (threshold picked on these trials) | 0.3083 | 0.1167 | 0.3896 | 0.5620 | 0 | 0.3083 |
Miss rate at fixed false alarm rates
| False alarm rate at most | Miss rate | Threshold |
|---|---|---|
| 0.0010 | 0.3083 | 0.5620 |
| 0.0100 | 0.1417 | 0.5020 |
| 0.0500 | 0.0083 | 0.3890 |
| 0.1000 | 0 | 0.3360 |
- A trial is accepted when cosine ≥ the threshold; target trials: same = true. EER: linear interpolation on the operating points. DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = 0.01. Intervals: 1000 resamples of trials within each class on the shared seeded stream (seed 42).
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Evaluate verification scores (EER, DCF, DET)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method evaluate.verification 1.0.0 · spec b3990d6ff44d22ee
# Dataset: aud3_trials (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import math
import numpy as np
import pandas as pd
import codesplash as cs
from codesplash.errors import check_groups
from codesplash.evaluate import verification as vf # DET points, EER, DCF, Cllr (twin: codesplashr cs_verif_*)
# %% Data
df = pd.read_parquet("tests/parity/fixtures/aud3_trials.parquet", columns=["cosine", "same"])
n_input = len(df)
df["same"] = pd.Categorical(df["same"], categories=["false", "true"]) # stored level order
df = df.dropna(subset=["cosine", "same"]) # listwise deletion over the analysis columns
df["same"] = df["same"].cat.remove_unused_categories()
n_dropped = n_input - len(df)
warnings = []
if n_dropped:
warnings.append(cs.cs_warning("CS_W_ROWS_DROPPED", dropped=n_dropped, total=n_input))
if n_input and not len(df):
cs.cs_error("CS_E_NO_ROWS")
cs.check_finite_columns(df, ["cosine", "same"]) # infinite values stop the run (registry/errors.yaml)
# %% Trials
sc, lc = "cosine", "same"
gc = None
present = [str(v) for v in df[lc].cat.categories] # levels with data, in stored order
check_groups(df[lc], lc, minimum=2, exactly=2)
target_level = present[-1] # default: the last level ("true")
s = df[sc].to_numpy(dtype=float)
pos = (df[lc].astype(str) == target_level).to_numpy()
p_target = 0.01 # None: the share of target trials
c_miss, c_fa = 1, 1
eer_method = "linear" # linear | rocch
llr = False
fixed_threshold = None
reps = int(1000)
conf = 0.95
seed = 42 # portable Wichmann–Hill stream: R resamples the same trials
# %% Verification metrics
res = vf.summary(s, pos, p_target, c_miss, c_fa, eer_method, None if llr else fixed_threshold, llr)
ci = vf.bootstrap(s, pos, reps, seed, conf, p_target, c_miss, c_fa, eer_method)
pts = vf.det_points(s, pos)
prior = res["prior"]
n_t, n_n = res["n_target"], res["n_nontarget"]
op_rows = []
for target in (0.001, 0.01, 0.05, 0.1):
fnr_t, thr_t = vf.fnr_at_fpr(pts, target)
op_rows.append({"fpr_target": target, "fnr": fnr_t, "threshold": thr_t})
fnr_01 = op_rows[1]["fnr"]
# %% Conditions
groups = [str(v) for v in df[gc].cat.categories] if gc else []
gcol = df[gc].astype(str).to_numpy() if gc else None
g_rows, g_curves = [], []
for lv in groups:
m = gcol == lv
nt, nn = int(np.sum(pos & m)), int(np.sum(~pos & m))
if nt == 0 or nn == 0:
g_rows.append({"group": lv, "n_target": nt, "n_nontarget": nn, "eer": None, "min_dcf": None})
continue
r = vf.summary(s[m], pos[m], p_target, c_miss, c_fa, eer_method)
g_rows.append({"group": lv, "n_target": nt, "n_nontarget": nn, "eer": r["eer"], "min_dcf": r["min_dcf"]})
if len(g_curves) < 7:
g_curves.append((lv, vf.det_points(s[m], pos[m])))
# %% Assumptions
e_t, e_n = res["eer"] * n_t, res["eer"] * n_n
few = min(e_t, e_n) < 30
assumptions = [
{"key": "held_out", "label": "Scores come from a fixed system", "status": "info",
"detail": "Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance."},
{"key": "independence", "label": "Trials are not independent", "status": "info",
"detail": "Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give."},
{"key": "errors", "label": "Enough errors at the EER", "status": "warn" if few else "pass",
"detail": f"About {e_t:.0f} misses and {e_n:.0f} false alarms at the EER" + ("; with fewer than 30 of either the rates are rough (Doddington's rule of 30)." if few else ".")},
]
if res["eer"] > 0.5:
warnings.append("The equal error rate is above 50%: higher scores go with different-source trials. Check the same-source level.")
# %% Result
pct = f"{conf:.0%}"
f3 = lambda v: "—" if v is None else f"{v:.3f}"
fp = lambda v: "—" if v is None else f"{100 * v:.2f}%"
values = {"n": int(len(df)), "n_target": n_t, "n_nontarget": n_n, "target_level": target_level, "p_target": prior,
"c_miss": c_miss, "c_fa": c_fa, "eer_method": eer_method,
"eer": res["eer"], "eer_low": ci["eer_low"], "eer_high": ci["eer_high"], "eer_threshold": res["eer_threshold"],
"min_dcf": res["min_dcf"], "min_dcf_low": ci["min_dcf_low"], "min_dcf_high": ci["min_dcf_high"],
"min_dcf_threshold": res["min_dcf_threshold"], "min_dcf_fpr": res["min_dcf_fpr"], "min_dcf_fnr": res["min_dcf_fnr"],
"actual_threshold": res["actual_threshold"], "actual_dcf": res["actual_dcf"], "actual_fpr": res["actual_fpr"],
"actual_fnr": res["actual_fnr"], "cllr": res["cllr"], "fnr_at_fpr_01": fnr_01, "n_groups": len(groups)}
metric_rows = [
{"measure": "Equal error rate (EER)", "value": res["eer"], "low": ci["eer_low"], "high": ci["eer_high"],
"threshold": res["eer_threshold"], "fpr": res["eer"], "fnr": res["eer"]},
{"measure": "Minimum DCF (threshold picked on these trials)", "value": res["min_dcf"], "low": ci["min_dcf_low"],
"high": ci["min_dcf_high"], "threshold": res["min_dcf_threshold"], "fpr": res["min_dcf_fpr"], "fnr": res["min_dcf_fnr"]},
]
if res["actual_dcf"] is not None:
metric_rows.append({"measure": "Actual DCF (Bayes threshold)" if llr else "Actual DCF (fixed threshold)", "value": res["actual_dcf"],
"low": None, "high": None, "threshold": res["actual_threshold"], "fpr": res["actual_fpr"], "fnr": res["actual_fnr"]})
if res["cllr"] is not None:
metric_rows.append({"measure": "Cllr (bits)", "value": res["cllr"], "low": None, "high": None, "threshold": None, "fpr": None, "fnr": None})
tables = [
{"key": "metrics", "title": f"Verification metrics ({pct} intervals from resampling trials)",
"columns": [{"key": "measure", "label": "Measure", "type": "string"}, {"key": "value", "label": "Value", "type": "number"},
{"key": "low", "label": f"{pct} CI low", "type": "number"}, {"key": "high", "label": f"{pct} CI high", "type": "number"},
{"key": "threshold", "label": "Threshold", "type": "number"}, {"key": "fpr", "label": "False alarm rate", "type": "number"},
{"key": "fnr", "label": "Miss rate", "type": "number"}],
"rows": metric_rows},
{"key": "operating_points", "title": "Miss rate at fixed false alarm rates",
"columns": [{"key": "fpr_target", "label": "False alarm rate at most", "type": "number"}, {"key": "fnr", "label": "Miss rate", "type": "number"},
{"key": "threshold", "label": "Threshold", "type": "number"}],
"rows": op_rows},
]
if groups:
tables.append({"key": "groups", "title": f"By {gc}",
"columns": [{"key": "group", "label": gc, "type": "string"}, {"key": "n_target", "label": "Target trials", "type": "integer"},
{"key": "n_nontarget", "label": "Non-target trials", "type": "integer"}, {"key": "eer", "label": "EER", "type": "number"},
{"key": "min_dcf", "label": "Minimum DCF", "type": "number"}],
"rows": g_rows})
series = [("All trials", pts)] + g_curves
det_f, det_m, det_s = [], [], []
for name, p in series:
inner = [i for i in range(p["threshold"].size) if math.isfinite(p["threshold"][i])]
for j in vf.thin(len(inner)):
det_f.append(float(p["fpr"][inner[j]]))
det_m.append(float(p["fnr"][inner[j]]))
det_s.append(name)
charts = [cs.chart("det", "det-curve", "Detection error tradeoff: miss rate against false alarm rate", {
"fpr": cs.col("False alarm rate (false accepts)", det_f),
"fnr": cs.col("Miss rate (false rejects)", det_m),
"model": cs.col("Trials", det_s, "categorical", levels=[name for name, _ in series])},
controls={"eer": res["eer"], "minDcf": res["min_dcf"], "minDcfFpr": res["min_dcf_fpr"], "minDcfFnr": res["min_dcf_fnr"],
"actualDcf": res["actual_dcf"], "actualFpr": res["actual_fpr"], "actualFnr": res["actual_fnr"]})]
keep = vf.thin(int(len(df)), 20000)
charts.append(cs.chart("scores", "density", "Scores of target and non-target trials", {
"x": cs.col(sc, [float(s[i]) for i in keep]),
"group": cs.col("Trial", ["Target" if pos[i] else "Non-target" for i in keep], "categorical", levels=["Non-target", "Target"])},
controls={"compare": False}))
summary = (f"On {n_t} target and {n_n} non-target trials, the equal error rate was {fp(res['eer'])} ({pct} CI {fp(ci['eer_low'])} to {fp(ci['eer_high'])}) "
f"and the minimum detection cost {f3(res['min_dcf'])} at π = {prior:g}, C_miss = {c_miss:g}, C_fa = {c_fa:g}.")
if res["actual_dcf"] is not None:
summary += f" At the {'Bayes' if llr else 'fixed'} threshold {res['actual_threshold']:.3g} the actual cost was {f3(res['actual_dcf'])}."
if res["cllr"] is not None:
summary += f" Cllr = {res['cllr']:.3f} bits."
cs.publish({
"method": "evaluate.verification",
"methodVersion": "1.0.0",
"title": "Verification scores",
"engine": cs.engine_info("pandas", "numpy"),
"n": int(len(df)),
"summary": summary,
"statistics": [{"key": "eer", "label": "EER", "value": res["eer"], "format": "percent"},
{"key": "min_dcf", "label": "Minimum DCF", "value": res["min_dcf"]},
{"key": "fnr_at_fpr_01", "label": "Miss rate at 1% false alarms", "value": fnr_01, "format": "percent"}],
"tables": tables,
"assumptions": assumptions,
"warnings": warnings,
"notes": [f"A trial is accepted when {sc} ≥ the threshold; target trials: {lc} = {target_level}. "
f"EER: {'linear interpolation on the operating points' if eer_method == 'linear' else 'the crossing on the ROC convex hull'}. "
f"DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = {prior:g}"
+ (" (the share of target trials)." if p_target is None else ".")
+ f" Intervals: {reps} resamples of trials within each class on the shared seeded stream (seed {seed})."],
"charts": charts,
"values": values,
})
The equal error rateEER of a set of trialsWhere misses and false alarms are equally common, with a bootstrap interval and the score threshold nearest the crossing. is where misses and false alarms are equally common, here 2.5% with an interval from 1.3% to 3.8%. The DET curve draws both error rates on normal-deviate axes, so the region of small errors that matters in practice is spread out. At 1% false alarms the system misses 14.2% of the targets (miss rate at a fixed false alarm rateMiss rate at 1% false alarmsThe share of target trials rejected when the threshold lets through at most 1% of non-target trials.).
The EER ignores two things a real deployment cares about: how often a trial is really a target, and what each error costs.
Check yourself
System A has an EER of 2% and system B of 3%. What can you conclude?
Show the answer
Answer: b
The EER is one point on each curve. DET curves can cross, and the operating point you need (say, 0.1% false alarms) may favor B.
The detection cost
ExploreThe detection costDetection cost at a stated priorMisses and false alarms weighted by their costs and the target prior π, normalized so 1 is accepting or rejecting all. weighs misses and false alarms by their costs and by the target prior π: how often a trial is a target where the system will be used. It is normalized so 1 is what the better of "accept everything" and "reject everything" costs. With π = 0.01 (NIST's speaker evaluations) false alarms dominate.
On 120 target and 480 non-target trials, the equal error rate was 2.17% (95% CI 1.08% to 3.20%) and the minimum detection cost 0.215 at π = 0.05, C_miss = 1, C_fa = 1.
- EER
- 2.2%
- Minimum DCF
- 0.2146
- Miss rate at 1% false alarms
- 14.2%
Plots
View data
| Miss rate (false rejects) | False alarm rate (false accepts) | Trials |
|---|---|---|
| 0 | 1 | All trials |
| 0 | 0.9979 | All trials |
| 0 | 0.9958 | All trials |
| 0 | 0.9938 | All trials |
| 0 | 0.9917 | All trials |
| 0 | 0.9896 | All trials |
| 0 | 0.9875 | All trials |
| 0 | 0.9854 | All trials |
| 0 | 0.9833 | All trials |
| 0 | 0.9812 | All trials |
| 0 | 0.9792 | All trials |
| 0 | 0.9771 | All trials |
| 0 | 0.9750 | All trials |
| 0 | 0.9729 | All trials |
| 0 | 0.9708 | All trials |
| 0 | 0.9667 | All trials |
| 0 | 0.9646 | All trials |
| 0 | 0.9625 | All trials |
| 0 | 0.9604 | All trials |
| 0 | 0.9583 | All trials |
| 0 | 0.9542 | All trials |
| 0 | 0.9521 | All trials |
| 0 | 0.9500 | All trials |
| 0 | 0.9479 | All trials |
| 0 | 0.9458 | All trials |
| 0 | 0.9437 | All trials |
| 0 | 0.9417 | All trials |
| 0 | 0.9396 | All trials |
| 0 | 0.9375 | All trials |
| 0 | 0.9333 | All trials |
| 0 | 0.9292 | All trials |
| 0 | 0.9229 | All trials |
| 0 | 0.9208 | All trials |
| 0 | 0.9187 | All trials |
| 0 | 0.9167 | All trials |
| 0 | 0.9146 | All trials |
| 0 | 0.9125 | All trials |
| 0 | 0.9104 | All trials |
| 0 | 0.9083 | All trials |
| 0 | 0.9063 | All trials |
| 0 | 0.9042 | All trials |
| 0 | 0.9021 | All trials |
| 0 | 0.9000 | All trials |
| 0 | 0.8979 | All trials |
| 0 | 0.8958 | All trials |
| 0 | 0.8917 | All trials |
| 0 | 0.8875 | All trials |
| 0 | 0.8833 | All trials |
| 0 | 0.8812 | All trials |
| 0 | 0.8792 | All trials |
| 0 | 0.8771 | All trials |
| 0 | 0.8729 | All trials |
| 0 | 0.8708 | All trials |
| 0 | 0.8667 | All trials |
| 0 | 0.8646 | All trials |
| 0 | 0.8625 | All trials |
| 0 | 0.8604 | All trials |
| 0 | 0.8562 | All trials |
| 0 | 0.8521 | All trials |
| 0 | 0.8500 | All trials |
First 60 of 898 rows.
View data
| Trial | cosine |
|---|---|
| Non-target | 0.2010 |
| Non-target | 0.3850 |
| Non-target | 0.3840 |
| Non-target | 0.2920 |
| Non-target | 0.1320 |
| Target | 0.7800 |
| Non-target | 0.0460 |
| Non-target | 0.2990 |
| Non-target | 0.1560 |
| Target | 0.5810 |
| Non-target | 0.1420 |
| Target | 0.7880 |
| Non-target | 0.2190 |
| Non-target | 0.3400 |
| Target | 0.6650 |
| Non-target | 0.1770 |
| Non-target | 0.2680 |
| Non-target | 0.1140 |
| Non-target | 0.1120 |
| Non-target | 0.1060 |
| Non-target | 0.0700 |
| Non-target | 0.1600 |
| Non-target | 0.0750 |
| Target | 0.5230 |
| Target | 0.7550 |
| Non-target | 0.1600 |
| Non-target | 0.0440 |
| Non-target | 0.2420 |
| Non-target | 0.2490 |
| Non-target | 0.1260 |
| Non-target | 0.2680 |
| Non-target | 0.2330 |
| Non-target | 0.1860 |
| Non-target | 0.2620 |
| Target | 0.7300 |
| Target | 0.6190 |
| Non-target | 0.0450 |
| Non-target | 0.1300 |
| Non-target | 0.1830 |
| Non-target | 0.1420 |
| Target | 0.6450 |
| Non-target | 0.3110 |
| Non-target | 0.2200 |
| Non-target | 0.2510 |
| Non-target | 0.2220 |
| Non-target | 0.4550 |
| Non-target | 0.2000 |
| Non-target | 0.2160 |
| Target | 0.7740 |
| Target | 0.5580 |
| Target | 0.7230 |
| Target | 0.8650 |
| Non-target | 0.2250 |
| Non-target | 0.1050 |
| Non-target | 0.2870 |
| Target | 0.5110 |
| Non-target | 0.1620 |
| Non-target | 0.1110 |
| Non-target | 0.1560 |
| Non-target | 0.0790 |
First 60 of 600 rows.
Assumptions
- Scores come from a fixed system — Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance.
- Trials are not independent — Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give.
- Enough errors at the EER — About 3 misses and 10 false alarms at the EER; with fewer than 30 of either the rates are rough (Doddington's rule of 30).
Verification metrics (95% intervals from resampling trials)
| Measure | Value | 95% CI low | 95% CI high | Threshold | False alarm rate | Miss rate |
|---|---|---|---|---|---|---|
| Equal error rate (EER) | 0.0217 | 0.0108 | 0.0320 | 0.4570 | 0.0217 | 0.0217 |
| Minimum DCF (threshold picked on these trials) | 0.2146 | 0.0989 | 0.3261 | 0.5210 | 0.0021 | 0.1750 |
Miss rate at fixed false alarm rates
| False alarm rate at most | Miss rate | Threshold |
|---|---|---|
| 0.0010 | 0.3083 | 0.5620 |
| 0.0100 | 0.1417 | 0.5020 |
| 0.0500 | 0.0083 | 0.3890 |
| 0.1000 | 0 | 0.3360 |
By channel
| channel | Target trials | Non-target trials | EER | Minimum DCF |
|---|---|---|---|---|
| phone | 42 | 187 | 0.0229 | 0.2143 |
| street | 32 | 121 | 0.0327 | 0.2813 |
| studio | 46 | 172 | 0 | 0 |
- A trial is accepted when cosine ≥ the threshold; target trials: same = true. EER: the crossing on the ROC convex hull. DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = 0.05. Intervals: 300 resamples of trials within each class on the shared seeded stream (seed 42).
The exact R script · R R version 4.5.1 (2025-06-13)
# Evaluate verification scores (EER, DCF, DET)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method evaluate.verification 1.0.0 · spec 0736c716424b298f
# Dataset: aud3_trials (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
library(codesplashr) # cs_verif_* (DET points, EER, DCF, Cllr)
# %% Data
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/aud3_trials.parquet", col_select = c("cosine", "same", "channel")))
n_input <- nrow(df)
df[["same"]] <- factor(df[["same"]], levels = c("false", "true")) # stored level order
df[["channel"]] <- factor(df[["channel"]], levels = c("phone", "street", "studio")) # stored level order
df <- df[stats::complete.cases(df[c("cosine", "same", "channel")]), , drop = FALSE] # listwise deletion
df[] <- lapply(df, function(x) if (is.factor(x)) droplevels(x) else x)
n_dropped <- n_input - nrow(df)
warnings <- list()
if (n_dropped > 0) {
warnings <- c(warnings, cs_warning("CS_W_ROWS_DROPPED", dropped = n_dropped, total = n_input))
}
if (n_input > 0 && nrow(df) == 0) cs_error("CS_E_NO_ROWS")
cs_check_finite_columns(df, c("cosine", "same", "channel")) # infinite values stop the run (registry/errors.yaml)
# %% Trials
sc <- "cosine"
lc <- "same"
gc <- "channel"
present <- levels(df[[lc]]) # levels with data, in stored order
cs_check_groups(df[[lc]], lc, minimum = 2, exactly = 2)
target_level <- present[length(present)] # default: the last level ("true")
s <- as.numeric(df[[sc]])
pos <- as.character(df[[lc]]) == target_level
p_target <- 0.05 # NULL: the share of target trials
c_miss <- 1
c_fa <- 1
eer_method <- "rocch" # linear | rocch
llr <- FALSE
fixed_threshold <- NULL
reps <- as.integer(300)
conf <- 0.95
seed <- 42 # portable Wichmann-Hill stream: Python resamples the same trials
# %% Verification metrics
res <- cs_verif_summary(s, pos, p_target, c_miss, c_fa, eer_method, if (llr) NULL else fixed_threshold, llr)
ci <- cs_verif_bootstrap(s, pos, reps, seed, conf, p_target, c_miss, c_fa, eer_method)
pts <- cs_verif_det_points(s, pos)
prior <- res$prior
n_t <- res$n_target
n_n <- res$n_nontarget
op_rows <- lapply(c(0.001, 0.01, 0.05, 0.1), function(target) {
o <- cs_verif_fnr_at_fpr(pts, target)
list(fpr_target = target, fnr = o$fnr, threshold = o$threshold)
})
fnr_01 <- op_rows[[2]]$fnr
# %% Conditions
groups <- if (!is.null(gc)) levels(df[[gc]]) else character(0)
gcol <- if (!is.null(gc)) as.character(df[[gc]]) else NULL
g_rows <- list()
g_curves <- list()
for (lv in groups) {
m <- gcol == lv
nt <- sum(pos & m)
nn <- sum(!pos & m)
if (nt == 0 || nn == 0) {
g_rows[[length(g_rows) + 1L]] <- list(group = lv, n_target = nt, n_nontarget = nn, eer = NULL, min_dcf = NULL)
next
}
r <- cs_verif_summary(s[m], pos[m], p_target, c_miss, c_fa, eer_method)
g_rows[[length(g_rows) + 1L]] <- list(group = lv, n_target = nt, n_nontarget = nn, eer = r$eer, min_dcf = r$min_dcf)
if (length(g_curves) < 7) g_curves[[length(g_curves) + 1L]] <- list(name = lv, pts = cs_verif_det_points(s[m], pos[m]))
}
# %% Assumptions
e_t <- res$eer * n_t
e_n <- res$eer * n_n
few <- min(e_t, e_n) < 30
assumptions <- list(
list(key = "held_out", label = "Scores come from a fixed system", status = "info",
detail = "Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance."),
list(key = "independence", label = "Trials are not independent", status = "info",
detail = "Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give."),
list(key = "errors", label = "Enough errors at the EER", status = if (few) "warn" else "pass",
detail = paste0(sprintf("About %.0f misses and %.0f false alarms at the EER", e_t, e_n),
if (few) "; with fewer than 30 of either the rates are rough (Doddington's rule of 30)." else "."))
)
if (res$eer > 0.5) warnings <- c(warnings, "The equal error rate is above 50%: higher scores go with different-source trials. Check the same-source level.")
# %% Result
pct <- sprintf("%.0f%%", conf * 100)
f3 <- function(v) if (is.null(v)) "—" else sprintf("%.3f", v)
fp <- function(v) if (is.null(v)) "—" else sprintf("%.2f%%", 100 * v)
values <- list(n = nrow(df), n_target = n_t, n_nontarget = n_n, target_level = target_level, p_target = prior,
c_miss = c_miss, c_fa = c_fa, eer_method = eer_method,
eer = res$eer, eer_low = ci$eer_low, eer_high = ci$eer_high, eer_threshold = res$eer_threshold,
min_dcf = res$min_dcf, min_dcf_low = ci$min_dcf_low, min_dcf_high = ci$min_dcf_high,
min_dcf_threshold = res$min_dcf_threshold, min_dcf_fpr = res$min_dcf_fpr, min_dcf_fnr = res$min_dcf_fnr,
actual_threshold = res$actual_threshold, actual_dcf = res$actual_dcf, actual_fpr = res$actual_fpr,
actual_fnr = res$actual_fnr, cllr = res$cllr, fnr_at_fpr_01 = fnr_01, n_groups = length(groups))
metric_rows <- list(
list(measure = "Equal error rate (EER)", value = res$eer, low = ci$eer_low, high = ci$eer_high,
threshold = res$eer_threshold, fpr = res$eer, fnr = res$eer),
list(measure = "Minimum DCF (threshold picked on these trials)", value = res$min_dcf, low = ci$min_dcf_low,
high = ci$min_dcf_high, threshold = res$min_dcf_threshold, fpr = res$min_dcf_fpr, fnr = res$min_dcf_fnr)
)
if (!is.null(res$actual_dcf)) metric_rows[[length(metric_rows) + 1L]] <- list(
measure = if (llr) "Actual DCF (Bayes threshold)" else "Actual DCF (fixed threshold)", value = res$actual_dcf,
low = NULL, high = NULL, threshold = res$actual_threshold, fpr = res$actual_fpr, fnr = res$actual_fnr)
if (!is.null(res$cllr)) metric_rows[[length(metric_rows) + 1L]] <- list(
measure = "Cllr (bits)", value = res$cllr, low = NULL, high = NULL, threshold = NULL, fpr = NULL, fnr = NULL)
tables <- list(
list(key = "metrics", title = sprintf("Verification metrics (%s intervals from resampling trials)", pct),
columns = list(list(key = "measure", label = "Measure", type = "string"), list(key = "value", label = "Value", type = "number"),
list(key = "low", label = paste(pct, "CI low"), type = "number"), list(key = "high", label = paste(pct, "CI high"), type = "number"),
list(key = "threshold", label = "Threshold", type = "number"), list(key = "fpr", label = "False alarm rate", type = "number"),
list(key = "fnr", label = "Miss rate", type = "number")),
rows = metric_rows),
list(key = "operating_points", title = "Miss rate at fixed false alarm rates",
columns = list(list(key = "fpr_target", label = "False alarm rate at most", type = "number"), list(key = "fnr", label = "Miss rate", type = "number"),
list(key = "threshold", label = "Threshold", type = "number")),
rows = op_rows)
)
if (length(groups)) tables[[length(tables) + 1L]] <- list(key = "groups", title = sprintf("By %s", gc),
columns = list(list(key = "group", label = gc, type = "string"), list(key = "n_target", label = "Target trials", type = "integer"),
list(key = "n_nontarget", label = "Non-target trials", type = "integer"), list(key = "eer", label = "EER", type = "number"),
list(key = "min_dcf", label = "Minimum DCF", type = "number")),
rows = g_rows)
series <- c(list(list(name = "All trials", pts = pts)), g_curves)
det_f <- numeric(0)
det_m <- numeric(0)
det_s <- character(0)
for (se in series) {
inner <- which(is.finite(se$pts$threshold))
j <- inner[cs_verif_thin(length(inner))]
det_f <- c(det_f, se$pts$fpr[j])
det_m <- c(det_m, se$pts$fnr[j])
det_s <- c(det_s, rep(se$name, length(j)))
}
charts <- list(cs_chart("det", "det-curve", "Detection error tradeoff: miss rate against false alarm rate", list(
fpr = cs_col("False alarm rate (false accepts)", det_f),
fnr = cs_col("Miss rate (false rejects)", det_m),
model = cs_col("Trials", det_s, "categorical", levels = vapply(series, function(se) se$name, character(1)))),
controls = list(eer = res$eer, minDcf = res$min_dcf, minDcfFpr = res$min_dcf_fpr, minDcfFnr = res$min_dcf_fnr,
actualDcf = res$actual_dcf, actualFpr = res$actual_fpr, actualFnr = res$actual_fnr)))
keep <- cs_verif_thin(nrow(df), 20000L)
charts[[length(charts) + 1L]] <- cs_chart("scores", "density", "Scores of target and non-target trials", list(
x = cs_col(sc, s[keep]),
group = cs_col("Trial", ifelse(pos[keep], "Target", "Non-target"), "categorical", levels = c("Non-target", "Target"))),
controls = list(compare = FALSE))
summary <- sprintf("On %d target and %d non-target trials, the equal error rate was %s (%s CI %s to %s) and the minimum detection cost %s at π = %s, C_miss = %s, C_fa = %s.",
as.integer(n_t), as.integer(n_n), fp(res$eer), pct, fp(ci$eer_low), fp(ci$eer_high), f3(res$min_dcf),
format(prior, digits = 6), format(c_miss, digits = 6), format(c_fa, digits = 6))
if (!is.null(res$actual_dcf)) summary <- paste(summary, sprintf("At the %s threshold %s the actual cost was %s.",
if (llr) "Bayes" else "fixed", formatC(res$actual_threshold, digits = 3, format = "g"), f3(res$actual_dcf)))
if (!is.null(res$cllr)) summary <- paste(summary, sprintf("Cllr = %.3f bits.", res$cllr))
cs_publish(list(
method = "evaluate.verification",
methodVersion = "1.0.0",
title = "Verification scores",
engine = cs_engine_info("stats", "nanoparquet"),
n = nrow(df),
summary = summary,
statistics = list(list(key = "eer", label = "EER", value = res$eer, format = "percent"),
list(key = "min_dcf", label = "Minimum DCF", value = res$min_dcf),
list(key = "fnr_at_fpr_01", label = "Miss rate at 1% false alarms", value = fnr_01, format = "percent")),
tables = tables,
assumptions = assumptions,
warnings = warnings,
notes = list(paste0(sprintf("A trial is accepted when %s ≥ the threshold; target trials: %s = %s. ", sc, lc, target_level),
sprintf("EER: %s. ", if (eer_method == "linear") "linear interpolation on the operating points" else "the crossing on the ROC convex hull"),
sprintf("DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = %s", format(prior, digits = 6)),
if (is.null(p_target)) " (the share of target trials)." else ".",
sprintf(" Intervals: %d resamples of trials within each class on the shared seeded stream (seed %d).", reps, as.integer(seed)))),
charts = charts,
values = values
))
On 120 target and 480 non-target trials, the equal error rate was 2.17% (95% CI 1.08% to 3.20%) and the minimum detection cost 0.215 at π = 0.05, C_miss = 1, C_fa = 1.
- EER
- 2.2%
- Minimum DCF
- 0.2146
- Miss rate at 1% false alarms
- 14.2%
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Scores come from a fixed system — Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance.
- Trials are not independent — Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give.
- Enough errors at the EER — About 3 misses and 10 false alarms at the EER; with fewer than 30 of either the rates are rough (Doddington's rule of 30).
Verification metrics (95% intervals from resampling trials)
| Measure | Value | 95% CI low | 95% CI high | Threshold | False alarm rate | Miss rate |
|---|---|---|---|---|---|---|
| Equal error rate (EER) | 0.0217 | 0.0108 | 0.0320 | 0.4570 | 0.0217 | 0.0217 |
| Minimum DCF (threshold picked on these trials) | 0.2146 | 0.0989 | 0.3261 | 0.5210 | 0.0021 | 0.1750 |
Miss rate at fixed false alarm rates
| False alarm rate at most | Miss rate | Threshold |
|---|---|---|
| 0.0010 | 0.3083 | 0.5620 |
| 0.0100 | 0.1417 | 0.5020 |
| 0.0500 | 0.0083 | 0.3890 |
| 0.1000 | 0 | 0.3360 |
By channel
| channel | Target trials | Non-target trials | EER | Minimum DCF |
|---|---|---|---|---|
| phone | 42 | 187 | 0.0229 | 0.2143 |
| street | 32 | 121 | 0.0327 | 0.2813 |
| studio | 46 | 172 | 0 | 0 |
- A trial is accepted when cosine ≥ the threshold; target trials: same = true. EER: the crossing on the ROC convex hull. DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = 0.05. Intervals: 300 resamples of trials within each class on the shared seeded stream (seed 42).
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Evaluate verification scores (EER, DCF, DET)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method evaluate.verification 1.0.0 · spec 0736c716424b298f
# Dataset: aud3_trials (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import math
import numpy as np
import pandas as pd
import codesplash as cs
from codesplash.errors import check_groups
from codesplash.evaluate import verification as vf # DET points, EER, DCF, Cllr (twin: codesplashr cs_verif_*)
# %% Data
df = pd.read_parquet("tests/parity/fixtures/aud3_trials.parquet", columns=["cosine", "same", "channel"])
n_input = len(df)
df["same"] = pd.Categorical(df["same"], categories=["false", "true"]) # stored level order
df["channel"] = pd.Categorical(df["channel"], categories=["phone", "street", "studio"]) # stored level order
df = df.dropna(subset=["cosine", "same", "channel"]) # listwise deletion over the analysis columns
df["same"] = df["same"].cat.remove_unused_categories()
df["channel"] = df["channel"].cat.remove_unused_categories()
n_dropped = n_input - len(df)
warnings = []
if n_dropped:
warnings.append(cs.cs_warning("CS_W_ROWS_DROPPED", dropped=n_dropped, total=n_input))
if n_input and not len(df):
cs.cs_error("CS_E_NO_ROWS")
cs.check_finite_columns(df, ["cosine", "same", "channel"]) # infinite values stop the run (registry/errors.yaml)
# %% Trials
sc, lc = "cosine", "same"
gc = "channel"
present = [str(v) for v in df[lc].cat.categories] # levels with data, in stored order
check_groups(df[lc], lc, minimum=2, exactly=2)
target_level = present[-1] # default: the last level ("true")
s = df[sc].to_numpy(dtype=float)
pos = (df[lc].astype(str) == target_level).to_numpy()
p_target = 0.05 # None: the share of target trials
c_miss, c_fa = 1, 1
eer_method = "rocch" # linear | rocch
llr = False
fixed_threshold = None
reps = int(300)
conf = 0.95
seed = 42 # portable Wichmann–Hill stream: R resamples the same trials
# %% Verification metrics
res = vf.summary(s, pos, p_target, c_miss, c_fa, eer_method, None if llr else fixed_threshold, llr)
ci = vf.bootstrap(s, pos, reps, seed, conf, p_target, c_miss, c_fa, eer_method)
pts = vf.det_points(s, pos)
prior = res["prior"]
n_t, n_n = res["n_target"], res["n_nontarget"]
op_rows = []
for target in (0.001, 0.01, 0.05, 0.1):
fnr_t, thr_t = vf.fnr_at_fpr(pts, target)
op_rows.append({"fpr_target": target, "fnr": fnr_t, "threshold": thr_t})
fnr_01 = op_rows[1]["fnr"]
# %% Conditions
groups = [str(v) for v in df[gc].cat.categories] if gc else []
gcol = df[gc].astype(str).to_numpy() if gc else None
g_rows, g_curves = [], []
for lv in groups:
m = gcol == lv
nt, nn = int(np.sum(pos & m)), int(np.sum(~pos & m))
if nt == 0 or nn == 0:
g_rows.append({"group": lv, "n_target": nt, "n_nontarget": nn, "eer": None, "min_dcf": None})
continue
r = vf.summary(s[m], pos[m], p_target, c_miss, c_fa, eer_method)
g_rows.append({"group": lv, "n_target": nt, "n_nontarget": nn, "eer": r["eer"], "min_dcf": r["min_dcf"]})
if len(g_curves) < 7:
g_curves.append((lv, vf.det_points(s[m], pos[m])))
# %% Assumptions
e_t, e_n = res["eer"] * n_t, res["eer"] * n_n
few = min(e_t, e_n) < 30
assumptions = [
{"key": "held_out", "label": "Scores come from a fixed system", "status": "info",
"detail": "Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance."},
{"key": "independence", "label": "Trials are not independent", "status": "info",
"detail": "Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give."},
{"key": "errors", "label": "Enough errors at the EER", "status": "warn" if few else "pass",
"detail": f"About {e_t:.0f} misses and {e_n:.0f} false alarms at the EER" + ("; with fewer than 30 of either the rates are rough (Doddington's rule of 30)." if few else ".")},
]
if res["eer"] > 0.5:
warnings.append("The equal error rate is above 50%: higher scores go with different-source trials. Check the same-source level.")
# %% Result
pct = f"{conf:.0%}"
f3 = lambda v: "—" if v is None else f"{v:.3f}"
fp = lambda v: "—" if v is None else f"{100 * v:.2f}%"
values = {"n": int(len(df)), "n_target": n_t, "n_nontarget": n_n, "target_level": target_level, "p_target": prior,
"c_miss": c_miss, "c_fa": c_fa, "eer_method": eer_method,
"eer": res["eer"], "eer_low": ci["eer_low"], "eer_high": ci["eer_high"], "eer_threshold": res["eer_threshold"],
"min_dcf": res["min_dcf"], "min_dcf_low": ci["min_dcf_low"], "min_dcf_high": ci["min_dcf_high"],
"min_dcf_threshold": res["min_dcf_threshold"], "min_dcf_fpr": res["min_dcf_fpr"], "min_dcf_fnr": res["min_dcf_fnr"],
"actual_threshold": res["actual_threshold"], "actual_dcf": res["actual_dcf"], "actual_fpr": res["actual_fpr"],
"actual_fnr": res["actual_fnr"], "cllr": res["cllr"], "fnr_at_fpr_01": fnr_01, "n_groups": len(groups)}
metric_rows = [
{"measure": "Equal error rate (EER)", "value": res["eer"], "low": ci["eer_low"], "high": ci["eer_high"],
"threshold": res["eer_threshold"], "fpr": res["eer"], "fnr": res["eer"]},
{"measure": "Minimum DCF (threshold picked on these trials)", "value": res["min_dcf"], "low": ci["min_dcf_low"],
"high": ci["min_dcf_high"], "threshold": res["min_dcf_threshold"], "fpr": res["min_dcf_fpr"], "fnr": res["min_dcf_fnr"]},
]
if res["actual_dcf"] is not None:
metric_rows.append({"measure": "Actual DCF (Bayes threshold)" if llr else "Actual DCF (fixed threshold)", "value": res["actual_dcf"],
"low": None, "high": None, "threshold": res["actual_threshold"], "fpr": res["actual_fpr"], "fnr": res["actual_fnr"]})
if res["cllr"] is not None:
metric_rows.append({"measure": "Cllr (bits)", "value": res["cllr"], "low": None, "high": None, "threshold": None, "fpr": None, "fnr": None})
tables = [
{"key": "metrics", "title": f"Verification metrics ({pct} intervals from resampling trials)",
"columns": [{"key": "measure", "label": "Measure", "type": "string"}, {"key": "value", "label": "Value", "type": "number"},
{"key": "low", "label": f"{pct} CI low", "type": "number"}, {"key": "high", "label": f"{pct} CI high", "type": "number"},
{"key": "threshold", "label": "Threshold", "type": "number"}, {"key": "fpr", "label": "False alarm rate", "type": "number"},
{"key": "fnr", "label": "Miss rate", "type": "number"}],
"rows": metric_rows},
{"key": "operating_points", "title": "Miss rate at fixed false alarm rates",
"columns": [{"key": "fpr_target", "label": "False alarm rate at most", "type": "number"}, {"key": "fnr", "label": "Miss rate", "type": "number"},
{"key": "threshold", "label": "Threshold", "type": "number"}],
"rows": op_rows},
]
if groups:
tables.append({"key": "groups", "title": f"By {gc}",
"columns": [{"key": "group", "label": gc, "type": "string"}, {"key": "n_target", "label": "Target trials", "type": "integer"},
{"key": "n_nontarget", "label": "Non-target trials", "type": "integer"}, {"key": "eer", "label": "EER", "type": "number"},
{"key": "min_dcf", "label": "Minimum DCF", "type": "number"}],
"rows": g_rows})
series = [("All trials", pts)] + g_curves
det_f, det_m, det_s = [], [], []
for name, p in series:
inner = [i for i in range(p["threshold"].size) if math.isfinite(p["threshold"][i])]
for j in vf.thin(len(inner)):
det_f.append(float(p["fpr"][inner[j]]))
det_m.append(float(p["fnr"][inner[j]]))
det_s.append(name)
charts = [cs.chart("det", "det-curve", "Detection error tradeoff: miss rate against false alarm rate", {
"fpr": cs.col("False alarm rate (false accepts)", det_f),
"fnr": cs.col("Miss rate (false rejects)", det_m),
"model": cs.col("Trials", det_s, "categorical", levels=[name for name, _ in series])},
controls={"eer": res["eer"], "minDcf": res["min_dcf"], "minDcfFpr": res["min_dcf_fpr"], "minDcfFnr": res["min_dcf_fnr"],
"actualDcf": res["actual_dcf"], "actualFpr": res["actual_fpr"], "actualFnr": res["actual_fnr"]})]
keep = vf.thin(int(len(df)), 20000)
charts.append(cs.chart("scores", "density", "Scores of target and non-target trials", {
"x": cs.col(sc, [float(s[i]) for i in keep]),
"group": cs.col("Trial", ["Target" if pos[i] else "Non-target" for i in keep], "categorical", levels=["Non-target", "Target"])},
controls={"compare": False}))
summary = (f"On {n_t} target and {n_n} non-target trials, the equal error rate was {fp(res['eer'])} ({pct} CI {fp(ci['eer_low'])} to {fp(ci['eer_high'])}) "
f"and the minimum detection cost {f3(res['min_dcf'])} at π = {prior:g}, C_miss = {c_miss:g}, C_fa = {c_fa:g}.")
if res["actual_dcf"] is not None:
summary += f" At the {'Bayes' if llr else 'fixed'} threshold {res['actual_threshold']:.3g} the actual cost was {f3(res['actual_dcf'])}."
if res["cllr"] is not None:
summary += f" Cllr = {res['cllr']:.3f} bits."
cs.publish({
"method": "evaluate.verification",
"methodVersion": "1.0.0",
"title": "Verification scores",
"engine": cs.engine_info("pandas", "numpy"),
"n": int(len(df)),
"summary": summary,
"statistics": [{"key": "eer", "label": "EER", "value": res["eer"], "format": "percent"},
{"key": "min_dcf", "label": "Minimum DCF", "value": res["min_dcf"]},
{"key": "fnr_at_fpr_01", "label": "Miss rate at 1% false alarms", "value": fnr_01, "format": "percent"}],
"tables": tables,
"assumptions": assumptions,
"warnings": warnings,
"notes": [f"A trial is accepted when {sc} ≥ the threshold; target trials: {lc} = {target_level}. "
f"EER: {'linear interpolation on the operating points' if eer_method == 'linear' else 'the crossing on the ROC convex hull'}. "
f"DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = {prior:g}"
+ (" (the share of target trials)." if p_target is None else ".")
+ f" Intervals: {reps} resamples of trials within each class on the shared seeded stream (seed {seed})."],
"charts": charts,
"values": values,
})
At π = 0.05 the minimum cost is 0.215. Its threshold is picked on these same trials, so it is optimistic. This run reads the EER on the ROC convex hullROC convex hull EERThe EER read on the ROC convex hull (NIST, BOSARIS); never above the EER interpolated between operating points. (2.2%), as NIST and BOSARIS do; it is never above the linear EER. The table by channel (verification by conditionVerification by conditionThe EER and minimum DCF within each level of a condition column (channel, language, gender).) shows the street channel doing worst.
Check yourself
A door lock accepts a voice at most a few times a day, but impostors try often. You lower the target prior π from 0.5 to 0.01. What happens to the threshold that minimizes the cost?
Show the answer
Answer: a
With few targets, most errors would be false alarms, so the best threshold moves up and accepts fewer non-targets at the price of more misses.
Calibrated scores and the actual cost
CheckpointOn 120 target and 480 non-target trials, the equal error rate was 9.17% (90% CI 6.67% to 11.67%) and the minimum detection cost 0.428 at π = 0.01, C_miss = 10, C_fa = 1. At the Bayes threshold 2.29 the actual cost was 0.465. Cllr = 0.288 bits.
- EER
- 9.2%
- Minimum DCF
- 0.4281
- Miss rate at 1% false alarms
- 35.0%
Plots
View data
| Miss rate (false rejects) | False alarm rate (false accepts) | Trials |
|---|---|---|
| 0 | 1 | All trials |
| 0 | 0.9979 | All trials |
| 0 | 0.9958 | All trials |
| 0 | 0.9917 | All trials |
| 0 | 0.9896 | All trials |
| 0 | 0.9854 | All trials |
| 0 | 0.9833 | All trials |
| 0 | 0.9792 | All trials |
| 0 | 0.9771 | All trials |
| 0 | 0.9729 | All trials |
| 0 | 0.9708 | All trials |
| 0 | 0.9667 | All trials |
| 0 | 0.9646 | All trials |
| 0 | 0.9604 | All trials |
| 0 | 0.9583 | All trials |
| 0 | 0.9563 | All trials |
| 0 | 0.9521 | All trials |
| 0 | 0.9500 | All trials |
| 0 | 0.9437 | All trials |
| 0 | 0.9417 | All trials |
| 0 | 0.9375 | All trials |
| 0 | 0.9354 | All trials |
| 0 | 0.9313 | All trials |
| 0 | 0.9292 | All trials |
| 0 | 0.9250 | All trials |
| 0 | 0.9229 | All trials |
| 0 | 0.9187 | All trials |
| 0 | 0.9167 | All trials |
| 0 | 0.9146 | All trials |
| 0 | 0.9104 | All trials |
| 0 | 0.9083 | All trials |
| 0 | 0.9042 | All trials |
| 0 | 0.9021 | All trials |
| 0 | 0.8979 | All trials |
| 0 | 0.8958 | All trials |
| 0 | 0.8917 | All trials |
| 0 | 0.8896 | All trials |
| 0 | 0.8854 | All trials |
| 0 | 0.8833 | All trials |
| 0 | 0.8792 | All trials |
| 0 | 0.8771 | All trials |
| 0 | 0.8729 | All trials |
| 0 | 0.8708 | All trials |
| 0 | 0.8688 | All trials |
| 0 | 0.8646 | All trials |
| 0 | 0.8625 | All trials |
| 0 | 0.8583 | All trials |
| 0 | 0.8562 | All trials |
| 0 | 0.8521 | All trials |
| 0 | 0.8500 | All trials |
| 0 | 0.8458 | All trials |
| 0 | 0.8438 | All trials |
| 0 | 0.8396 | All trials |
| 0 | 0.8375 | All trials |
| 0 | 0.8333 | All trials |
| 0 | 0.8313 | All trials |
| 0 | 0.8292 | All trials |
| 0 | 0.8250 | All trials |
| 0 | 0.8229 | All trials |
| 0 | 0.8187 | All trials |
First 60 of 400 rows.
View data
| Trial | llr |
|---|---|
| Non-target | −3.387 |
| Non-target | −5.974 |
| Non-target | −0.8540 |
| Non-target | −6.077 |
| Non-target | −2.228 |
| Target | 2.975 |
| Non-target | −1.746 |
| Non-target | −4.949 |
| Non-target | −5.678 |
| Target | 1.051 |
| Non-target | −6.414 |
| Target | 10.310 |
| Non-target | −2.312 |
| Non-target | −2.765 |
| Target | 2.883 |
| Non-target | −0.4560 |
| Non-target | −0.6980 |
| Non-target | −4.581 |
| Non-target | −8.890 |
| Non-target | −6.491 |
| Non-target | −5.173 |
| Non-target | −5.700 |
| Non-target | −7.267 |
| Target | 7.060 |
| Target | 8.475 |
| Non-target | −0.7700 |
| Non-target | −6.676 |
| Non-target | −6.606 |
| Non-target | −0.7430 |
| Non-target | −8.244 |
| Non-target | −4.478 |
| Non-target | −3.849 |
| Non-target | −2.123 |
| Non-target | −8.780 |
| Target | 4.886 |
| Target | 4.661 |
| Non-target | −0.9680 |
| Non-target | −3.335 |
| Non-target | −10.633 |
| Non-target | −1.832 |
| Target | 2.942 |
| Non-target | −2.364 |
| Non-target | −5.962 |
| Non-target | −6.581 |
| Non-target | 2.868 |
| Non-target | −3.199 |
| Non-target | −9.412 |
| Non-target | −9.190 |
| Target | −0.4880 |
| Target | 6.079 |
| Target | 2.815 |
| Target | 1.100 |
| Non-target | −3.603 |
| Non-target | −0.2690 |
| Non-target | −3.517 |
| Target | −0.2490 |
| Non-target | −3.616 |
| Non-target | −2.606 |
| Non-target | 0.5710 |
| Non-target | −9.110 |
First 60 of 600 rows.
Assumptions
- Scores come from a fixed system — Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance.
- Trials are not independent — Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give.
- Enough errors at the EER — About 11 misses and 44 false alarms at the EER; with fewer than 30 of either the rates are rough (Doddington's rule of 30).
Verification metrics (90% intervals from resampling trials)
| Measure | Value | 90% CI low | 90% CI high | Threshold | False alarm rate | Miss rate |
|---|---|---|---|---|---|---|
| Equal error rate (EER) | 0.0917 | 0.0667 | 0.1167 | −0.2490 | 0.0917 | 0.0917 |
| Minimum DCF (threshold picked on these trials) | 0.4281 | 0.3039 | 0.4752 | 2.578 | 0.0104 | 0.3250 |
| Actual DCF (Bayes threshold) | 0.4650 | — | — | 2.293 | 0.0167 | 0.3000 |
| Cllr (bits) | 0.2878 | — | — | — | — | — |
Miss rate at fixed false alarm rates
| False alarm rate at most | Miss rate | Threshold |
|---|---|---|
| 0.0010 | 0.4917 | 3.706 |
| 0.0100 | 0.3500 | 2.728 |
| 0.0500 | 0.1250 | 0.6190 |
| 0.1000 | 0.0750 | −0.3890 |
- A trial is accepted when llr ≥ the threshold; target trials: trial = target. EER: linear interpolation on the operating points. DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = 0.01. Intervals: 300 resamples of trials within each class on the shared seeded stream (seed 42).
The exact R script · R R version 4.5.1 (2025-06-13)
# Evaluate verification scores (EER, DCF, DET)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method evaluate.verification 1.0.0 · spec 7fb1fc1e4972182d
# Dataset: aud3_trials (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
library(codesplashr) # cs_verif_* (DET points, EER, DCF, Cllr)
# %% Data
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/aud3_trials.parquet", col_select = c("llr", "trial")))
n_input <- nrow(df)
df[["trial"]] <- factor(df[["trial"]], levels = c("nontarget", "target")) # stored level order
df <- df[stats::complete.cases(df[c("llr", "trial")]), , drop = FALSE] # listwise deletion
df[] <- lapply(df, function(x) if (is.factor(x)) droplevels(x) else x)
n_dropped <- n_input - nrow(df)
warnings <- list()
if (n_dropped > 0) {
warnings <- c(warnings, cs_warning("CS_W_ROWS_DROPPED", dropped = n_dropped, total = n_input))
}
if (n_input > 0 && nrow(df) == 0) cs_error("CS_E_NO_ROWS")
cs_check_finite_columns(df, c("llr", "trial")) # infinite values stop the run (registry/errors.yaml)
# %% Trials
sc <- "llr"
lc <- "trial"
gc <- NULL
present <- levels(df[[lc]]) # levels with data, in stored order
cs_check_groups(df[[lc]], lc, minimum = 2, exactly = 2)
target_level <- "target"
if (!(target_level %in% present)) cs_error("CS_E_NOT_A_LEVEL", level = target_level, column = lc)
s <- as.numeric(df[[sc]])
pos <- as.character(df[[lc]]) == target_level
p_target <- 0.01 # NULL: the share of target trials
c_miss <- 10
c_fa <- 1
eer_method <- "linear" # linear | rocch
llr <- TRUE
fixed_threshold <- NULL
reps <- as.integer(300)
conf <- 0.9
seed <- 42 # portable Wichmann-Hill stream: Python resamples the same trials
# %% Verification metrics
res <- cs_verif_summary(s, pos, p_target, c_miss, c_fa, eer_method, if (llr) NULL else fixed_threshold, llr)
ci <- cs_verif_bootstrap(s, pos, reps, seed, conf, p_target, c_miss, c_fa, eer_method)
pts <- cs_verif_det_points(s, pos)
prior <- res$prior
n_t <- res$n_target
n_n <- res$n_nontarget
op_rows <- lapply(c(0.001, 0.01, 0.05, 0.1), function(target) {
o <- cs_verif_fnr_at_fpr(pts, target)
list(fpr_target = target, fnr = o$fnr, threshold = o$threshold)
})
fnr_01 <- op_rows[[2]]$fnr
# %% Conditions
groups <- if (!is.null(gc)) levels(df[[gc]]) else character(0)
gcol <- if (!is.null(gc)) as.character(df[[gc]]) else NULL
g_rows <- list()
g_curves <- list()
for (lv in groups) {
m <- gcol == lv
nt <- sum(pos & m)
nn <- sum(!pos & m)
if (nt == 0 || nn == 0) {
g_rows[[length(g_rows) + 1L]] <- list(group = lv, n_target = nt, n_nontarget = nn, eer = NULL, min_dcf = NULL)
next
}
r <- cs_verif_summary(s[m], pos[m], p_target, c_miss, c_fa, eer_method)
g_rows[[length(g_rows) + 1L]] <- list(group = lv, n_target = nt, n_nontarget = nn, eer = r$eer, min_dcf = r$min_dcf)
if (length(g_curves) < 7) g_curves[[length(g_curves) + 1L]] <- list(name = lv, pts = cs_verif_det_points(s[m], pos[m]))
}
# %% Assumptions
e_t <- res$eer * n_t
e_n <- res$eer * n_n
few <- min(e_t, e_n) < 30
assumptions <- list(
list(key = "held_out", label = "Scores come from a fixed system", status = "info",
detail = "Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance."),
list(key = "independence", label = "Trials are not independent", status = "info",
detail = "Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give."),
list(key = "errors", label = "Enough errors at the EER", status = if (few) "warn" else "pass",
detail = paste0(sprintf("About %.0f misses and %.0f false alarms at the EER", e_t, e_n),
if (few) "; with fewer than 30 of either the rates are rough (Doddington's rule of 30)." else "."))
)
if (res$eer > 0.5) warnings <- c(warnings, "The equal error rate is above 50%: higher scores go with different-source trials. Check the same-source level.")
# %% Result
pct <- sprintf("%.0f%%", conf * 100)
f3 <- function(v) if (is.null(v)) "—" else sprintf("%.3f", v)
fp <- function(v) if (is.null(v)) "—" else sprintf("%.2f%%", 100 * v)
values <- list(n = nrow(df), n_target = n_t, n_nontarget = n_n, target_level = target_level, p_target = prior,
c_miss = c_miss, c_fa = c_fa, eer_method = eer_method,
eer = res$eer, eer_low = ci$eer_low, eer_high = ci$eer_high, eer_threshold = res$eer_threshold,
min_dcf = res$min_dcf, min_dcf_low = ci$min_dcf_low, min_dcf_high = ci$min_dcf_high,
min_dcf_threshold = res$min_dcf_threshold, min_dcf_fpr = res$min_dcf_fpr, min_dcf_fnr = res$min_dcf_fnr,
actual_threshold = res$actual_threshold, actual_dcf = res$actual_dcf, actual_fpr = res$actual_fpr,
actual_fnr = res$actual_fnr, cllr = res$cllr, fnr_at_fpr_01 = fnr_01, n_groups = length(groups))
metric_rows <- list(
list(measure = "Equal error rate (EER)", value = res$eer, low = ci$eer_low, high = ci$eer_high,
threshold = res$eer_threshold, fpr = res$eer, fnr = res$eer),
list(measure = "Minimum DCF (threshold picked on these trials)", value = res$min_dcf, low = ci$min_dcf_low,
high = ci$min_dcf_high, threshold = res$min_dcf_threshold, fpr = res$min_dcf_fpr, fnr = res$min_dcf_fnr)
)
if (!is.null(res$actual_dcf)) metric_rows[[length(metric_rows) + 1L]] <- list(
measure = if (llr) "Actual DCF (Bayes threshold)" else "Actual DCF (fixed threshold)", value = res$actual_dcf,
low = NULL, high = NULL, threshold = res$actual_threshold, fpr = res$actual_fpr, fnr = res$actual_fnr)
if (!is.null(res$cllr)) metric_rows[[length(metric_rows) + 1L]] <- list(
measure = "Cllr (bits)", value = res$cllr, low = NULL, high = NULL, threshold = NULL, fpr = NULL, fnr = NULL)
tables <- list(
list(key = "metrics", title = sprintf("Verification metrics (%s intervals from resampling trials)", pct),
columns = list(list(key = "measure", label = "Measure", type = "string"), list(key = "value", label = "Value", type = "number"),
list(key = "low", label = paste(pct, "CI low"), type = "number"), list(key = "high", label = paste(pct, "CI high"), type = "number"),
list(key = "threshold", label = "Threshold", type = "number"), list(key = "fpr", label = "False alarm rate", type = "number"),
list(key = "fnr", label = "Miss rate", type = "number")),
rows = metric_rows),
list(key = "operating_points", title = "Miss rate at fixed false alarm rates",
columns = list(list(key = "fpr_target", label = "False alarm rate at most", type = "number"), list(key = "fnr", label = "Miss rate", type = "number"),
list(key = "threshold", label = "Threshold", type = "number")),
rows = op_rows)
)
if (length(groups)) tables[[length(tables) + 1L]] <- list(key = "groups", title = sprintf("By %s", gc),
columns = list(list(key = "group", label = gc, type = "string"), list(key = "n_target", label = "Target trials", type = "integer"),
list(key = "n_nontarget", label = "Non-target trials", type = "integer"), list(key = "eer", label = "EER", type = "number"),
list(key = "min_dcf", label = "Minimum DCF", type = "number")),
rows = g_rows)
series <- c(list(list(name = "All trials", pts = pts)), g_curves)
det_f <- numeric(0)
det_m <- numeric(0)
det_s <- character(0)
for (se in series) {
inner <- which(is.finite(se$pts$threshold))
j <- inner[cs_verif_thin(length(inner))]
det_f <- c(det_f, se$pts$fpr[j])
det_m <- c(det_m, se$pts$fnr[j])
det_s <- c(det_s, rep(se$name, length(j)))
}
charts <- list(cs_chart("det", "det-curve", "Detection error tradeoff: miss rate against false alarm rate", list(
fpr = cs_col("False alarm rate (false accepts)", det_f),
fnr = cs_col("Miss rate (false rejects)", det_m),
model = cs_col("Trials", det_s, "categorical", levels = vapply(series, function(se) se$name, character(1)))),
controls = list(eer = res$eer, minDcf = res$min_dcf, minDcfFpr = res$min_dcf_fpr, minDcfFnr = res$min_dcf_fnr,
actualDcf = res$actual_dcf, actualFpr = res$actual_fpr, actualFnr = res$actual_fnr)))
keep <- cs_verif_thin(nrow(df), 20000L)
charts[[length(charts) + 1L]] <- cs_chart("scores", "density", "Scores of target and non-target trials", list(
x = cs_col(sc, s[keep]),
group = cs_col("Trial", ifelse(pos[keep], "Target", "Non-target"), "categorical", levels = c("Non-target", "Target"))),
controls = list(compare = FALSE))
summary <- sprintf("On %d target and %d non-target trials, the equal error rate was %s (%s CI %s to %s) and the minimum detection cost %s at π = %s, C_miss = %s, C_fa = %s.",
as.integer(n_t), as.integer(n_n), fp(res$eer), pct, fp(ci$eer_low), fp(ci$eer_high), f3(res$min_dcf),
format(prior, digits = 6), format(c_miss, digits = 6), format(c_fa, digits = 6))
if (!is.null(res$actual_dcf)) summary <- paste(summary, sprintf("At the %s threshold %s the actual cost was %s.",
if (llr) "Bayes" else "fixed", formatC(res$actual_threshold, digits = 3, format = "g"), f3(res$actual_dcf)))
if (!is.null(res$cllr)) summary <- paste(summary, sprintf("Cllr = %.3f bits.", res$cllr))
cs_publish(list(
method = "evaluate.verification",
methodVersion = "1.0.0",
title = "Verification scores",
engine = cs_engine_info("stats", "nanoparquet"),
n = nrow(df),
summary = summary,
statistics = list(list(key = "eer", label = "EER", value = res$eer, format = "percent"),
list(key = "min_dcf", label = "Minimum DCF", value = res$min_dcf),
list(key = "fnr_at_fpr_01", label = "Miss rate at 1% false alarms", value = fnr_01, format = "percent")),
tables = tables,
assumptions = assumptions,
warnings = warnings,
notes = list(paste0(sprintf("A trial is accepted when %s ≥ the threshold; target trials: %s = %s. ", sc, lc, target_level),
sprintf("EER: %s. ", if (eer_method == "linear") "linear interpolation on the operating points" else "the crossing on the ROC convex hull"),
sprintf("DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = %s", format(prior, digits = 6)),
if (is.null(p_target)) " (the share of target trials)." else ".",
sprintf(" Intervals: %d resamples of trials within each class on the shared seeded stream (seed %d).", reps, as.integer(seed)))),
charts = charts,
values = values
))
On 120 target and 480 non-target trials, the equal error rate was 9.17% (90% CI 6.67% to 11.67%) and the minimum detection cost 0.428 at π = 0.01, C_miss = 10, C_fa = 1. At the Bayes threshold 2.29 the actual cost was 0.465. Cllr = 0.288 bits.
- EER
- 9.2%
- Minimum DCF
- 0.4281
- Miss rate at 1% false alarms
- 35.0%
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Scores come from a fixed system — Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance.
- Trials are not independent — Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give.
- Enough errors at the EER — About 11 misses and 44 false alarms at the EER; with fewer than 30 of either the rates are rough (Doddington's rule of 30).
Verification metrics (90% intervals from resampling trials)
| Measure | Value | 90% CI low | 90% CI high | Threshold | False alarm rate | Miss rate |
|---|---|---|---|---|---|---|
| Equal error rate (EER) | 0.0917 | 0.0667 | 0.1167 | −0.2490 | 0.0917 | 0.0917 |
| Minimum DCF (threshold picked on these trials) | 0.4281 | 0.3039 | 0.4752 | 2.578 | 0.0104 | 0.3250 |
| Actual DCF (Bayes threshold) | 0.4650 | — | — | 2.293 | 0.0167 | 0.3000 |
| Cllr (bits) | 0.2878 | — | — | — | — | — |
Miss rate at fixed false alarm rates
| False alarm rate at most | Miss rate | Threshold |
|---|---|---|
| 0.0010 | 0.4917 | 3.706 |
| 0.0100 | 0.3500 | 2.728 |
| 0.0500 | 0.1250 | 0.6190 |
| 0.1000 | 0.0750 | −0.3890 |
- A trial is accepted when llr ≥ the threshold; target trials: trial = target. EER: linear interpolation on the operating points. DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = 0.01. Intervals: 300 resamples of trials within each class on the shared seeded stream (seed 42).
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Evaluate verification scores (EER, DCF, DET)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method evaluate.verification 1.0.0 · spec 7fb1fc1e4972182d
# Dataset: aud3_trials (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import math
import numpy as np
import pandas as pd
import codesplash as cs
from codesplash.errors import check_groups
from codesplash.evaluate import verification as vf # DET points, EER, DCF, Cllr (twin: codesplashr cs_verif_*)
# %% Data
df = pd.read_parquet("tests/parity/fixtures/aud3_trials.parquet", columns=["llr", "trial"])
n_input = len(df)
df["trial"] = pd.Categorical(df["trial"], categories=["nontarget", "target"]) # stored level order
df = df.dropna(subset=["llr", "trial"]) # listwise deletion over the analysis columns
df["trial"] = df["trial"].cat.remove_unused_categories()
n_dropped = n_input - len(df)
warnings = []
if n_dropped:
warnings.append(cs.cs_warning("CS_W_ROWS_DROPPED", dropped=n_dropped, total=n_input))
if n_input and not len(df):
cs.cs_error("CS_E_NO_ROWS")
cs.check_finite_columns(df, ["llr", "trial"]) # infinite values stop the run (registry/errors.yaml)
# %% Trials
sc, lc = "llr", "trial"
gc = None
present = [str(v) for v in df[lc].cat.categories] # levels with data, in stored order
check_groups(df[lc], lc, minimum=2, exactly=2)
target_level = "target"
if target_level not in present:
cs.cs_error("CS_E_NOT_A_LEVEL", level=target_level, column=lc)
s = df[sc].to_numpy(dtype=float)
pos = (df[lc].astype(str) == target_level).to_numpy()
p_target = 0.01 # None: the share of target trials
c_miss, c_fa = 10, 1
eer_method = "linear" # linear | rocch
llr = True
fixed_threshold = None
reps = int(300)
conf = 0.9
seed = 42 # portable Wichmann–Hill stream: R resamples the same trials
# %% Verification metrics
res = vf.summary(s, pos, p_target, c_miss, c_fa, eer_method, None if llr else fixed_threshold, llr)
ci = vf.bootstrap(s, pos, reps, seed, conf, p_target, c_miss, c_fa, eer_method)
pts = vf.det_points(s, pos)
prior = res["prior"]
n_t, n_n = res["n_target"], res["n_nontarget"]
op_rows = []
for target in (0.001, 0.01, 0.05, 0.1):
fnr_t, thr_t = vf.fnr_at_fpr(pts, target)
op_rows.append({"fpr_target": target, "fnr": fnr_t, "threshold": thr_t})
fnr_01 = op_rows[1]["fnr"]
# %% Conditions
groups = [str(v) for v in df[gc].cat.categories] if gc else []
gcol = df[gc].astype(str).to_numpy() if gc else None
g_rows, g_curves = [], []
for lv in groups:
m = gcol == lv
nt, nn = int(np.sum(pos & m)), int(np.sum(~pos & m))
if nt == 0 or nn == 0:
g_rows.append({"group": lv, "n_target": nt, "n_nontarget": nn, "eer": None, "min_dcf": None})
continue
r = vf.summary(s[m], pos[m], p_target, c_miss, c_fa, eer_method)
g_rows.append({"group": lv, "n_target": nt, "n_nontarget": nn, "eer": r["eer"], "min_dcf": r["min_dcf"]})
if len(g_curves) < 7:
g_curves.append((lv, vf.det_points(s[m], pos[m])))
# %% Assumptions
e_t, e_n = res["eer"] * n_t, res["eer"] * n_n
few = min(e_t, e_n) < 30
assumptions = [
{"key": "held_out", "label": "Scores come from a fixed system", "status": "info",
"detail": "Fix the system and any threshold before scoring these trials. The minimum DCF picks its threshold on them, so it is optimistic; the actual DCF uses a threshold fixed in advance."},
{"key": "independence", "label": "Trials are not independent", "status": "info",
"detail": "Trials that share a speaker or item are correlated, so intervals from resampling trials are narrower than a resampling of speakers would give."},
{"key": "errors", "label": "Enough errors at the EER", "status": "warn" if few else "pass",
"detail": f"About {e_t:.0f} misses and {e_n:.0f} false alarms at the EER" + ("; with fewer than 30 of either the rates are rough (Doddington's rule of 30)." if few else ".")},
]
if res["eer"] > 0.5:
warnings.append("The equal error rate is above 50%: higher scores go with different-source trials. Check the same-source level.")
# %% Result
pct = f"{conf:.0%}"
f3 = lambda v: "—" if v is None else f"{v:.3f}"
fp = lambda v: "—" if v is None else f"{100 * v:.2f}%"
values = {"n": int(len(df)), "n_target": n_t, "n_nontarget": n_n, "target_level": target_level, "p_target": prior,
"c_miss": c_miss, "c_fa": c_fa, "eer_method": eer_method,
"eer": res["eer"], "eer_low": ci["eer_low"], "eer_high": ci["eer_high"], "eer_threshold": res["eer_threshold"],
"min_dcf": res["min_dcf"], "min_dcf_low": ci["min_dcf_low"], "min_dcf_high": ci["min_dcf_high"],
"min_dcf_threshold": res["min_dcf_threshold"], "min_dcf_fpr": res["min_dcf_fpr"], "min_dcf_fnr": res["min_dcf_fnr"],
"actual_threshold": res["actual_threshold"], "actual_dcf": res["actual_dcf"], "actual_fpr": res["actual_fpr"],
"actual_fnr": res["actual_fnr"], "cllr": res["cllr"], "fnr_at_fpr_01": fnr_01, "n_groups": len(groups)}
metric_rows = [
{"measure": "Equal error rate (EER)", "value": res["eer"], "low": ci["eer_low"], "high": ci["eer_high"],
"threshold": res["eer_threshold"], "fpr": res["eer"], "fnr": res["eer"]},
{"measure": "Minimum DCF (threshold picked on these trials)", "value": res["min_dcf"], "low": ci["min_dcf_low"],
"high": ci["min_dcf_high"], "threshold": res["min_dcf_threshold"], "fpr": res["min_dcf_fpr"], "fnr": res["min_dcf_fnr"]},
]
if res["actual_dcf"] is not None:
metric_rows.append({"measure": "Actual DCF (Bayes threshold)" if llr else "Actual DCF (fixed threshold)", "value": res["actual_dcf"],
"low": None, "high": None, "threshold": res["actual_threshold"], "fpr": res["actual_fpr"], "fnr": res["actual_fnr"]})
if res["cllr"] is not None:
metric_rows.append({"measure": "Cllr (bits)", "value": res["cllr"], "low": None, "high": None, "threshold": None, "fpr": None, "fnr": None})
tables = [
{"key": "metrics", "title": f"Verification metrics ({pct} intervals from resampling trials)",
"columns": [{"key": "measure", "label": "Measure", "type": "string"}, {"key": "value", "label": "Value", "type": "number"},
{"key": "low", "label": f"{pct} CI low", "type": "number"}, {"key": "high", "label": f"{pct} CI high", "type": "number"},
{"key": "threshold", "label": "Threshold", "type": "number"}, {"key": "fpr", "label": "False alarm rate", "type": "number"},
{"key": "fnr", "label": "Miss rate", "type": "number"}],
"rows": metric_rows},
{"key": "operating_points", "title": "Miss rate at fixed false alarm rates",
"columns": [{"key": "fpr_target", "label": "False alarm rate at most", "type": "number"}, {"key": "fnr", "label": "Miss rate", "type": "number"},
{"key": "threshold", "label": "Threshold", "type": "number"}],
"rows": op_rows},
]
if groups:
tables.append({"key": "groups", "title": f"By {gc}",
"columns": [{"key": "group", "label": gc, "type": "string"}, {"key": "n_target", "label": "Target trials", "type": "integer"},
{"key": "n_nontarget", "label": "Non-target trials", "type": "integer"}, {"key": "eer", "label": "EER", "type": "number"},
{"key": "min_dcf", "label": "Minimum DCF", "type": "number"}],
"rows": g_rows})
series = [("All trials", pts)] + g_curves
det_f, det_m, det_s = [], [], []
for name, p in series:
inner = [i for i in range(p["threshold"].size) if math.isfinite(p["threshold"][i])]
for j in vf.thin(len(inner)):
det_f.append(float(p["fpr"][inner[j]]))
det_m.append(float(p["fnr"][inner[j]]))
det_s.append(name)
charts = [cs.chart("det", "det-curve", "Detection error tradeoff: miss rate against false alarm rate", {
"fpr": cs.col("False alarm rate (false accepts)", det_f),
"fnr": cs.col("Miss rate (false rejects)", det_m),
"model": cs.col("Trials", det_s, "categorical", levels=[name for name, _ in series])},
controls={"eer": res["eer"], "minDcf": res["min_dcf"], "minDcfFpr": res["min_dcf_fpr"], "minDcfFnr": res["min_dcf_fnr"],
"actualDcf": res["actual_dcf"], "actualFpr": res["actual_fpr"], "actualFnr": res["actual_fnr"]})]
keep = vf.thin(int(len(df)), 20000)
charts.append(cs.chart("scores", "density", "Scores of target and non-target trials", {
"x": cs.col(sc, [float(s[i]) for i in keep]),
"group": cs.col("Trial", ["Target" if pos[i] else "Non-target" for i in keep], "categorical", levels=["Non-target", "Target"])},
controls={"compare": False}))
summary = (f"On {n_t} target and {n_n} non-target trials, the equal error rate was {fp(res['eer'])} ({pct} CI {fp(ci['eer_low'])} to {fp(ci['eer_high'])}) "
f"and the minimum detection cost {f3(res['min_dcf'])} at π = {prior:g}, C_miss = {c_miss:g}, C_fa = {c_fa:g}.")
if res["actual_dcf"] is not None:
summary += f" At the {'Bayes' if llr else 'fixed'} threshold {res['actual_threshold']:.3g} the actual cost was {f3(res['actual_dcf'])}."
if res["cllr"] is not None:
summary += f" Cllr = {res['cllr']:.3f} bits."
cs.publish({
"method": "evaluate.verification",
"methodVersion": "1.0.0",
"title": "Verification scores",
"engine": cs.engine_info("pandas", "numpy"),
"n": int(len(df)),
"summary": summary,
"statistics": [{"key": "eer", "label": "EER", "value": res["eer"], "format": "percent"},
{"key": "min_dcf", "label": "Minimum DCF", "value": res["min_dcf"]},
{"key": "fnr_at_fpr_01", "label": "Miss rate at 1% false alarms", "value": fnr_01, "format": "percent"}],
"tables": tables,
"assumptions": assumptions,
"warnings": warnings,
"notes": [f"A trial is accepted when {sc} ≥ the threshold; target trials: {lc} = {target_level}. "
f"EER: {'linear interpolation on the operating points' if eer_method == 'linear' else 'the crossing on the ROC convex hull'}. "
f"DCF = C_miss·π·miss rate + C_fa·(1 − π)·false alarm rate, normalized by min(C_miss·π, C_fa·(1 − π)); π = {prior:g}"
+ (" (the share of target trials)." if p_target is None else ".")
+ f" Intervals: {reps} resamples of trials within each class on the shared seeded stream (seed {seed})."],
"charts": charts,
"values": values,
})
When scores are calibrated log-likelihood ratios, the best threshold for a given prior and costs is known in advance: the Bayes threshold log(C_fa(1 − π)/(C_miss π)). The actual costActual detection costThe cost at a threshold fixed in advance: yours, or for log-likelihood ratios the Bayes threshold log(C_fa(1−π)/(C_miss π)). at that threshold here is 0.465 against a minimum of 0.428; the gap is what calibration costs. CllrCllr (log-likelihood-ratio cost)Bits of cost of scores read as log-likelihood ratios: 0 is perfect, 1 is no better than ignoring the scores. = 0.288 bits sums up the calibration of every score, not only one threshold.
Check yourself
A vendor reports only the minimum DCF on your test trials. Why is that not enough to buy the system?
Show the answer
Answer: b
Ask for the actual DCF at a threshold set before seeing the test trials, or for calibrated scores so the Bayes threshold applies.
Honest intervals
ReadThe intervals resample trials within targets and non-targets. Trials that share a speaker are not independent: one hard speaker appears in many trials. So the intervals are narrower than they should be; a resampling of speakers would be wider. And with fewer than about 30 errors of each kind at the operating point, Doddington's rule of 30 says the error rates are rough.
Do it on your own data
In the appAny table with one row per trial works: a score column, a same-or-not column and, optionally, a condition. In Analyze → Evaluate predictions choose Evaluate verification scores, set the target prior and costs for your use, and turn on log-likelihood ratios only when the scores really are calibrated.
from codesplash.evaluate import verification as vf
res = vf.summary(scores, is_target, p_target=0.01, c_miss=1, c_fa=1, method="rocch")
print(res["eer"], res["min_dcf"])library(codesplashr)
res <- cs_verif_summary(scores, is_target, p_target = 0.01, c_miss = 1, c_fa = 1, method = "rocch")
c(res$eer, res$min_dcf)Concepts in this lesson