feat(models): add ContributionsPlotter for SHAP visualization#877
Merged
egordm merged 3 commits intoMay 15, 2026
Merged
Conversation
95a54d9 to
9c5fa72
Compare
Add ContributionsPlotter with heatmap, waterfall and bar chart methods for visualizing per-sample feature contributions (SHAP values). Signed-off-by: Fleur Petit <fleur.petit@alliander.com>
9c5fa72 to
332174d
Compare
- Fix filename typo: contibutions_plotter.py -> contributions_plotter.py - Update all imports to use corrected module name - Remove unnecessary BaseConfig (Pydantic) inheritance from ContributionsPlotter — it's a static-method namespace, not a config model - Add ValueError validation for invalid 'kind' in plot_contributions() - Add Raises section to plot_contributions() docstring Signed-off-by: Egor Dmitriev <egor.dmitriev@alliander.com>
egordm
reviewed
May 15, 2026
Collaborator
egordm
left a comment
There was a problem hiding this comment.
Pushed a fixup commit (ad52360f) addressing a few things:
- Renamed
contibutions_plotter.py→contributions_plotter.py(typo) and updated imports - Removed
BaseConfiginheritance fromContributionsPlotter— it only has static methods, no fields plot_contributions()now raisesValueErrorfor invalidkindvalues instead of a rawKeyError
All checks pass (lint, type, 20 tests).
…ct-contributions-shap
|
egordm
approved these changes
May 15, 2026
Collaborator
egordm
left a comment
There was a problem hiding this comment.
Very nice addition to OpenSTEF. It adds visualization to the explainability capability. Thanks!
I had a few nitpicks, but I pushed a commit to fix them.
Ready to merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Add ContributionsPlotter with heatmap, waterfall and bar chart methods for visualizing per-sample feature contributions (SHAP values).
✅ Acceptance criteria
Extended existing
ContributionsMixinto include plotting method using ContibutionsPlotter.One of 3 types of plots can be selected: