Skip to content

fix(metrics): compute the exact log-normal CRPS - #524

Merged
mkumar73 merged 3 commits into
mainfrom
fix/lognormal-crps
Nov 2, 2026
Merged

mkumar73 merged 3 commits into
mainfrom
fix/lognormal-crps

Conversation

@ChrisW09

@ChrisW09 ChrisW09 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #523

Problem

CRPS.__call__ handled family="lognormal" in the same branch as "normal" and computed properscoring.crps_gaussian(y, mu=loc, sig=scale). For LogNormalDistribution, loc and scale are the mean and standard deviation of log(y), so outcome-scale targets were scored against a normal distribution on the log scale. A well-calibrated log-normal prediction scored about 59.6 where the exact CRPS is 2.49.

Fix

deeptab/metrics/distributional.py adds a closed-form _lognormal_crps(y, loc, scale) (Baran & Lerch, 2015). For observations y <= 0, below the support, it uses E[X] - y - E|X - X'| / 2. CRPS(family="lognormal") uses it directly, so it no longer needs properscoring or falls back to MAE without it. The other families are unchanged.

Tests

tests/metrics/test_distributional_metrics.py::TestDistributionalMetrics::test_lognormal_crps_matches_numerical_integration compares against numerical integration of the CRPS definition, including a negative target. It fails on main and passes with this change.

Docs

  • The CRPS docstring, in its summary and in the family notes, states that lognormal uses the exact closed form with log-scale loc/scale.
  • docs/api/metrics/index.rst: the CRPS warning and the metrics table row now describe the normal and lognormal layouts as exact.

Checks

ChrisW09 and others added 3 commits October 21, 2026 20:39
CRPS(family="lognormal") shared the Gaussian branch with "normal" and
scored the targets against N(loc, scale), although loc and scale are the
mean and standard deviation of log(y). Use the closed-form log-normal CRPS
(Baran & Lerch, 2015), including targets below the support, and update the
CRPS docstring and the metrics API page.

Fixes #523
@mkumar73
mkumar73 merged commit 8262cfe into main Nov 2, 2026
35 checks passed
@mkumar73
mkumar73 deleted the fix/lognormal-crps branch November 2, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] CRPS(family="lognormal") scores log-scale parameters as a Gaussian on the outcome scale

2 participants