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

Intgrad multiple inputs #321

Merged
merged 18 commits into from
Dec 2, 2020
Merged

Conversation

gipster
Copy link
Contributor

@gipster gipster commented Nov 25, 2020

Extends the integrated gradients method to model with multiple inputs. For each input of the model, attributions are calculated and returned in a list. Also extends the method allowing to calculate attributions for multiple internal layers. If a list of layers is passed, a list of attributions is returned.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@gipster gipster linked an issue Nov 25, 2020 that may be closed by this pull request
@gipster gipster requested a review from jklaise November 25, 2020 10:34
Copy link
Member

@jklaise jklaise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR Giovanni, mostly minor things to fix.

alibi/explainers/integrated_gradients.py Outdated Show resolved Hide resolved
alibi/explainers/integrated_gradients.py Outdated Show resolved Hide resolved
alibi/explainers/integrated_gradients.py Outdated Show resolved Hide resolved
alibi/explainers/integrated_gradients.py Outdated Show resolved Hide resolved
Comment on lines 326 to 332
def _calculate_sum_int(batches: List,
model: Union[tf.keras.Model, 'keras.Model'],
target: List,
target_paths: np.ndarray,
n_steps: int,
nb_samples: int,
step_sizes: List,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be more explicit about the types? Are these List[tf.Tensor] or List[List[tf.Tensor]]?

alibi/explainers/integrated_gradients.py Outdated Show resolved Hide resolved
alibi/explainers/integrated_gradients.py Outdated Show resolved Hide resolved
alibi/explainers/tests/test_integrated_gradients.py Outdated Show resolved Hide resolved
alibi/explainers/tests/test_integrated_gradients.py Outdated Show resolved Hide resolved
alibi/explainers/tests/test_integrated_gradients.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 1, 2020

Codecov Report

Merging #321 (e8cfb6b) into master (f4b1aae) will decrease coverage by 0.00%.
The diff coverage is 91.37%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #321      +/-   ##
==========================================
- Coverage   86.08%   86.07%   -0.01%     
==========================================
  Files          56       56              
  Lines        7029     7155     +126     
==========================================
+ Hits         6051     6159     +108     
- Misses        978      996      +18     
Impacted Files Coverage Δ
alibi/explainers/integrated_gradients.py 89.95% <85.85%> (-1.07%) ⬇️
...libi/explainers/tests/test_integrated_gradients.py 99.37% <98.66%> (-0.63%) ⬇️
alibi/explainers/anchor_base.py 89.24% <0.00%> (-2.85%) ⬇️

@jklaise jklaise self-requested a review December 2, 2020 15:06
@jklaise jklaise merged commit b310d34 into SeldonIO:master Dec 2, 2020
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.

Integrated Gradient Explainer for multiple inputs
2 participants