pAUC pairwise-surrogate playground

Interactive demo of the PAUCAtBudgetLoss pairwise surrogate. The loss optimizes partial AUC over a false-positive-rate band [α, β] around an operating point. Drag any point, or set the distributions, and watch the band, the per-point gradients, and loss = 1 − pAUC respond. Gradients reveal the mechanism: positives are pushed up, band negatives are pushed down (hard-negative mining at the operating point), and every other negative is inert.

Readouts

loss = 1 − pAUC
pAUC (surrogate)
band negatives
τ_eff
t_β … t_α
pAUC (empirical)

τ-scale comparison — band vs iqr

Both modes select the same band negatives. Each applies its own calibrated temperature (band ≈ 1.0, iqr ≈ 0.1 — the docstring pairing) to its dispersion scale, so τ_eff = temperature · scale differs, changing the sigmoid sharpness, the loss, and the gradients. The selected row drives the live demo.

modescaleτ_effloss = 1 − pAUC
band t_α − t_β
iqr q75 − q25

Score axis & gradients

Negatives below the axis, positives above. The shaded band is [t_β, t_α] mapped from the negative score quantiles. Ringed points are the band negatives that enter the pairwise loss. Drag any point.

positive negative band negative (in loss) FPR band [t_β, t_α] → descent gradient

ROC & partial-AUC region

Empirical ROC. The shaded vertical strip is the FPR band [α, β]; the partial AUC the loss targets is the normalized area under the curve inside it.

The surrogate replaces the step indicator 1[pos > neg] with σ((pos − neg)/τ_eff), averaged over positives × band-negatives. As temperature → 0 the sigmoid sharpens toward the true step (and the surrogate pAUC approaches the empirical partial AUC over the band), at the cost of vanishing gradients for well-separated pairs. As β grows the band widens to include more negatives; as α grows the band's upper edge drops below the top scores.

Only negatives whose scores fall in [t_β, t_α] contribute. Move a negative into or out of the band and watch loss and the gradient arrows snap.