Skip to content

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.

Advanced ~14 min7 steps

What runs in CodeSplash

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

01

Same or different?

Read

Speaker 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.

02

Make a guess

Predict

Predict 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.

03

The equal error rate and the DET curve

Read
Verification scoresRecorded · Python and R agreeRecorded 2026-11-25 · 25 values compared
R

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%

Plots

Detection error tradeoff: miss rate against false alarm rateHow many misses does each false-alarm rate cost — and where do the two errors balance?
View data
Miss rate (false rejects)False alarm rate (false accepts)Trials
01All trials
00.9979All trials
00.9958All trials
00.9938All trials
00.9917All trials
00.9896All trials
00.9875All trials
00.9854All trials
00.9833All trials
00.9812All trials
00.9792All trials
00.9771All trials
00.9750All trials
00.9729All trials
00.9708All trials
00.9667All trials
00.9646All trials
00.9625All trials
00.9604All trials
00.9583All trials
00.9542All trials
00.9521All trials
00.9500All trials
00.9479All trials
00.9458All trials
00.9437All trials
00.9417All trials
00.9396All trials
00.9375All trials
00.9333All trials
00.9292All trials
00.9229All trials
00.9208All trials
00.9187All trials
00.9167All trials
00.9146All trials
00.9125All trials
00.9104All trials
00.9083All trials
00.9063All trials
00.9042All trials
00.9021All trials
00.9000All trials
00.8979All trials
00.8958All trials
00.8917All trials
00.8875All trials
00.8833All trials
00.8812All trials
00.8792All trials
00.8771All trials
00.8729All trials
00.8708All trials
00.8667All trials
00.8646All trials
00.8625All trials
00.8604All trials
00.8562All trials
00.8521All trials
00.8500All trials

First 60 of 393 rows.

Scores of target and non-target trialsWhat is the smooth shape of a distribution, and how much does it depend on the bandwidth?
View data
Trialcosine
Non-target0.2010
Non-target0.3850
Non-target0.3840
Non-target0.2920
Non-target0.1320
Target0.7800
Non-target0.0460
Non-target0.2990
Non-target0.1560
Target0.5810
Non-target0.1420
Target0.7880
Non-target0.2190
Non-target0.3400
Target0.6650
Non-target0.1770
Non-target0.2680
Non-target0.1140
Non-target0.1120
Non-target0.1060
Non-target0.0700
Non-target0.1600
Non-target0.0750
Target0.5230
Target0.7550
Non-target0.1600
Non-target0.0440
Non-target0.2420
Non-target0.2490
Non-target0.1260
Non-target0.2680
Non-target0.2330
Non-target0.1860
Non-target0.2620
Target0.7300
Target0.6190
Non-target0.0450
Non-target0.1300
Non-target0.1830
Non-target0.1420
Target0.6450
Non-target0.3110
Non-target0.2200
Non-target0.2510
Non-target0.2220
Non-target0.4550
Non-target0.2000
Non-target0.2160
Target0.7740
Target0.5580
Target0.7230
Target0.8650
Non-target0.2250
Non-target0.1050
Non-target0.2870
Target0.5110
Non-target0.1620
Non-target0.1110
Non-target0.1560
Non-target0.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)

MeasureValue95% CI low95% CI highThresholdFalse alarm rateMiss rate
Equal error rate (EER)0.02500.01250.03750.43600.02500.0250
Minimum DCF (threshold picked on these trials)0.30830.11670.38960.562000.3083

Miss rate at fixed false alarm rates

False alarm rate at mostMiss rateThreshold
0.00100.30830.5620
0.01000.14170.5020
0.05000.00830.3890
0.100000.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
))
Python

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)

MeasureValue95% CI low95% CI highThresholdFalse alarm rateMiss rate
Equal error rate (EER)0.02500.01250.03750.43600.02500.0250
Minimum DCF (threshold picked on these trials)0.30830.11670.38960.562000.3083

Miss rate at fixed false alarm rates

