Scoring rules score a probabilistic forecast against a realized outcome. A proper scoring rule is maximized in expectation by the true distribution, so the average score over a held-out set tells you whether your model is well-calibrated and well-specified.
For a Gaussian forecast N(μ, σ²) and a realized outcome y::
log_score(y; μ, σ²) = log p(y; μ, σ²)
= − ½ log(2π σ²) − (y − μ)² / (2 σ²)
Higher is better. Equal in spirit to negative-NLL.
For a Gaussian forecast (Gneiting & Raftery, 2007 closed form)::
z = (y − μ) / σ
CRPS = σ [ z (2 Φ(z) − 1) + 2 φ(z) − 1/√π ]
where Φ is the standard-normal CDF and φ its PDF. Lower is
better. CRPS is non-negative and reduces to mean absolute error when
σ → 0.
| Function | Signature | Notes |
|---|---|---|
log_score_gaussian |
(y, mu, sigma2) -> array |
Pointwise; sum / mean as appropriate. |
crps_gaussian |
(y, mu, sigma2) -> array |
Pointwise; uses math.erf via np.vectorize. |
Both live in active_inference.core.diagnostics.
tests/core/test_diagnostics.py::TestScoringRules covers:
calibration.md — coverage of credible intervals.../topics/learning_and_inference.md
— using log score / CRPS to compare estimators.../reference/core.md — full API.