-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add filter functions for explanations and shap_values #120
base: main
Are you sure you want to change the base?
Conversation
# 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") |
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.
What do you think about making it more pandas-like? For example respiratory_idx = predictions == "Respiratory"
?
|
||
# 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( |
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.
Alternatively, I guess you can probably call the method get_sample_indices
inside this other method filter_by_class
, simplifying it for the user
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.
settled in this option for now
should I be aware of all time queued tests? |
Added filtration and helper function what aims to make the interface more user-friendly