False alarm rate at mostMiss rateThreshold
0.00100.30830.5620
0.01000.14170.5020
0.05000.00830.3890
0.100000.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.

04

The detection cost

Explore

The 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.

Verification scoresRecorded · Python and R agreeRecorded 2026-11-25 · 25 values compared
R

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

Detection error tradeoff: miss rate against false alarm rateHow many misses does each false-alarm rate cost — and where do the two errors balance?
View data
Miss rate (false rejects)False alarm rate (false accepts)Trials
01All trials
00.9979All trials
00.9958All trials
00.9938All trials
00.9917All trials
00.9896All trials
00.9875All trials
00.9854All trials
00.9833All trials
00.9812All trials
00.9792All trials
00.9771All trials
00.9750All trials
00.9729All trials
00.9708All trials
00.9667All trials
00.9646All trials
00.9625All trials
00.9604All trials
00.9583All trials
00.9542All trials
00.9521All trials
00.9500All trials
00.9479All trials
00.9458All trials
00.9437All trials
00.9417All trials
00.9396All trials
00.9375All trials
00.9333All trials
00.9292All trials
00.9229All trials
00.9208All trials
00.9187All trials
00.9167All trials
00.9146All trials
00.9125All trials
00.9104All trials
00.9083All trials
00.9063All trials
00.9042All trials
00.9021All trials
00.9000All trials
00.8979All trials
00.8958All trials
00.8917All trials
00.8875All trials
00.8833All trials
00.8812All trials
00.8792All trials
00.8771All trials
00.8729All trials
00.8708All trials
00.8667All trials
00.8646All trials
00.8625All trials
00.8604All trials
00.8562All trials
00.8521All trials
00.8500All trials

First 60 of 898 rows.

Scores of target and non-target trialsWhat is the smooth shape of a distribution, and how much does it depend on the bandwidth?
View data
Trialcosine
Non-target0.2010
Non-target0.3850
Non-target0.3840
Non-target0.2920
Non-target0.1320
Target0.7800
Non-target0.0460
Non-target0.2990
Non-target0.1560
Target0.5810
Non-target0.1420
Target0.7880
Non-target0.2190
Non-target0.3400
Target0.6650
Non-target0.1770
Non-target0.2680
Non-target0.1140
Non-target0.1120
Non-target0.1060
Non-target0.0700
Non-target0.1600
Non-target0.0750
Target0.5230
Target0.7550
Non-target0.1600
Non-target0.0440
Non-target0.2420
Non-target0.2490
Non-target0.1260
Non-target0.2680
Non-target0.2330
Non-target0.1860
Non-target0.2620
Target0.7300
Target0.6190
Non-target0.0450
Non-target0.1300
Non-target0.1830
Non-target0.1420
Target0.6450
Non-target0.3110
Non-target0.2200
Non-target0.2510
Non-target0.2220
Non-target0.4550
Non-target0.2000
Non-target0.2160
Target0.7740
Target0.5580
Target0.7230
Target0.8650
Non-target0.2250
Non-target0.1050
Non-target0.2870
Target0.5110
Non-target0.1620
Non-target0.1110
Non-target0.1560
Non-target0.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)

MeasureValue95% CI low95% CI highThresholdFalse alarm rateMiss rate
Equal error rate (EER)0.02170.01080.03200.45700.02170.0217
Minimum DCF (threshold picked on these trials)0.21460.09890.32610.52100.00210.1750

Miss rate at fixed false alarm rates

False alarm rate at mostMiss rateThreshold
0.00100.30830.5620
0.01000.14170.5020
0.05000.00830.3890
0.100000.3360

By channel

channelTarget trialsNon-target trialsEERMinimum DCF
phone421870.02290.2143
street321210.03270.2813
studio4617200
  • 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
))
Python

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)

MeasureValue95% CI low95% CI highThresholdFalse alarm rateMiss rate
Equal error rate (EER)0.02170.01080.03200.45700.02170.0217
Minimum DCF (threshold picked on these trials)0.21460.09890.32610.52100.00210.1750

Miss rate at fixed false alarm rates

