-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ruff rule F821 (undefined name) #54
Conversation
a0dc862
to
c28fe5b
Compare
Codecov Report
@@ Coverage Diff @@
## master #54 +/- ##
==========================================
+ Coverage 53.39% 53.58% +0.19%
==========================================
Files 90 90
Lines 13028 12982 -46
==========================================
+ Hits 6956 6957 +1
+ Misses 6072 6025 -47
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This is a major PR, great work! Would it be possible to break it into a few smaller PRs, to make it a bit easier to review? |
okay (although, the changes are already split by the commits, so it'll be largely equivalent to reviewing the commits one-by-one) EDIT: I split out the Explanation and violin changes to their own PRs. The rest are small enough to remain here, I think. @connortann |
And also temporarily remove the SHAP interaction beeswarm plot code (it's not runnable at the moment, because we ensured that the ndim of SHAP values was 2 above, so it can never be 3 to trigger the interaction beeswarm plot here). The removal of code here is mostly just to appease ruff. Will create a separate issue for this to re-introduce SHAP interaction values plotting again later on. Maybe it should be implemented as a separate function.
I'll address the codecov issues in a separate PR. Please disregard coverage and review/merge the rest of the changes first. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll approve as is for now and open a new PR to address convert_color
, as this falls out of scope.
Related to Issue #21, and is a continuation of PR #25 when ruff was initially introduced to the project.
Dependencies: PR #53 (deprecating MimicExplainer) must be merged in first, because that's one of the main offenders of F821. ✅
Changes
The changes are quite major considering it involves mostly dead / unreachable code. Requesting a thorough review, but any review (even partial!) would be appreciated. I'll leave review comments in the relevant places later on to make code review a little easier for you guys, but here's the tl;dr:
✅ DONE in PR fix: Explanation hstack undefined name error #86Explanation.hstack
method was using a non-existent variable "axis" (probably copied from the other helper methods likesum
). The implementation as it is didn't make any sense, so I modified it to what I think made the most sense, which is to hstack the inner arrays and return a new Explanation object.beeswarm
plot function was using non-existent variables liketitle
,sort
,plot_type
which came from thesummary_legacy()
function, within an unreachable code block meant for SHAP interaction values. I've commented out the block for now to prevent ruff from complaining, but we should look into re-implementing this functionality. -> Issue Reimplement SHAP interaction values in beeswarm #56.I revamped✅ DONE in PR fix: violin plots tests #87violin
plot code quite a bit. The originalviolin
was essentially a copy-paste from thesummary_legacy()
function, so there's a lot of redundant code (including a call to a "non-existent"summary()
function) checking for "bar" or "dot" plot types. These have all been removed. Violin plots don't support multioutputs (only bar plots support this), so that section has been removed as well.I'll note that the code forviolin
is still in the "legacy" style. For e.g., it still acceptsshap_values
as a numpy array. Whereasbeeswarm
only takes inExplanation
objects, which I think we should align to that convention. -> Issue Refactor_violin
plot code and add examples #55.The plot tests for violin in✅ DONE in PR fix: violin plots tests #87test_violin.py
andtest_summary.py
were revamped. In particular, the original test was just an empty plot...