torchcell.losses.distributional.coverage
- coverage(pit: Tensor, alpha: float) Tensor[source]
Empirical coverage of the central
alphapredictive interval, from PIT values.An observation lies inside the central
alphainterval \([\hat F^{-1}(\tfrac{1-\alpha}{2}),\ \hat F^{-1}(\tfrac{1+\alpha}{2})]\) exactly when its PIT lies in \([\tfrac{1-\alpha}{2}, \tfrac{1+\alpha}{2}]\), so coverage is a scalar read-off of the same transform rather than a second computation:\[\mathrm{cov}_\alpha = \frac1N\sum \mathbf 1\!\left[\tfrac{1-\alpha}{2}\le \mathrm{PIT}\le \tfrac{1+\alpha}{2}\right].\]Calibrated means \(\mathrm{cov}_\alpha \approx \alpha\). UNDER-coverage (\(<\alpha\)) is the U-shaped-PIT / overconfident case; OVER-coverage (\(>\alpha\)) is the n-shaped / sigma-collapse case.
- Parameters:
pit – PIT values, any shape (all entries are pooled).
alpha – Nominal central interval mass in
(0, 1), e.g.0.8.
- Returns:
Scalar coverage fraction.