-
Notifications
You must be signed in to change notification settings - Fork 478
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
Adding IDGI to Captum #1284
Comments
@aobo-y I want to work on this feature addition. Should I get started? The paper is relatively new so it does not have too many citations but it outperforms existing Integrated Gradient methods by a great margin (as reported by their results and confirmed by my own experiments, along with great visual interpretation and multi-modality. It also follows most (but not all) axioms mentioned in the original Integrated Gradients paper |
@ShreeSinghi thank you for sharing the work! @vivekmig you may want to take a look and help? |
Should I get started? @vivekmig |
(making a new PR since I missed creating the design doc earlier)
RE: #1246
IDGI API Design
Background
IDGI (Important Direction Integrated Gradients) is a generalized framework that can be applied on top of any Integrated Gradients method. It works by removing the explanation noise by only considering the "important direction" while calculating the Riemann Sum.
The method requires an underlying path/method to be defined. The original paper shows results for 3 underlying paths/methods: IG, BlurIG, GIG, and in all cases, IDGI + baseline method outperforms the standalone baseline by far.
Requires:
Pseudocode:
Proposed Captum API Design for IDGI:
The design will be very similar to that of the
IntegratedGradients
class. The IDGI framework is very generic and works for any classification/regression model. For now, we only implement IDGI for the original IG method which defines the path as a linear interpolation between the baseline and input image, but in the future we can take an additionalmethod
argument and choose a different path as defined by GIG or BlurIG. The IDGI class inherits fromGradientAttribution
and contains complete implementation of the algorithm. The implementationConstructor:
Argument Descriptions:
forward_func
-torch.nn.Module
corresponding to model for which attributions are desired. This is consistent with all other attribution constructors in Captum.attribute:
Argument Descriptions:
These arguments follow standard definitions of the existing
![image](https://private-user-images.githubusercontent.com/41577064/335799652-97809025-65b8-4660-b938-6799fee0507b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI5ODczODYsIm5iZiI6MTcyMjk4NzA4NiwicGF0aCI6Ii80MTU3NzA2NC8zMzU3OTk2NTItOTc4MDkwMjUtNjViOC00NjYwLWI5MzgtNjc5OWZlZTA1MDdiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA2VDIzMzEyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRlZjFlMDg0NWI5M2Y2OGMwNzM5ZWFjODFmNTY3NmU1ZWFjYTRiN2ZiNTNjYTlmNDkxYWI5ZDNmM2IwM2E2NWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ux0-lb7yu_2Nf8ZcpdieAydrX4lUBKrTGHZzW5-HkUE)
IntegratedGradients
.Here's a comparison of the existing methods (top) and IDGI (bottom)
The text was updated successfully, but these errors were encountered: