ROC Curve + Bayes Optimal Classifier

Two Gaussian class-conditionals, \( P(x \mid y=0) \sim N(\mu_0, \sigma_0^2) \) and \( P(x \mid y=1) \sim N(\mu_1, \sigma_1^2) \), and one threshold \(\tau\): if \(x < \tau\) we predict \(\hat{y}=0\), else \(\hat{y}=1\). Drag anywhere on the density plot to move \(\tau\). The shaded areas are the two accuracy integrals; sweeping \(\tau\) traces out the ROC curve.

Prior-weighted densities & threshold

\( p(y=0)\,p(x \mid y=0) \) \( p(y=1)\,p(x \mid y=1) \)   shaded = the two Acc integrals   dashed = \( \hat{\tau} \) (argmax Acc)

Acc(τ) — accuracy as a function of the threshold

ROC curve (dot = current τ, star = τ̂)

τ → −∞: always predict y=1 ⇒ FN → 0, Recall → 1, spec → 0 (top-right).
τ → +∞: always predict y=0 ⇒ FP → 0, Recall → 0, spec → 1 (bottom-left).
Class 0 (blue)
Class 1 (orange)
Prior
equal priors ⇒ τ̂ at the curve intersection;
move the prior and watch τ̂ slide off it
\( \text{Acc}(\tau) = \displaystyle\int_{-\infty}^{\tau} p(y=0)\,p(x \mid y=0)\,dx + \int_{\tau}^{\infty} p(y=1)\,p(x \mid y=1)\,dx \)