Skip to content

Stacked-area plot for ensemble model contributions #999

Description

@egordm

As a forecaster working with ensembles
I want to see how much each base model contributes to the forecast at each timestep
So that I can explain and debug ensemble behaviour

🌍 Background

EnsembleForecastingModel.predict_contributions() returns each base model's contribution per
quantile per timestep as a TimeSeriesDataset (columns {model}__{quantile}, e.g. gblinear__P50).
There is no model-level view for it yet. ContributionsPlotter (openstef_models.explainability.plotters)
already does the per-feature version; this is its model-level sibling.

Important

Changes should be done by forking main branch (main) and then make a PR back onto main branch.
Please read the contributing guide before you start.

❗Priority

Low. Explainability convenience, no deadline.

Definition of Done:

✅ Acceptance criteria

  • A new view takes the predict_contributions() TimeSeriesDataset and returns a Plotly go.Figure, following ContributionsPlotter conventions.
  • Two-panel, shared x-axis like ContributionsPlotter.plot_heatmap: top is the forecast over time, bottom is a stacked area of each base model's contribution.
  • The view takes a quantile argument (default P50) selecting which quantile to plot.
  • Can be saved to a standalone HTML file.
  • Demonstrated in an example (e.g. examples/tutorials/model_explainability.py).

📄 Documentation criteria:
Add it to the model explainability tutorial.

🧪 Test criteria:
Smoke test that the plot builder returns a go.Figure from a small synthetic contributions dataset.

⌛ Dependencies:
N/A

🚀 Releasing:
N/A

Other information:
Prior work: #789 (closed) implemented this against the outdated release/v4.0.0 branch. Useful
reference for the plotting approach (per-model series, quantile buttons, HTML export).

Metadata

Metadata

Assignees

Fields

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions