fundamentals

Scoring rules

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.

Definitions

Log score (logarithmic score)

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.

Continuous Ranked Probability Score (CRPS)

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.

API

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 that pin them down

tests/core/test_diagnostics.py::TestScoringRules covers:

Pitfalls

See also