Add filter functions for explanations and shap_values#120
Open
iwan-tee wants to merge 31 commits intoscikit-learn-contrib:mainfrom
Open
Add filter functions for explanations and shap_values#120iwan-tee wants to merge 31 commits intoscikit-learn-contrib:mainfrom
iwan-tee wants to merge 31 commits intoscikit-learn-contrib:mainfrom
Conversation
mirand863
reviewed
Apr 15, 2024
| # Specify additional filters to obtain only level 0 | ||
| shap_filter = {"level": 0, "class": "Respiratory", "sample": respiratory_idx} | ||
| # Filter samples which only predicted "Respiratory" | ||
| respiratory_idx = explainer.get_sample_indices(predictions, "Respiratory") |
Collaborator
There was a problem hiding this comment.
What do you think about making it more pandas-like? For example respiratory_idx = predictions == "Respiratory"?
mirand863
reviewed
Apr 15, 2024
|
|
||
| # Use .sel() method to apply the filter and obtain filtered results | ||
| shap_val_respiratory = explanations.sel(shap_filter) | ||
| shap_val_respiratory = explainer.filter_by_class( |
Collaborator
There was a problem hiding this comment.
Alternatively, I guess you can probably call the method get_sample_indices inside this other method filter_by_class, simplifying it for the user
Collaborator
Author
There was a problem hiding this comment.
settled in this option for now
Collaborator
Author
|
should I be aware of all time queued tests? |
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.
Added filtration and helper function what aims to make the interface more user-friendly