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

Remove internal state from AnchorImage explainer #460

Merged
merged 13 commits into from
Aug 4, 2021

Conversation

adriangonz
Copy link

Part of #453 (only covering one explainer)

Changelog

  • Refactor sampling methods to a new AnchorImageSampler object
  • Move out the _scale static method into a utils module
  • Add (dumb) test to make sure the AnchorImage explainer holds no internal state

@adriangonz adriangonz requested a review from jklaise August 2, 2021 13:02
Adrian Gonzalez-Martin added 2 commits August 2, 2021 15:29
@codecov
Copy link

codecov bot commented Aug 3, 2021

Codecov Report

Merging #460 (f967f53) into master (390a255) will decrease coverage by 0.04%.
The diff coverage is 91.20%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #460      +/-   ##
==========================================
- Coverage   86.92%   86.87%   -0.05%     
==========================================
  Files          58       58              
  Lines        8328     8350      +22     
==========================================
+ Hits         7239     7254      +15     
- Misses       1089     1096       +7     
Impacted Files Coverage Δ
alibi/explainers/anchor_image.py 90.66% <87.17%> (-3.62%) ⬇️
alibi/explainers/tests/test_anchor_image.py 98.55% <97.87%> (+0.30%) ⬆️
alibi/explainers/__init__.py 85.71% <0.00%> (-7.15%) ⬇️

Copy link
Contributor

@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 @adriangonz, looking good!

The only two things I would suggest are:

  • Keep to one module for the public class + utility functions + sampler as the implementation is not that complex to warrant splitting out into several modules, same for keeping to one test module
  • We should check what the increase in test times is due to the extra test that calls explain as it's expensive (looks like adding ~3 minutes on top compared to master). Maybe we should combine the stateless test together with the main test to reduce runtimes (at the expense of tests not testing a single behaviour) ?

alibi/explainers/anchor_image_sampler.py Outdated Show resolved Hide resolved
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