interpret-community icon indicating copy to clipboard operation
interpret-community copied to clipboard

fix explanation adapter error when include_local=False and add tests

Open imatiach-msft opened this issue 2 years ago • 1 comments

While adding tests in explanation adapter to improve code coverage, I found an error when include_local=False which is fixed in this PR. The issue was that we called create_local in streaming mode, but the adapter does not have this method to compute importance values on the fly, and in fact we should just be aggregating the already computed local explanation instead. Also, this PR moves the DatasetWrapper import to use ml_wrappers directly instead.

imatiach-msft avatar Jun 14 '22 16:06 imatiach-msft

Codecov Report

Merging #529 (3507b4d) into main (6d1f31b) will increase coverage by 0.16%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #529      +/-   ##
==========================================
+ Coverage   86.74%   86.90%   +0.16%     
==========================================
  Files          62       62              
  Lines        4074     4086      +12     
==========================================
+ Hits         3534     3551      +17     
+ Misses        540      535       -5     
Flag Coverage Δ
unittests 86.90% <100.00%> (+0.16%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
python/interpret_community/lime/lime_explainer.py 95.80% <ø> (ø)
...mmunity/_internal/raw_explain/raw_explain_utils.py 100.00% <100.00%> (ø)
...interpret_community/adapter/explanation_adapter.py 92.85% <100.00%> (+12.85%) :arrow_up:
...n/interpret_community/common/blackbox_explainer.py 91.50% <100.00%> (ø)
python/interpret_community/dataset/decorator.py 100.00% <100.00%> (ø)
...hon/interpret_community/explanation/explanation.py 85.88% <100.00%> (+0.19%) :arrow_up:
...n/interpret_community/explanation/serialization.py 91.50% <100.00%> (ø)
...ython/interpret_community/mimic/mimic_explainer.py 97.04% <100.00%> (ø)
...n/interpret_community/shap/gpu_kernel_explainer.py 23.13% <100.00%> (ø)
...ython/interpret_community/shap/kernel_explainer.py 84.29% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6d1f31b...3507b4d. Read the comment docs.

codecov-commenter avatar Jun 14 '22 17:06 codecov-commenter