BetaNLL#
- class torch_uncertainty.losses.BetaNLL(beta=0.5, reduction='mean')[source]#
The \(\beta\)-Negative Log-Likelihood loss (Seitzer et al., 2022).
A re-weighted version of the Gaussian NLL that scales each per-sample loss by the (stop-gradient) predicted variance raised to the power \(\beta\):
\[\mathcal{L}_i = \sigma_i^{2\beta} \cdot \left( \frac{(y_i - \mu_i)^2}{2 \sigma_i^2} + \frac{1}{2} \log \sigma_i^2 \right),\]where \((\mu_i, \sigma_i^2)\) are the predicted mean and variance. \(\beta = 0\) recovers the standard Gaussian NLL (which down-weights high-variance — i.e. uncertain — samples); \(\beta = 1\) recovers the MSE scaled by \(\sigma^2\). Intermediate values interpolate between the two regimes and counteract the tendency of Gaussian NLL to neglect noisy targets.
- Parameters:
beta (
float) – Parameter in \([0, 1]\) controlling the relative weighting between data points:0is the standard Gaussian NLL (high weight on low-error points);1recovers a variance-scaled MSE with equal weighting.reduction (
str|None) – Specifies the reduction to apply to the output. Must be one of'none','mean'or'sum'.
References