explainiverse 0.2.3__py3-none-any.whl → 0.2.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- explainiverse/__init__.py +1 -1
- explainiverse/core/registry.py +53 -0
- explainiverse/explainers/__init__.py +5 -0
- explainiverse/explainers/gradient/__init__.py +8 -1
- explainiverse/explainers/gradient/deeplift.py +745 -0
- explainiverse/explainers/gradient/gradcam.py +390 -0
- {explainiverse-0.2.3.dist-info → explainiverse-0.2.5.dist-info}/METADATA +38 -8
- {explainiverse-0.2.3.dist-info → explainiverse-0.2.5.dist-info}/RECORD +10 -8
- {explainiverse-0.2.3.dist-info → explainiverse-0.2.5.dist-info}/LICENSE +0 -0
- {explainiverse-0.2.3.dist-info → explainiverse-0.2.5.dist-info}/WHEEL +0 -0
explainiverse/__init__.py
CHANGED
explainiverse/core/registry.py
CHANGED
|
@@ -370,6 +370,8 @@ def _create_default_registry() -> ExplainerRegistry:
|
|
|
370
370
|
from explainiverse.explainers.global_explainers.sage import SAGEExplainer
|
|
371
371
|
from explainiverse.explainers.counterfactual.dice_wrapper import CounterfactualExplainer
|
|
372
372
|
from explainiverse.explainers.gradient.integrated_gradients import IntegratedGradientsExplainer
|
|
373
|
+
from explainiverse.explainers.gradient.gradcam import GradCAMExplainer
|
|
374
|
+
from explainiverse.explainers.gradient.deeplift import DeepLIFTExplainer, DeepLIFTShapExplainer
|
|
373
375
|
|
|
374
376
|
registry = ExplainerRegistry()
|
|
375
377
|
|
|
@@ -479,6 +481,57 @@ def _create_default_registry() -> ExplainerRegistry:
|
|
|
479
481
|
)
|
|
480
482
|
)
|
|
481
483
|
|
|
484
|
+
# Register GradCAM (for CNNs)
|
|
485
|
+
registry.register(
|
|
486
|
+
name="gradcam",
|
|
487
|
+
explainer_class=GradCAMExplainer,
|
|
488
|
+
meta=ExplainerMeta(
|
|
489
|
+
scope="local",
|
|
490
|
+
model_types=["neural"],
|
|
491
|
+
data_types=["image"],
|
|
492
|
+
task_types=["classification"],
|
|
493
|
+
description="GradCAM/GradCAM++ - visual explanations for CNNs via gradient-weighted activations (requires PyTorch)",
|
|
494
|
+
paper_reference="Selvaraju et al., 2017 - 'Grad-CAM: Visual Explanations from Deep Networks' (ICCV)",
|
|
495
|
+
complexity="O(forward_pass + backward_pass)",
|
|
496
|
+
requires_training_data=False,
|
|
497
|
+
supports_batching=True
|
|
498
|
+
)
|
|
499
|
+
)
|
|
500
|
+
|
|
501
|
+
# Register DeepLIFT (for neural networks)
|
|
502
|
+
registry.register(
|
|
503
|
+
name="deeplift",
|
|
504
|
+
explainer_class=DeepLIFTExplainer,
|
|
505
|
+
meta=ExplainerMeta(
|
|
506
|
+
scope="local",
|
|
507
|
+
model_types=["neural"],
|
|
508
|
+
data_types=["tabular", "image"],
|
|
509
|
+
task_types=["classification", "regression"],
|
|
510
|
+
description="DeepLIFT - reference-based attributions via activation differences (requires PyTorch)",
|
|
511
|
+
paper_reference="Shrikumar et al., 2017 - 'Learning Important Features Through Propagating Activation Differences' (ICML)",
|
|
512
|
+
complexity="O(forward_pass + backward_pass)",
|
|
513
|
+
requires_training_data=False,
|
|
514
|
+
supports_batching=True
|
|
515
|
+
)
|
|
516
|
+
)
|
|
517
|
+
|
|
518
|
+
# Register DeepSHAP (DeepLIFT + SHAP)
|
|
519
|
+
registry.register(
|
|
520
|
+
name="deepshap",
|
|
521
|
+
explainer_class=DeepLIFTShapExplainer,
|
|
522
|
+
meta=ExplainerMeta(
|
|
523
|
+
scope="local",
|
|
524
|
+
model_types=["neural"],
|
|
525
|
+
data_types=["tabular", "image"],
|
|
526
|
+
task_types=["classification", "regression"],
|
|
527
|
+
description="DeepSHAP - DeepLIFT averaged over background samples for SHAP values (requires PyTorch)",
|
|
528
|
+
paper_reference="Lundberg & Lee, 2017 - combines DeepLIFT with SHAP",
|
|
529
|
+
complexity="O(n_background * forward_pass)",
|
|
530
|
+
requires_training_data=True,
|
|
531
|
+
supports_batching=True
|
|
532
|
+
)
|
|
533
|
+
)
|
|
534
|
+
|
|
482
535
|
# =========================================================================
|
|
483
536
|
# Global Explainers (model-level)
|
|
484
537
|
# =========================================================================
|
|
@@ -27,6 +27,8 @@ from explainiverse.explainers.global_explainers.partial_dependence import Partia
|
|
|
27
27
|
from explainiverse.explainers.global_explainers.ale import ALEExplainer
|
|
28
28
|
from explainiverse.explainers.global_explainers.sage import SAGEExplainer
|
|
29
29
|
from explainiverse.explainers.gradient.integrated_gradients import IntegratedGradientsExplainer
|
|
30
|
+
from explainiverse.explainers.gradient.gradcam import GradCAMExplainer
|
|
31
|
+
from explainiverse.explainers.gradient.deeplift import DeepLIFTExplainer, DeepLIFTShapExplainer
|
|
30
32
|
|
|
31
33
|
__all__ = [
|
|
32
34
|
# Local explainers
|
|
@@ -36,6 +38,9 @@ __all__ = [
|
|
|
36
38
|
"AnchorsExplainer",
|
|
37
39
|
"CounterfactualExplainer",
|
|
38
40
|
"IntegratedGradientsExplainer",
|
|
41
|
+
"GradCAMExplainer",
|
|
42
|
+
"DeepLIFTExplainer",
|
|
43
|
+
"DeepLIFTShapExplainer",
|
|
39
44
|
# Global explainers
|
|
40
45
|
"PermutationImportanceExplainer",
|
|
41
46
|
"PartialDependenceExplainer",
|
|
@@ -7,5 +7,12 @@ typically via the PyTorchAdapter.
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
from explainiverse.explainers.gradient.integrated_gradients import IntegratedGradientsExplainer
|
|
10
|
+
from explainiverse.explainers.gradient.gradcam import GradCAMExplainer
|
|
11
|
+
from explainiverse.explainers.gradient.deeplift import DeepLIFTExplainer, DeepLIFTShapExplainer
|
|
10
12
|
|
|
11
|
-
__all__ = [
|
|
13
|
+
__all__ = [
|
|
14
|
+
"IntegratedGradientsExplainer",
|
|
15
|
+
"GradCAMExplainer",
|
|
16
|
+
"DeepLIFTExplainer",
|
|
17
|
+
"DeepLIFTShapExplainer",
|
|
18
|
+
]
|