explainiverse 0.6.0__tar.gz → 0.7.0__tar.gz
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-0.6.0 → explainiverse-0.7.0}/PKG-INFO +60 -9
- {explainiverse-0.6.0 → explainiverse-0.7.0}/README.md +59 -8
- {explainiverse-0.6.0 → explainiverse-0.7.0}/pyproject.toml +1 -1
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/__init__.py +1 -1
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/core/registry.py +18 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/gradient/__init__.py +12 -0
- explainiverse-0.7.0/src/explainiverse/explainers/gradient/tcav.py +865 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/LICENSE +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/adapters/__init__.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/adapters/base_adapter.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/adapters/pytorch_adapter.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/adapters/sklearn_adapter.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/core/__init__.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/core/explainer.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/core/explanation.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/engine/__init__.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/engine/suite.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/evaluation/__init__.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/evaluation/_utils.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/evaluation/faithfulness.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/evaluation/metrics.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/evaluation/stability.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/__init__.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/attribution/__init__.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/attribution/lime_wrapper.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/attribution/shap_wrapper.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/attribution/treeshap_wrapper.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/counterfactual/__init__.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/counterfactual/dice_wrapper.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/example_based/__init__.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/example_based/protodash.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/global_explainers/__init__.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/global_explainers/ale.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/global_explainers/partial_dependence.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/global_explainers/permutation_importance.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/global_explainers/sage.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/gradient/deeplift.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/gradient/gradcam.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/gradient/integrated_gradients.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/gradient/saliency.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/gradient/smoothgrad.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/rule_based/__init__.py +0 -0
- {explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/rule_based/anchors_wrapper.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: explainiverse
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Unified, extensible explainability framework supporting LIME, SHAP, Anchors, Counterfactuals, PDP, ALE, SAGE, and more
|
|
5
5
|
Home-page: https://github.com/jemsbhai/explainiverse
|
|
6
6
|
License: MIT
|
|
@@ -35,7 +35,7 @@ Description-Content-Type: text/markdown
|
|
|
35
35
|
[](https://www.python.org/downloads/)
|
|
36
36
|
[](https://opensource.org/licenses/MIT)
|
|
37
37
|
|
|
38
|
-
**Explainiverse** is a unified, extensible Python framework for Explainable AI (XAI). It provides a standardized interface for **
|
|
38
|
+
**Explainiverse** is a unified, extensible Python framework for Explainable AI (XAI). It provides a standardized interface for **17 state-of-the-art explanation methods** across local, global, gradient-based, concept-based, and example-based paradigms, along with **comprehensive evaluation metrics** for assessing explanation quality.
|
|
39
39
|
|
|
40
40
|
---
|
|
41
41
|
|
|
@@ -43,7 +43,7 @@ Description-Content-Type: text/markdown
|
|
|
43
43
|
|
|
44
44
|
| Feature | Description |
|
|
45
45
|
|---------|-------------|
|
|
46
|
-
| **
|
|
46
|
+
| **17 Explainers** | LIME, KernelSHAP, TreeSHAP, Integrated Gradients, DeepLIFT, DeepSHAP, SmoothGrad, Saliency Maps, GradCAM/GradCAM++, TCAV, Anchors, Counterfactual, Permutation Importance, PDP, ALE, SAGE, ProtoDash |
|
|
47
47
|
| **8 Evaluation Metrics** | Faithfulness (PGI, PGU, Comprehensiveness, Sufficiency, Correlation) and Stability (RIS, ROS, Lipschitz) |
|
|
48
48
|
| **Unified API** | Consistent `BaseExplainer` interface with standardized `Explanation` output |
|
|
49
49
|
| **Plugin Registry** | Filter explainers by scope, model type, data type; automatic recommendations |
|
|
@@ -66,6 +66,7 @@ Description-Content-Type: text/markdown
|
|
|
66
66
|
| **SmoothGrad** | Gradient | [Smilkov et al., 2017](https://arxiv.org/abs/1706.03825) |
|
|
67
67
|
| **Saliency Maps** | Gradient | [Simonyan et al., 2014](https://arxiv.org/abs/1312.6034) |
|
|
68
68
|
| **GradCAM / GradCAM++** | Gradient (CNN) | [Selvaraju et al., 2017](https://arxiv.org/abs/1610.02391) |
|
|
69
|
+
| **TCAV** | Concept-Based | [Kim et al., 2018](https://arxiv.org/abs/1711.11279) |
|
|
69
70
|
| **Anchors** | Rule-Based | [Ribeiro et al., 2018](https://ojs.aaai.org/index.php/AAAI/article/view/11491) |
|
|
70
71
|
| **Counterfactual** | Contrastive | [Mothilal et al., 2020](https://arxiv.org/abs/1905.07697) |
|
|
71
72
|
| **ProtoDash** | Example-Based | [Gurumoorthy et al., 2019](https://arxiv.org/abs/1707.01212) |
|
|
@@ -142,8 +143,8 @@ adapter = SklearnAdapter(model, class_names=iris.target_names.tolist())
|
|
|
142
143
|
# List all available explainers
|
|
143
144
|
print(default_registry.list_explainers())
|
|
144
145
|
# ['lime', 'shap', 'treeshap', 'integrated_gradients', 'deeplift', 'deepshap',
|
|
145
|
-
# 'smoothgrad', 'gradcam', '
|
|
146
|
-
# 'permutation_importance', 'partial_dependence', 'ale', 'sage']
|
|
146
|
+
# 'smoothgrad', 'saliency', 'gradcam', 'tcav', 'anchors', 'counterfactual',
|
|
147
|
+
# 'protodash', 'permutation_importance', 'partial_dependence', 'ale', 'sage']
|
|
147
148
|
|
|
148
149
|
# Create an explainer via registry
|
|
149
150
|
explainer = default_registry.create(
|
|
@@ -317,6 +318,56 @@ heatmap = explanation.explanation_data["heatmap"]
|
|
|
317
318
|
overlay = explainer.get_overlay(original_image, heatmap, alpha=0.5)
|
|
318
319
|
```
|
|
319
320
|
|
|
321
|
+
### TCAV (Concept-Based Explanations)
|
|
322
|
+
|
|
323
|
+
```python
|
|
324
|
+
from explainiverse.explainers.gradient import TCAVExplainer
|
|
325
|
+
|
|
326
|
+
# For neural network models with concept examples
|
|
327
|
+
adapter = PyTorchAdapter(model, task="classification", class_names=class_names)
|
|
328
|
+
|
|
329
|
+
# Create TCAV explainer targeting a specific layer
|
|
330
|
+
explainer = TCAVExplainer(
|
|
331
|
+
model=adapter,
|
|
332
|
+
layer_name="layer3", # Target layer for concept analysis
|
|
333
|
+
class_names=class_names
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
# Learn a concept from examples (e.g., "striped" pattern)
|
|
337
|
+
explainer.learn_concept(
|
|
338
|
+
concept_name="striped",
|
|
339
|
+
concept_examples=striped_images, # Images with stripes
|
|
340
|
+
negative_examples=random_images, # Random images without stripes
|
|
341
|
+
min_accuracy=0.6 # Minimum CAV classifier accuracy
|
|
342
|
+
)
|
|
343
|
+
|
|
344
|
+
# Compute TCAV score: fraction of inputs where concept positively influences prediction
|
|
345
|
+
tcav_score = explainer.compute_tcav_score(
|
|
346
|
+
test_inputs=test_images,
|
|
347
|
+
target_class=0, # e.g., "zebra"
|
|
348
|
+
concept_name="striped"
|
|
349
|
+
)
|
|
350
|
+
print(f"TCAV score: {tcav_score:.3f}") # >0.5 means concept positively influences class
|
|
351
|
+
|
|
352
|
+
# Statistical significance testing against random concepts
|
|
353
|
+
result = explainer.statistical_significance_test(
|
|
354
|
+
test_inputs=test_images,
|
|
355
|
+
target_class=0,
|
|
356
|
+
concept_name="striped",
|
|
357
|
+
n_random=10,
|
|
358
|
+
negative_examples=random_images
|
|
359
|
+
)
|
|
360
|
+
print(f"p-value: {result['p_value']:.4f}, significant: {result['significant']}")
|
|
361
|
+
|
|
362
|
+
# Full explanation with multiple concepts
|
|
363
|
+
explanation = explainer.explain(
|
|
364
|
+
test_inputs=test_images,
|
|
365
|
+
target_class=0,
|
|
366
|
+
run_significance_test=True
|
|
367
|
+
)
|
|
368
|
+
print(explanation.explanation_data["tcav_scores"])
|
|
369
|
+
```
|
|
370
|
+
|
|
320
371
|
---
|
|
321
372
|
|
|
322
373
|
## Example-Based Explanations
|
|
@@ -551,7 +602,7 @@ explainiverse/
|
|
|
551
602
|
│ └── pytorch_adapter.py # With gradient support
|
|
552
603
|
├── explainers/
|
|
553
604
|
│ ├── attribution/ # LIME, SHAP, TreeSHAP
|
|
554
|
-
│ ├── gradient/ # IG, DeepLIFT, DeepSHAP, SmoothGrad, GradCAM
|
|
605
|
+
│ ├── gradient/ # IG, DeepLIFT, DeepSHAP, SmoothGrad, Saliency, GradCAM, TCAV
|
|
555
606
|
│ ├── rule_based/ # Anchors
|
|
556
607
|
│ ├── counterfactual/ # DiCE-style
|
|
557
608
|
│ ├── global_explainers/ # Permutation, PDP, ALE, SAGE
|
|
@@ -589,6 +640,7 @@ poetry run pytest tests/test_smoothgrad.py::TestSmoothGradBasic -v
|
|
|
589
640
|
- [x] Core framework (BaseExplainer, Explanation, Registry)
|
|
590
641
|
- [x] Perturbation methods: LIME, KernelSHAP, TreeSHAP
|
|
591
642
|
- [x] Gradient methods: Integrated Gradients, DeepLIFT, DeepSHAP, SmoothGrad, Saliency Maps, GradCAM/GradCAM++
|
|
643
|
+
- [x] Concept-based: TCAV (Testing with Concept Activation Vectors)
|
|
592
644
|
- [x] Rule-based: Anchors
|
|
593
645
|
- [x] Counterfactual: DiCE-style
|
|
594
646
|
- [x] Global: Permutation Importance, PDP, ALE, SAGE
|
|
@@ -598,7 +650,6 @@ poetry run pytest tests/test_smoothgrad.py::TestSmoothGradBasic -v
|
|
|
598
650
|
- [x] PyTorch adapter with gradient support
|
|
599
651
|
|
|
600
652
|
### In Progress 🚧
|
|
601
|
-
- [ ] TCAV (Testing with Concept Activation Vectors)
|
|
602
653
|
- [ ] Layer-wise Relevance Propagation (LRP)
|
|
603
654
|
|
|
604
655
|
### Planned 📋
|
|
@@ -620,7 +671,7 @@ If you use Explainiverse in your research, please cite:
|
|
|
620
671
|
author = {Syed, Muntaser},
|
|
621
672
|
year = {2025},
|
|
622
673
|
url = {https://github.com/jemsbhai/explainiverse},
|
|
623
|
-
version = {0.
|
|
674
|
+
version = {0.7.0}
|
|
624
675
|
}
|
|
625
676
|
```
|
|
626
677
|
|
|
@@ -648,5 +699,5 @@ MIT License - see [LICENSE](LICENSE) for details.
|
|
|
648
699
|
|
|
649
700
|
## Acknowledgments
|
|
650
701
|
|
|
651
|
-
Explainiverse builds upon the foundational work of many researchers in the XAI community. We thank the authors of LIME, SHAP, Integrated Gradients, DeepLIFT, GradCAM, Anchors, DiCE, ALE, SAGE, and ProtoDash for their contributions to interpretable machine learning.
|
|
702
|
+
Explainiverse builds upon the foundational work of many researchers in the XAI community. We thank the authors of LIME, SHAP, Integrated Gradients, DeepLIFT, GradCAM, TCAV, Anchors, DiCE, ALE, SAGE, and ProtoDash for their contributions to interpretable machine learning.
|
|
652
703
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://www.python.org/downloads/)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
|
-
**Explainiverse** is a unified, extensible Python framework for Explainable AI (XAI). It provides a standardized interface for **
|
|
7
|
+
**Explainiverse** is a unified, extensible Python framework for Explainable AI (XAI). It provides a standardized interface for **17 state-of-the-art explanation methods** across local, global, gradient-based, concept-based, and example-based paradigms, along with **comprehensive evaluation metrics** for assessing explanation quality.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
| Feature | Description |
|
|
14
14
|
|---------|-------------|
|
|
15
|
-
| **
|
|
15
|
+
| **17 Explainers** | LIME, KernelSHAP, TreeSHAP, Integrated Gradients, DeepLIFT, DeepSHAP, SmoothGrad, Saliency Maps, GradCAM/GradCAM++, TCAV, Anchors, Counterfactual, Permutation Importance, PDP, ALE, SAGE, ProtoDash |
|
|
16
16
|
| **8 Evaluation Metrics** | Faithfulness (PGI, PGU, Comprehensiveness, Sufficiency, Correlation) and Stability (RIS, ROS, Lipschitz) |
|
|
17
17
|
| **Unified API** | Consistent `BaseExplainer` interface with standardized `Explanation` output |
|
|
18
18
|
| **Plugin Registry** | Filter explainers by scope, model type, data type; automatic recommendations |
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
| **SmoothGrad** | Gradient | [Smilkov et al., 2017](https://arxiv.org/abs/1706.03825) |
|
|
36
36
|
| **Saliency Maps** | Gradient | [Simonyan et al., 2014](https://arxiv.org/abs/1312.6034) |
|
|
37
37
|
| **GradCAM / GradCAM++** | Gradient (CNN) | [Selvaraju et al., 2017](https://arxiv.org/abs/1610.02391) |
|
|
38
|
+
| **TCAV** | Concept-Based | [Kim et al., 2018](https://arxiv.org/abs/1711.11279) |
|
|
38
39
|
| **Anchors** | Rule-Based | [Ribeiro et al., 2018](https://ojs.aaai.org/index.php/AAAI/article/view/11491) |
|
|
39
40
|
| **Counterfactual** | Contrastive | [Mothilal et al., 2020](https://arxiv.org/abs/1905.07697) |
|
|
40
41
|
| **ProtoDash** | Example-Based | [Gurumoorthy et al., 2019](https://arxiv.org/abs/1707.01212) |
|
|
@@ -111,8 +112,8 @@ adapter = SklearnAdapter(model, class_names=iris.target_names.tolist())
|
|
|
111
112
|
# List all available explainers
|
|
112
113
|
print(default_registry.list_explainers())
|
|
113
114
|
# ['lime', 'shap', 'treeshap', 'integrated_gradients', 'deeplift', 'deepshap',
|
|
114
|
-
# 'smoothgrad', 'gradcam', '
|
|
115
|
-
# 'permutation_importance', 'partial_dependence', 'ale', 'sage']
|
|
115
|
+
# 'smoothgrad', 'saliency', 'gradcam', 'tcav', 'anchors', 'counterfactual',
|
|
116
|
+
# 'protodash', 'permutation_importance', 'partial_dependence', 'ale', 'sage']
|
|
116
117
|
|
|
117
118
|
# Create an explainer via registry
|
|
118
119
|
explainer = default_registry.create(
|
|
@@ -286,6 +287,56 @@ heatmap = explanation.explanation_data["heatmap"]
|
|
|
286
287
|
overlay = explainer.get_overlay(original_image, heatmap, alpha=0.5)
|
|
287
288
|
```
|
|
288
289
|
|
|
290
|
+
### TCAV (Concept-Based Explanations)
|
|
291
|
+
|
|
292
|
+
```python
|
|
293
|
+
from explainiverse.explainers.gradient import TCAVExplainer
|
|
294
|
+
|
|
295
|
+
# For neural network models with concept examples
|
|
296
|
+
adapter = PyTorchAdapter(model, task="classification", class_names=class_names)
|
|
297
|
+
|
|
298
|
+
# Create TCAV explainer targeting a specific layer
|
|
299
|
+
explainer = TCAVExplainer(
|
|
300
|
+
model=adapter,
|
|
301
|
+
layer_name="layer3", # Target layer for concept analysis
|
|
302
|
+
class_names=class_names
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
# Learn a concept from examples (e.g., "striped" pattern)
|
|
306
|
+
explainer.learn_concept(
|
|
307
|
+
concept_name="striped",
|
|
308
|
+
concept_examples=striped_images, # Images with stripes
|
|
309
|
+
negative_examples=random_images, # Random images without stripes
|
|
310
|
+
min_accuracy=0.6 # Minimum CAV classifier accuracy
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
# Compute TCAV score: fraction of inputs where concept positively influences prediction
|
|
314
|
+
tcav_score = explainer.compute_tcav_score(
|
|
315
|
+
test_inputs=test_images,
|
|
316
|
+
target_class=0, # e.g., "zebra"
|
|
317
|
+
concept_name="striped"
|
|
318
|
+
)
|
|
319
|
+
print(f"TCAV score: {tcav_score:.3f}") # >0.5 means concept positively influences class
|
|
320
|
+
|
|
321
|
+
# Statistical significance testing against random concepts
|
|
322
|
+
result = explainer.statistical_significance_test(
|
|
323
|
+
test_inputs=test_images,
|
|
324
|
+
target_class=0,
|
|
325
|
+
concept_name="striped",
|
|
326
|
+
n_random=10,
|
|
327
|
+
negative_examples=random_images
|
|
328
|
+
)
|
|
329
|
+
print(f"p-value: {result['p_value']:.4f}, significant: {result['significant']}")
|
|
330
|
+
|
|
331
|
+
# Full explanation with multiple concepts
|
|
332
|
+
explanation = explainer.explain(
|
|
333
|
+
test_inputs=test_images,
|
|
334
|
+
target_class=0,
|
|
335
|
+
run_significance_test=True
|
|
336
|
+
)
|
|
337
|
+
print(explanation.explanation_data["tcav_scores"])
|
|
338
|
+
```
|
|
339
|
+
|
|
289
340
|
---
|
|
290
341
|
|
|
291
342
|
## Example-Based Explanations
|
|
@@ -520,7 +571,7 @@ explainiverse/
|
|
|
520
571
|
│ └── pytorch_adapter.py # With gradient support
|
|
521
572
|
├── explainers/
|
|
522
573
|
│ ├── attribution/ # LIME, SHAP, TreeSHAP
|
|
523
|
-
│ ├── gradient/ # IG, DeepLIFT, DeepSHAP, SmoothGrad, GradCAM
|
|
574
|
+
│ ├── gradient/ # IG, DeepLIFT, DeepSHAP, SmoothGrad, Saliency, GradCAM, TCAV
|
|
524
575
|
│ ├── rule_based/ # Anchors
|
|
525
576
|
│ ├── counterfactual/ # DiCE-style
|
|
526
577
|
│ ├── global_explainers/ # Permutation, PDP, ALE, SAGE
|
|
@@ -558,6 +609,7 @@ poetry run pytest tests/test_smoothgrad.py::TestSmoothGradBasic -v
|
|
|
558
609
|
- [x] Core framework (BaseExplainer, Explanation, Registry)
|
|
559
610
|
- [x] Perturbation methods: LIME, KernelSHAP, TreeSHAP
|
|
560
611
|
- [x] Gradient methods: Integrated Gradients, DeepLIFT, DeepSHAP, SmoothGrad, Saliency Maps, GradCAM/GradCAM++
|
|
612
|
+
- [x] Concept-based: TCAV (Testing with Concept Activation Vectors)
|
|
561
613
|
- [x] Rule-based: Anchors
|
|
562
614
|
- [x] Counterfactual: DiCE-style
|
|
563
615
|
- [x] Global: Permutation Importance, PDP, ALE, SAGE
|
|
@@ -567,7 +619,6 @@ poetry run pytest tests/test_smoothgrad.py::TestSmoothGradBasic -v
|
|
|
567
619
|
- [x] PyTorch adapter with gradient support
|
|
568
620
|
|
|
569
621
|
### In Progress 🚧
|
|
570
|
-
- [ ] TCAV (Testing with Concept Activation Vectors)
|
|
571
622
|
- [ ] Layer-wise Relevance Propagation (LRP)
|
|
572
623
|
|
|
573
624
|
### Planned 📋
|
|
@@ -589,7 +640,7 @@ If you use Explainiverse in your research, please cite:
|
|
|
589
640
|
author = {Syed, Muntaser},
|
|
590
641
|
year = {2025},
|
|
591
642
|
url = {https://github.com/jemsbhai/explainiverse},
|
|
592
|
-
version = {0.
|
|
643
|
+
version = {0.7.0}
|
|
593
644
|
}
|
|
594
645
|
```
|
|
595
646
|
|
|
@@ -617,4 +668,4 @@ MIT License - see [LICENSE](LICENSE) for details.
|
|
|
617
668
|
|
|
618
669
|
## Acknowledgments
|
|
619
670
|
|
|
620
|
-
Explainiverse builds upon the foundational work of many researchers in the XAI community. We thank the authors of LIME, SHAP, Integrated Gradients, DeepLIFT, GradCAM, Anchors, DiCE, ALE, SAGE, and ProtoDash for their contributions to interpretable machine learning.
|
|
671
|
+
Explainiverse builds upon the foundational work of many researchers in the XAI community. We thank the authors of LIME, SHAP, Integrated Gradients, DeepLIFT, GradCAM, TCAV, Anchors, DiCE, ALE, SAGE, and ProtoDash for their contributions to interpretable machine learning.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "explainiverse"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.7.0"
|
|
4
4
|
description = "Unified, extensible explainability framework supporting LIME, SHAP, Anchors, Counterfactuals, PDP, ALE, SAGE, and more"
|
|
5
5
|
authors = ["Muntaser Syed <jemsbhai@gmail.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -374,6 +374,7 @@ def _create_default_registry() -> ExplainerRegistry:
|
|
|
374
374
|
from explainiverse.explainers.gradient.deeplift import DeepLIFTExplainer, DeepLIFTShapExplainer
|
|
375
375
|
from explainiverse.explainers.gradient.smoothgrad import SmoothGradExplainer
|
|
376
376
|
from explainiverse.explainers.gradient.saliency import SaliencyExplainer
|
|
377
|
+
from explainiverse.explainers.gradient.tcav import TCAVExplainer
|
|
377
378
|
from explainiverse.explainers.example_based.protodash import ProtoDashExplainer
|
|
378
379
|
|
|
379
380
|
registry = ExplainerRegistry()
|
|
@@ -569,6 +570,23 @@ def _create_default_registry() -> ExplainerRegistry:
|
|
|
569
570
|
)
|
|
570
571
|
)
|
|
571
572
|
|
|
573
|
+
# Register TCAV (Concept-based explanations for neural networks)
|
|
574
|
+
registry.register(
|
|
575
|
+
name="tcav",
|
|
576
|
+
explainer_class=TCAVExplainer,
|
|
577
|
+
meta=ExplainerMeta(
|
|
578
|
+
scope="local",
|
|
579
|
+
model_types=["neural"],
|
|
580
|
+
data_types=["tabular", "image"],
|
|
581
|
+
task_types=["classification"],
|
|
582
|
+
description="TCAV - Testing with Concept Activation Vectors for concept-based explanations (requires PyTorch)",
|
|
583
|
+
paper_reference="Kim et al., 2018 - 'Interpretability Beyond Feature Attribution: Quantitative Testing with Concept Activation Vectors' (ICML)",
|
|
584
|
+
complexity="O(n_concepts * n_test_inputs * forward_pass)",
|
|
585
|
+
requires_training_data=True,
|
|
586
|
+
supports_batching=True
|
|
587
|
+
)
|
|
588
|
+
)
|
|
589
|
+
|
|
572
590
|
# =========================================================================
|
|
573
591
|
# Global Explainers (model-level)
|
|
574
592
|
# =========================================================================
|
{explainiverse-0.6.0 → explainiverse-0.7.0}/src/explainiverse/explainers/gradient/__init__.py
RENAMED
|
@@ -4,6 +4,15 @@ Gradient-based explainers for neural networks.
|
|
|
4
4
|
|
|
5
5
|
These explainers require models that support gradient computation,
|
|
6
6
|
typically via the PyTorchAdapter.
|
|
7
|
+
|
|
8
|
+
Explainers:
|
|
9
|
+
- IntegratedGradientsExplainer: Axiomatic attributions via path integration
|
|
10
|
+
- GradCAMExplainer: Visual explanations for CNNs
|
|
11
|
+
- DeepLIFTExplainer: Reference-based attribution
|
|
12
|
+
- DeepLIFTShapExplainer: DeepLIFT + SHAP combination
|
|
13
|
+
- SmoothGradExplainer: Noise-averaged gradients
|
|
14
|
+
- SaliencyExplainer: Basic gradient attribution
|
|
15
|
+
- TCAVExplainer: Concept-based explanations (TCAV)
|
|
7
16
|
"""
|
|
8
17
|
|
|
9
18
|
from explainiverse.explainers.gradient.integrated_gradients import IntegratedGradientsExplainer
|
|
@@ -11,6 +20,7 @@ from explainiverse.explainers.gradient.gradcam import GradCAMExplainer
|
|
|
11
20
|
from explainiverse.explainers.gradient.deeplift import DeepLIFTExplainer, DeepLIFTShapExplainer
|
|
12
21
|
from explainiverse.explainers.gradient.smoothgrad import SmoothGradExplainer
|
|
13
22
|
from explainiverse.explainers.gradient.saliency import SaliencyExplainer
|
|
23
|
+
from explainiverse.explainers.gradient.tcav import TCAVExplainer, ConceptActivationVector
|
|
14
24
|
|
|
15
25
|
__all__ = [
|
|
16
26
|
"IntegratedGradientsExplainer",
|
|
@@ -19,4 +29,6 @@ __all__ = [
|
|
|
19
29
|
"DeepLIFTShapExplainer",
|
|
20
30
|
"SmoothGradExplainer",
|
|
21
31
|
"SaliencyExplainer",
|
|
32
|
+
"TCAVExplainer",
|
|
33
|
+
"ConceptActivationVector",
|
|
22
34
|
]
|