New figure! New content!

This commit is contained in:
2026-07-03 00:57:18 +03:00
parent 21f0427fba
commit c142ff98f4
6 changed files with 170 additions and 1 deletions
+58
View File
@@ -763,6 +763,64 @@ additive shift of the raw scores then produces a non-uniform shift of the transf
changing the shape of the fitted distribution rather than merely translating it, and the
balance property no longer holds.
\paragraph{Gradient locality.}
\label{para:gradient-locality}
A second structural consequence of the ROLL formulation is that gradient mass is
\emph{concentrated near the operating threshold $\tau$}. Samples whose scores lie
close to $\tau$ receive disproportionately large gradient updates, while samples
already far on the correct side contribute very little.
This follows directly from \Cref{eq:kde-grad-combined}. For the positive class ($y_i = 1$),
the gradient magnitude is
\[
\left|\frac{\partial \mathcal{L}}{\partial f_\theta(\mathbf{x}_i)}\right|
= \frac{1}{|\mathcal{B}_1|}\,\sigma_1'(f_\theta(\mathbf{x}_i) - \tau),
\]
which is a bell-shaped kernel PDF that peaks when $f_\theta(\mathbf{x}_i) = \tau$ and
decays to zero as the score moves away from the threshold in either direction.
For the negative class ($y_i = 0$), the gradient is proportional to
$\sigma_0'(\tau - f_\theta(\mathbf{x}_i))$ (normalized over $\mathcal{B}_0$), which is
again bell-shaped and centred on $\tau$.
The effect is that each gradient step focuses the model's attention on the region that
directly determines the operating-point performance: samples that could plausibly be
re-ranked relative to the threshold at the current step. Samples comfortably classified
on the correct side contribute negligible signal, not because they are deemed unimportant,
but because their contribution to the CDF estimate at $\tau$ is already saturated.
This stands in contrast to standard losses such as cross-entropy, where the per-sample
gradient is determined by the predicted probability, with no direct dependence on an
operating threshold. Under heavy class imbalance this can cause the dominant class to
``push'' the threshold away from the intended operating point, a problem that gradient
locality avoids by construction.
\begin{observation}[Gradient locality]
\label{obs:gradient-locality}
For KDE-ROLL, the gradient magnitude of sample $\mathbf{x}_i$ is proportional to
the kernel PDF evaluated at the distance between $f_\theta(\mathbf{x}_i)$ and the
operating threshold $\tau$. Samples nearest to $\tau$ receive the largest updates;
samples far from $\tau$ in either direction contribute negligible gradient.
\end{observation}
\Cref{fig:threshold-locality} illustrates this for a simulated two-class setting. The
upper panel shows the score distributions and the operating threshold; the lower panel
shows the gradient magnitude of each sample. Both classes exhibit a clear bell-shaped
concentration of gradient mass around $\tau$, with smooth decay on either side.
\begin{figure}[H]
\centering
\includegraphics[width=0.82\textwidth]{content/method/figures/threshold_weighting.pdf}
\caption{Gradient locality in KDE-ROLL. \textit{Upper}: score distributions for the
negative (blue, $y=0$) and positive (orange, $y=1$) classes; dashed line marks the
operating threshold $\tau$ at FPR $= \alpha$. \textit{Lower}: gradient magnitude
$|\partial\mathcal{L}/\partial f_\theta(\mathbf{x})|$ for each sample. Both classes
show a bell-shaped concentration of gradient mass near $\tau$, with samples far from
the threshold contributing negligible updates. Smooth curves are the kernel PDFs scaled
for reference.}
\label{fig:threshold-locality}
\end{figure}
\subsection{Gradient Computation and the Custom Backward Pass}
\label{sec:roll-backward}