Repository navigation
feat: add waterfall plot for local explanations (#453) - #698
Open
laasyapriya2007 wants to merge 2 commits into
Open
laasyapriya2007 wants to merge 2 commits into
laasyapriya2007 wants to merge 2 commits into
Conversation
Add plot_waterfall in interpret.visual.plot and support plot_type='waterfall' in local explanation visualize() and show(). - Implements plot_waterfall to visualize instance score breakdown from intercept to final prediction. - Supports both horizontal and vertical orientations and configurable top_n with remaining features aggregation. - Extends FeatureValueExplanation, EBMExplanation, and LinearExplanation visualize() to support plot_type='waterfall'. - Adds unit tests for regression, binary, and multiclass waterfall visualizations. Signed-off-by: Laasya Priya <laasyapriya1234@gmail.com>
for more information, see https://pre-commit.ci
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #698 +/- ##
==========================================
+ Coverage 67.32% 67.46% +0.14%
==========================================
Files 77 77
Lines 11739 11815 +76
==========================================
+ Hits 7903 7971 +68
- Misses 3836 3844 +8 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Description
This PR resolves #453 by adding support for waterfall plots in local explanations.
Waterfall charts are one of the most effective and widely-used ways to visualize local additive feature attributions (similar to SHAP waterfall plots), clearly illustrating how the prediction is obtained starting from the base value (
Intercept), through individual feature score contributions, to the final modelPrediction.Key Changes
plot_waterfallininterpret.visual.plot:go.Waterfallcharts for local explanation data dictionaries.Interceptas the baseline, cascades each sorted feature score contribution, and terminates with atotalbar forPrediction.orientation="h", default) and vertical (orientation="v") orientations.top_n(defaults to 15), automatically aggregating the remaining lower-magnitude terms into an"Other features"step.class_idxselection).visualizeandshow):FeatureValueExplanation.visualize(key, plot_type="waterfall")EBMExplanation.visualize(key, plot_type="waterfall")LinearExplanation.visualize(key, plot_type="waterfall")interpret.show(local_exp, key=0, plot_type="waterfall")and inline / preserve providers.tests/visual/test_plot.pycovering basic waterfall generation, vertical layout,top_ngrouping, multiclass support, and model explanation visualization.How to Test