DiCE
DiCE copied to clipboard
Refactoring deep learning models to work with any explainer
[READY TO MERGE] Refactors deep learning model and explainers so that they are compatible with the sklearn explainers. sklearn explainers do not need access to gradient, so they should also work for deep learning models.
- DL and sklearn models need to have the same output
- DL methods employ user-provided encoding of features
-
model
needs to handle the conversion from raw to one hot encoded data - Remove any native calls to DL model's methods
- Updated tests, added torch as a test dependency
Possible fix to #246
Unit Test Results
261 tests +14 256 :heavy_check_mark: +14 19m 21s :stopwatch: + 8m 27s 1 suites ± 0 5 :zzz: ± 0 1 files ± 0 0 :x: ± 0
Results for commit d0127b47. ± Comparison against base commit 2e9d093c.
This pull request removes 29 and adds 43 tests. Note that renamed tests count towards both.
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_features_to_vary[1-2-features_to_vary0-kdtree]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_features_to_vary[1-2-features_to_vary1-random]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_invalid_query_instance[features_to_vary0-permitted_range0-inverse_mad]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_maxiter[0-7-kdtree-0]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_maxiter[0-7-random-0]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_no_cfs[7-3]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_permitted_range[1-2-all-permitted_range0-kdtree]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_permitted_range[1-2-all-permitted_range1-random]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_permitted_range_categorical[1-2-all-permitted_range0-kdtree]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_permitted_range_categorical[1-2-all-permitted_range1-random]
…
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_features_to_vary[sklearn-1-2-features_to_vary0-kdtree]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_features_to_vary[sklearn-1-2-features_to_vary1-random]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_invalid_query_instance[sklearn-features_to_vary0-permitted_range0-inverse_mad]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_maxiter[sklearn-0-7-kdtree-0]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_maxiter[sklearn-0-7-random-0]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_no_cfs[sklearn-7-3]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_permitted_range[sklearn-1-2-all-permitted_range0-kdtree]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_permitted_range[sklearn-1-2-all-permitted_range1-random]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_permitted_range_categorical[sklearn-1-2-all-permitted_range0-kdtree]
tests.test_dice_interface.test_dice_genetic.TestDiceGeneticBinaryClassificationMethods ‑ test_permitted_range_categorical[sklearn-1-2-all-permitted_range1-random]
…
:recycle: This comment has been updated with latest results.
Codecov Report
Merging #261 (28dcb9e) into master (48ef38c) will increase coverage by
0.38%
. The diff coverage is87.50%
.
@@ Coverage Diff @@
## master #261 +/- ##
==========================================
+ Coverage 71.51% 71.90% +0.38%
==========================================
Files 26 27 +1
Lines 3468 3541 +73
==========================================
+ Hits 2480 2546 +66
- Misses 988 995 +7
Flag | Coverage Δ | |
---|---|---|
unittests | 71.90% <87.50%> (+0.38%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
dice_ml/diverse_counterfactuals.py | 84.35% <ø> (ø) |
|
dice_ml/explainer_interfaces/dice_random.py | 91.72% <ø> (-1.56%) |
:arrow_down: |
dice_ml/explainer_interfaces/dice_tensorflow1.py | 0.00% <0.00%> (ø) |
|
dice_ml/explainer_interfaces/dice_genetic.py | 95.45% <81.81%> (-0.53%) |
:arrow_down: |
dice_ml/data_interfaces/private_data_interface.py | 80.53% <82.75%> (+0.24%) |
:arrow_up: |
dice_ml/dice.py | 80.95% <86.36%> (-1.55%) |
:arrow_down: |
dice_ml/data_interfaces/public_data_interface.py | 87.03% <87.50%> (-1.90%) |
:arrow_down: |
dice_ml/model_interfaces/pytorch_model.py | 89.65% <89.65%> (+0.18%) |
:arrow_up: |
dice_ml/data_interfaces/base_data_interface.py | 93.33% <96.42%> (+5.09%) |
:arrow_up: |
dice_ml/explainer_interfaces/explainer_base.py | 89.94% <96.42%> (+0.19%) |
:arrow_up: |
... and 13 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 48ef38c...28dcb9e. Read the comment docs.