False alarm rate at mostMiss rateThreshold
0.00100.30830.5620
0.01000.14170.5020
0.05000.00830.3890
0.100000.3360

By channel

channelTarget trialsNon-target trialsEERMinimum DCF
phone421870.02290.2143
street321210.03270.2813
studio4617200
  • 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.

05

Calibrated scores and the actual cost

Checkpoint
Verification scoresRecorded · Python and R agreeRecorded 2026-11-25 · 25 values compared
R

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%

Plots

Detection error tradeoff: miss rate against false alarm rateHow many misses does each false-alarm rate cost — and where do the two errors balance?
View data
Miss rate (false rejects)False alarm rate (false accepts)Trials
01All trials
00.9979All trials
00.9958All trials
00.9917All trials
00.9896All trials
00.9854All trials
00.9833All trials
00.9792All trials
00.9771All trials
00.9729All trials
00.9708All trials
00.9667All trials
00.9646All trials
00.9604All trials
00.9583All trials
00.9563All trials
00.9521All trials
00.9500All trials
00.9437All trials
00.9417All trials
00.9375All trials
00.9354All trials
00.9313All trials
00.9292All trials
00.9250All trials
00.9229All trials
00.9187All trials
00.9167All trials
00.9146All trials
00.9104All trials
00.9083All trials
00.9042All trials
00.9021All trials
00.8979All trials
00.8958All trials
00.8917All trials
00.8896All trials
00.8854All trials
00.8833All trials
00.8792All trials
00.8771All trials
00.8729All trials
00.8708All trials
00.8688All trials
00.8646All trials
00.8625All trials
00.8583All trials
00.8562All trials
00.8521All trials
00.8500All trials
00.8458All trials
00.8438All trials
00.8396All trials
00.8375All trials
00.8333All trials
00.8313All trials
00.8292All trials
00.8250All trials
00.8229All trials
00.8187All trials

First 60 of 400 rows.

Scores of target and non-target trialsWhat is the smooth shape of a distribution, and how much does it depend on the bandwidth?
View data
Trialllr
Non-target−3.387
Non-target−5.974
Non-target−0.8540
Non-target−6.077
Non-target−2.228
Target2.975
Non-target−1.746
Non-target−4.949
Non-target−5.678
Target1.051
Non-target−6.414
Target10.310
Non-target−2.312
Non-target−2.765
Target2.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
Target7.060
Target8.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
Target4.886
Target4.661
Non-target−0.9680
Non-target−3.335
Non-target−10.633
Non-target−1.832
Target2.942
Non-target−2.364
Non-target−5.962
Non-target−6.581
Non-target2.868
Non-target−3.199
Non-target−9.412
Non-target−9.190
Target−0.4880
Target6.079
Target2.815
Target1.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-target0.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)

MeasureValue90% CI low90% CI highThresholdFalse alarm rateMiss rate
Equal error rate (EER)0.09170.06670.1167−0.24900.09170.0917
Minimum DCF (threshold picked on these trials)0.42810.30390.47522.5780.01040.3250
Actual DCF (Bayes threshold)0.4650——2.2930.01670.3000
Cllr (bits)0.2878—————

Miss rate at fixed false alarm rates

False alarm rate at mostMiss rateThreshold
0.00100.49173.706
0.01000.35002.728
0.05000.12500.6190
0.10000.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
))
Python

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)

MeasureValue90% CI low90% CI highThresholdFalse alarm rateMiss rate
Equal error rate (EER)0.09170.06670.1167−0.24900.09170.0917
Minimum DCF (threshold picked on these trials)0.42810.30390.47522.5780.01040.3250
Actual DCF (Bayes threshold)0.4650——2.2930.01670.3000
Cllr (bits)0.2878—————

Miss rate at fixed false alarm rates

False alarm rate at mostMiss rateThreshold
0.00100.49173.706
0.01000.35002.728
0.05000.12500.6190
0.10000.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.

06

Honest intervals

Read

The 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.

07

Do it on your own data

In the app

Any 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.

Python
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"])
R
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