Add CRPS metric scaffold for ensemble probabilistic evaluation - #229
Add CRPS metric scaffold for ensemble probabilistic evaluation#229Panchadip-128 wants to merge 4 commits into
Conversation
|
Hi @j6k4m8 @leifdenby @khintz , |
leifdenby
left a comment
There was a problem hiding this comment.
Thank you for this @Panchadip-128! Can you explain the motivation for this PR a bit more please? As I read it this PR doesn't add any ensemble architectures, but just adds some random noise to the deterministic model output, is that right?
|
Hi @leifdenby sir - thanks for the feedback and for reviewing the PR. You’re correct that this PR does not introduce a full ensemble architecture. The intent here though is to add CRPS as a modular probabilistic evaluation primitive, independent of the ensemble generation mechanism. The temporary stochastic sampling is only used to exercise the interface contract and validate tensor shapes, not as a final ensemble approach. The motivation is to establish ensemble-aware evaluation early while keeping the current deterministic training pipeline unchanged and enabling incremental probabilistic extensions. As follow-up work if you allow, I plan to propose PRs introducing: I’ll also update the PR description to clarify that this PR focuses on evaluation scaffolding rather than ensemble modelling accordingly. Thanks again for the guidance - happy to align with any preferred ordering of probabilistic components in the roadmap. |
|
Hi @leifdenby - thanks again for the previous feedbacks, based on that i have tried to improved this PR. I've expanded the scope so CRPS and ensemble generation can be reviewed Key changes:
I've also updated the PR description to reflect the expanded scope. Happy to discuss the IC perturbation approach, adjust scope, or remove Thanks so much for your time reviewing this! Regards. |
|
Hi , please let me know if any changes are required for this PR. If everything looks good I’ll mark it ready for review and apply any further suggestions. Thanks for your review - any guidance to improve this is appreciated. |
|
The name of this PR does not seem to match the scope at all now. If I understand correctly you are here proposing the addition of ensemble generation through IC perturbations? In general I would be very hesitant to merge in any ensemble method that does not build on a better structured model architecture such as discussed in #49 . My personal opinion is that ensembling through IC perturbations is generally a bad idea, and if you do it there is a lot of care needed with magnitudes and correlations. |
|
Thanks for the clarification - that helps a lot. Based on the discussion around #49, it makes sense that ensemble mechanisms should build on top of the upcoming model hierarchy refactor rather than being introduced directly in the current ARModel structure. To keep this PR aligned with that direction, I’ll simplify it back to its original goal: introducing the CRPS metric as a standalone probabilistic evaluation primitive within the metrics module, without modifying ARModel or adding ensemble generation logic. This keeps the change small and independent from the ongoing architecture work while still establishing the evaluation component that probabilistic models can use later. Would you prefer the CRPS metric to remain purely metric-side for now, or should it already support the expected ensemble tensor shapes used by future probabilistic models? Thanks again for the guidance - I’ll update the PR accordingly as you prefer and work on thereby. |
|
To avoid duplicate PRs that try to implement the CRPS metric, could you help out in #226 for now? Bring good ideas for the CRPS implementation there. |
|
Thanks for the guidance! That makes sense - consolidating the CRPS work into a single effort will definitely avoid duplicated implementations. I’ll look at #226 for now and contribute ideas and improvements so the CRPS implementation can evolve collaboratively. Happy to help refine the metric implementation and tests there. |
|
Thanks, then I'll close this. |
Describe your changes
Following @leifdenby's review feedback, this PR has been expanded beyond
the original scaffold scope. CRPS and ensemble generation are now
implemented together as a coherent unit.
Changes include:
sar,lagged_ic,hybrid)in
ar_model.pylagged_ic: IC perturbation along recent tendency vectors(structured IC spread, not random jitter)
hybrid: lagged_ic at t=0 + per-step SAR noise (IC + dynamicaluncertainty)
crps_ensembleimplementation incrps.py(energy-form CRPS, proper scoring rule)
crps_ensembleunder key"crps"inDEFINED_METRICS(
metrics.pyand__init__.py)neural_lam.metricsimport failures viaimportlibdynamic load(
get_metric,crps_ensemblenow importable cleanly)test_crps.py: shape, dtype, perfect ensemble → CRPS ≈ 0test_ar_model_ensemble_modes.py: lagged_ic + hybrid shape anddiversity tests
This PR does not modify existing training or loss pipelines. Fully
backward compatible with deterministic workflows.
Motivation and context
Probabilistic forecasting is a core research direction for neural weather
models. CRPS is the NWP standard for evaluating ensemble forecast quality —
a proper scoring rule that penalises both bias and spread errors.
The previous ensemble path added Gaussian jitter
x + εwith no clearensemble definition.
lagged_icaddresses this by perturbing initialconditions along recent temporal tendency vectors — systematic IC variants
consistent with lagged-average forecast ensembles in NWP.
hybridaddsper-step dynamical noise on top, covering both IC and process uncertainty.
This PR establishes foundational probabilistic output support and prepares
the codebase for deep ensembles, calibration analysis, and evaluation
pipeline integration.
What this PR does now
Three named ensemble modes (config-driven)
sarlagged_ichybridCRPS metric
Energy-form proper scoring rule, vectorised PyTorch, GPU-friendly.
Registered in
DEFINED_METRICSunder key"crps":Metrics API fix
neural_lam/metrics/__init__.pyperforms a pragmatic dynamic import(via
importlib) to avoid a package/module name collision — the directoryneural_lam/metrics/and the implementation filemetrics.pyshare aname that causes import-time failures. This loader is a minimal bridge
that keeps
metrics.pyas the single source of truth.Note: happy to follow up with a rename refactor if maintainers prefer
that style over the dynamic loader.
lagged_icperturbs initial conditions along recent temporal tendencyvectors — structured, interpretable IC spread, not random jitter. Members
are systematic IC variants consistent with IC-ensemble approaches in NWP
(cf. lagged-average forecasts).
hybridadds per-step dynamical noise on top, covering both IC uncertainty(dominant at short lead times) and process uncertainty (longer lead times).
Issue Link
N/A — foundational probabilistic evaluation support
Type of change
Checklist before requesting a review
pullwith--rebaseoption if possible).Checklist for reviewers
Each PR comes with its own improvements and flaws. The reviewer should check the following:
Author checklist after completed review
reflecting type of change (add section where missing):
Checklist for assignee