Skip to content
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

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

dniprocat
Copy link
Collaborator

Added filtration and helper function what aims to make the interface more user-friendly

@dniprocat dniprocat marked this pull request as ready for review April 15, 2024 18:12
# 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")
Copy link
Collaborator

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(
Copy link
Collaborator

@mirand863 mirand863 Apr 15, 2024

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

Copy link
Collaborator Author

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

@dniprocat
Copy link
Collaborator Author

should I be aware of all time queued tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants