-
Notifications
You must be signed in to change notification settings - Fork 0
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
Explainer base #38
Explainer base #38
Conversation
One thing to decide: Currently, the user is supposed to pass a functional explainer to the Randomization metric. I think metrics should accept both functional and stateful explainers. (we also have an interface that makes the stateful into a functional explainer) what do you think about this issue? |
This reverts commit 888aefd.
# Conflicts: # src/explainers/aggregators.py # src/explainers/base.py # src/explainers/captum/base.py # src/explainers/captum/captum_influence.py # src/explainers/captum/similarity.py # src/explainers/functional.py # tests/explainers/test_base_explainer.py # tests/explainers/test_explainers.py # tests/explainers/test_self_influence.py
Dilya the PR saver!! 🙏🏼 |
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.
Ready to merge from my side @gumityolcu
Hello @dilyabareeva
I have implemented the base explainer interface, and an interface for the captum base explanation class DataInfluence. It turns out that their subclasses have different names for the same parameters (module instead of model, influence_src_dataset instead of dataset etc.). CaptumSimilarityExplainer implements the Similarity explainer. Other explainers from captum should be similarly easily defined.
The base explainer's self_influence computes the full explanations for the training dataset and gets the diagonals.
IMPORTANT CHANGE: Our explainer_wrapper had a bug (torch.gather statement was not doing the correct thing). So I recreated the mnist_explanations_1 asset in the test assets folder.
I got rid of old implementations of explain_wrapper and self_influence.
I added functional versions for explainers and self_influence. These are bbuilt on a general interface funtion which takes an explainer class and makes it functional.
I also fixed the test according to all changes that I made. Randomization metric test uses the functional interface to use the stateful explainer. I seperately check that the functional, stateful and ground-truth self influences are correct. So I think all the code that I add here is covered in the tests.
Best ☮️
I think you will like most of it.