dempster_shafer_uncertainty¶
- probly.quantification.dempster_shafer_uncertainty = <flextype.singledispatch.Flexdispatch object>¶
Compute the Dempster-Shafer uncertainty score of a distribution over logits.
For a Gaussian distribution N(h, sigma^2) over K-class logits, this is the Dempster-Shafer / vacuity metric used by SNGP [LLP+20] (Eq. 15) and originally introduced by [SKK18]:
\[h^{adj}_k = \frac{h_k}{\sqrt{1 + \lambda \sigma_k^2}}, \quad u(x) = \frac{K}{K + \sum_k \exp(h^{adj}_k)}\]where
lambda = mean_field_factor(defaultpi / 8) controls the mean-field correction that shrinks the logits toward zero when the variance is large (e.g. for OOD inputs), driving the score toward 1.The score lies in (0, 1] and corresponds to the Sensoy vacuity
K / Sapplied to a soft-evidential Dirichlet withalpha = 1 + exp(h_adj). Settingmean_field_factor=0reduces it to the variance-free formulaK / (K + sum_k exp(h_k)).- Parameters:
distribution – A distribution over K-class logits whose backend has a registered implementation (e.g. an SNGP-style Gaussian).
mean_field_factor – Coefficient in front of the variance in the mean-field denominator. Defaults to
pi / 8(paper / SNGP recipe).
- Returns:
The Dempster-Shafer uncertainty score, with the trailing class axis removed.