explainiverse 0.7.1__tar.gz → 0.8.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.
Files changed (44) hide show
  1. {explainiverse-0.7.1 → explainiverse-0.8.0}/PKG-INFO +76 -13
  2. {explainiverse-0.7.1 → explainiverse-0.8.0}/README.md +74 -11
  3. {explainiverse-0.7.1 → explainiverse-0.8.0}/pyproject.toml +2 -2
  4. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/__init__.py +5 -4
  5. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/core/registry.py +18 -0
  6. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/gradient/__init__.py +3 -0
  7. explainiverse-0.8.0/src/explainiverse/explainers/gradient/lrp.py +1206 -0
  8. {explainiverse-0.7.1 → explainiverse-0.8.0}/LICENSE +0 -0
  9. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/adapters/__init__.py +0 -0
  10. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/adapters/base_adapter.py +0 -0
  11. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/adapters/pytorch_adapter.py +0 -0
  12. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/adapters/sklearn_adapter.py +0 -0
  13. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/core/__init__.py +0 -0
  14. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/core/explainer.py +0 -0
  15. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/core/explanation.py +0 -0
  16. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/engine/__init__.py +0 -0
  17. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/engine/suite.py +0 -0
  18. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/evaluation/__init__.py +0 -0
  19. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/evaluation/_utils.py +0 -0
  20. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/evaluation/faithfulness.py +0 -0
  21. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/evaluation/metrics.py +0 -0
  22. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/evaluation/stability.py +0 -0
  23. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/__init__.py +0 -0
  24. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/attribution/__init__.py +0 -0
  25. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/attribution/lime_wrapper.py +0 -0
  26. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/attribution/shap_wrapper.py +0 -0
  27. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/attribution/treeshap_wrapper.py +0 -0
  28. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/counterfactual/__init__.py +0 -0
  29. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/counterfactual/dice_wrapper.py +0 -0
  30. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/example_based/__init__.py +0 -0
  31. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/example_based/protodash.py +0 -0
  32. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/global_explainers/__init__.py +0 -0
  33. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/global_explainers/ale.py +0 -0
  34. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/global_explainers/partial_dependence.py +0 -0
  35. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/global_explainers/permutation_importance.py +0 -0
  36. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/global_explainers/sage.py +0 -0
  37. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/gradient/deeplift.py +0 -0
  38. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/gradient/gradcam.py +0 -0
  39. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/gradient/integrated_gradients.py +0 -0
  40. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/gradient/saliency.py +0 -0
  41. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/gradient/smoothgrad.py +0 -0
  42. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/gradient/tcav.py +0 -0
  43. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/rule_based/__init__.py +0 -0
  44. {explainiverse-0.7.1 → explainiverse-0.8.0}/src/explainiverse/explainers/rule_based/anchors_wrapper.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: explainiverse
3
- Version: 0.7.1
4
- Summary: Unified, extensible explainability framework supporting LIME, SHAP, Anchors, Counterfactuals, PDP, ALE, SAGE, and more
3
+ Version: 0.8.0
4
+ Summary: Unified, extensible explainability framework supporting 18 XAI methods including LIME, SHAP, LRP, TCAV, GradCAM, and more
5
5
  Home-page: https://github.com/jemsbhai/explainiverse
6
6
  License: MIT
7
7
  Keywords: xai,explainability,interpretability,machine-learning,lime,shap,anchors
@@ -35,7 +35,7 @@ Description-Content-Type: text/markdown
35
35
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
36
36
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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 **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.
38
+ **Explainiverse** is a unified, extensible Python framework for Explainable AI (XAI). It provides a standardized interface for **18 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
- | **17 Explainers** | LIME, KernelSHAP, TreeSHAP, Integrated Gradients, DeepLIFT, DeepSHAP, SmoothGrad, Saliency Maps, GradCAM/GradCAM++, TCAV, Anchors, Counterfactual, Permutation Importance, PDP, ALE, SAGE, ProtoDash |
46
+ | **18 Explainers** | LIME, KernelSHAP, TreeSHAP, Integrated Gradients, DeepLIFT, DeepSHAP, SmoothGrad, Saliency Maps, GradCAM/GradCAM++, LRP, 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
+ | **LRP** | Decomposition | [Bach et al., 2015](https://doi.org/10.1371/journal.pone.0130140) |
69
70
  | **TCAV** | Concept-Based | [Kim et al., 2018](https://arxiv.org/abs/1711.11279) |
70
71
  | **Anchors** | Rule-Based | [Ribeiro et al., 2018](https://ojs.aaai.org/index.php/AAAI/article/view/11491) |
71
72
  | **Counterfactual** | Contrastive | [Mothilal et al., 2020](https://arxiv.org/abs/1905.07697) |
@@ -143,7 +144,7 @@ adapter = SklearnAdapter(model, class_names=iris.target_names.tolist())
143
144
  # List all available explainers
144
145
  print(default_registry.list_explainers())
145
146
  # ['lime', 'shap', 'treeshap', 'integrated_gradients', 'deeplift', 'deepshap',
146
- # 'smoothgrad', 'saliency', 'gradcam', 'tcav', 'anchors', 'counterfactual',
147
+ # 'smoothgrad', 'saliency', 'gradcam', 'lrp', 'tcav', 'anchors', 'counterfactual',
147
148
  # 'protodash', 'permutation_importance', 'partial_dependence', 'ale', 'sage']
148
149
 
149
150
  # Create an explainer via registry
@@ -211,6 +212,70 @@ print(f"Attributions: {explanation.explanation_data['feature_attributions']}")
211
212
  print(f"Convergence δ: {explanation.explanation_data['convergence_delta']:.6f}")
212
213
  ```
213
214
 
215
+ ### Layer-wise Relevance Propagation (LRP)
216
+
217
+ ```python
218
+ from explainiverse.explainers.gradient import LRPExplainer
219
+
220
+ # LRP - Decomposition-based attribution with conservation property
221
+ explainer = LRPExplainer(
222
+ model=adapter,
223
+ feature_names=feature_names,
224
+ class_names=class_names,
225
+ rule="epsilon", # Propagation rule: epsilon, gamma, alpha_beta, z_plus, composite
226
+ epsilon=1e-6 # Stabilization constant
227
+ )
228
+
229
+ # Basic explanation
230
+ explanation = explainer.explain(X[0], target_class=0)
231
+ print(explanation.explanation_data["feature_attributions"])
232
+
233
+ # Verify conservation property (sum of attributions ≈ target output)
234
+ explanation = explainer.explain(X[0], return_convergence_delta=True)
235
+ print(f"Conservation delta: {explanation.explanation_data['convergence_delta']:.6f}")
236
+
237
+ # Compare different LRP rules
238
+ comparison = explainer.compare_rules(X[0], rules=["epsilon", "gamma", "z_plus"])
239
+ for rule, result in comparison.items():
240
+ print(f"{rule}: top feature = {result['top_feature']}")
241
+
242
+ # Layer-wise relevance analysis
243
+ layer_result = explainer.explain_with_layer_relevances(X[0])
244
+ for layer, relevances in layer_result["layer_relevances"].items():
245
+ print(f"{layer}: sum = {sum(relevances):.4f}")
246
+
247
+ # Composite rules: different rules for different layers
248
+ explainer_composite = LRPExplainer(
249
+ model=adapter,
250
+ feature_names=feature_names,
251
+ class_names=class_names,
252
+ rule="composite"
253
+ )
254
+ explainer_composite.set_composite_rule({
255
+ 0: "z_plus", # Input layer: focus on what's present
256
+ 2: "epsilon", # Middle layers: balanced
257
+ 4: "epsilon" # Output layer
258
+ })
259
+ explanation = explainer_composite.explain(X[0])
260
+ ```
261
+
262
+ **LRP Propagation Rules:**
263
+
264
+ | Rule | Description | Use Case |
265
+ |------|-------------|----------|
266
+ | `epsilon` | Adds stabilization constant | General purpose (default) |
267
+ | `gamma` | Enhances positive contributions | Image classification |
268
+ | `alpha_beta` | Separates pos/neg (α-β=1) | Fine-grained control |
269
+ | `z_plus` | Only positive weights | Input layers, what's present |
270
+ | `composite` | Different rules per layer | Best practice for deep nets |
271
+
272
+ **Supported Layers:**
273
+ - Linear, Conv2d
274
+ - BatchNorm1d, BatchNorm2d
275
+ - ReLU, LeakyReLU, ELU, Tanh, Sigmoid, GELU
276
+ - MaxPool2d, AvgPool2d, AdaptiveAvgPool2d
277
+ - Flatten, Dropout
278
+
214
279
  ### DeepLIFT and DeepSHAP
215
280
 
216
281
  ```python
@@ -602,7 +667,7 @@ explainiverse/
602
667
  │ └── pytorch_adapter.py # With gradient support
603
668
  ├── explainers/
604
669
  │ ├── attribution/ # LIME, SHAP, TreeSHAP
605
- │ ├── gradient/ # IG, DeepLIFT, DeepSHAP, SmoothGrad, Saliency, GradCAM, TCAV
670
+ │ ├── gradient/ # IG, DeepLIFT, DeepSHAP, SmoothGrad, Saliency, GradCAM, LRP, TCAV
606
671
  │ ├── rule_based/ # Anchors
607
672
  │ ├── counterfactual/ # DiCE-style
608
673
  │ ├── global_explainers/ # Permutation, PDP, ALE, SAGE
@@ -626,10 +691,10 @@ poetry run pytest
626
691
  poetry run pytest --cov=explainiverse --cov-report=html
627
692
 
628
693
  # Run specific test file
629
- poetry run pytest tests/test_smoothgrad.py -v
694
+ poetry run pytest tests/test_lrp.py -v
630
695
 
631
696
  # Run specific test class
632
- poetry run pytest tests/test_smoothgrad.py::TestSmoothGradBasic -v
697
+ poetry run pytest tests/test_lrp.py::TestLRPConv2d -v
633
698
  ```
634
699
 
635
700
  ---
@@ -640,6 +705,7 @@ poetry run pytest tests/test_smoothgrad.py::TestSmoothGradBasic -v
640
705
  - [x] Core framework (BaseExplainer, Explanation, Registry)
641
706
  - [x] Perturbation methods: LIME, KernelSHAP, TreeSHAP
642
707
  - [x] Gradient methods: Integrated Gradients, DeepLIFT, DeepSHAP, SmoothGrad, Saliency Maps, GradCAM/GradCAM++
708
+ - [x] Decomposition methods: Layer-wise Relevance Propagation (LRP) with ε, γ, αβ, z⁺, composite rules
643
709
  - [x] Concept-based: TCAV (Testing with Concept Activation Vectors)
644
710
  - [x] Rule-based: Anchors
645
711
  - [x] Counterfactual: DiCE-style
@@ -649,9 +715,6 @@ poetry run pytest tests/test_smoothgrad.py::TestSmoothGradBasic -v
649
715
  - [x] Evaluation: Stability metrics (RIS, ROS, Lipschitz)
650
716
  - [x] PyTorch adapter with gradient support
651
717
 
652
- ### In Progress 🚧
653
- - [ ] Layer-wise Relevance Propagation (LRP)
654
-
655
718
  ### Planned 📋
656
719
  - [ ] Attention-based explanations (for Transformers)
657
720
  - [ ] TensorFlow/Keras adapter
@@ -671,7 +734,7 @@ If you use Explainiverse in your research, please cite:
671
734
  author = {Syed, Muntaser},
672
735
  year = {2025},
673
736
  url = {https://github.com/jemsbhai/explainiverse},
674
- version = {0.7.1}
737
+ version = {0.8.0}
675
738
  }
676
739
  ```
677
740
 
@@ -699,5 +762,5 @@ MIT License - see [LICENSE](LICENSE) for details.
699
762
 
700
763
  ## Acknowledgments
701
764
 
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.
765
+ Explainiverse builds upon the foundational work of many researchers in the XAI community. We thank the authors of LIME, SHAP, Integrated Gradients, DeepLIFT, LRP, GradCAM, TCAV, Anchors, DiCE, ALE, SAGE, and ProtoDash for their contributions to interpretable machine learning.
703
766
 
@@ -4,7 +4,7 @@
4
4
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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 **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.
7
+ **Explainiverse** is a unified, extensible Python framework for Explainable AI (XAI). It provides a standardized interface for **18 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
- | **17 Explainers** | LIME, KernelSHAP, TreeSHAP, Integrated Gradients, DeepLIFT, DeepSHAP, SmoothGrad, Saliency Maps, GradCAM/GradCAM++, TCAV, Anchors, Counterfactual, Permutation Importance, PDP, ALE, SAGE, ProtoDash |
15
+ | **18 Explainers** | LIME, KernelSHAP, TreeSHAP, Integrated Gradients, DeepLIFT, DeepSHAP, SmoothGrad, Saliency Maps, GradCAM/GradCAM++, LRP, 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
+ | **LRP** | Decomposition | [Bach et al., 2015](https://doi.org/10.1371/journal.pone.0130140) |
38
39
  | **TCAV** | Concept-Based | [Kim et al., 2018](https://arxiv.org/abs/1711.11279) |
39
40
  | **Anchors** | Rule-Based | [Ribeiro et al., 2018](https://ojs.aaai.org/index.php/AAAI/article/view/11491) |
40
41
  | **Counterfactual** | Contrastive | [Mothilal et al., 2020](https://arxiv.org/abs/1905.07697) |
@@ -112,7 +113,7 @@ adapter = SklearnAdapter(model, class_names=iris.target_names.tolist())
112
113
  # List all available explainers
113
114
  print(default_registry.list_explainers())
114
115
  # ['lime', 'shap', 'treeshap', 'integrated_gradients', 'deeplift', 'deepshap',
115
- # 'smoothgrad', 'saliency', 'gradcam', 'tcav', 'anchors', 'counterfactual',
116
+ # 'smoothgrad', 'saliency', 'gradcam', 'lrp', 'tcav', 'anchors', 'counterfactual',
116
117
  # 'protodash', 'permutation_importance', 'partial_dependence', 'ale', 'sage']
117
118
 
118
119
  # Create an explainer via registry
@@ -180,6 +181,70 @@ print(f"Attributions: {explanation.explanation_data['feature_attributions']}")
180
181
  print(f"Convergence δ: {explanation.explanation_data['convergence_delta']:.6f}")
181
182
  ```
182
183
 
184
+ ### Layer-wise Relevance Propagation (LRP)
185
+
186
+ ```python
187
+ from explainiverse.explainers.gradient import LRPExplainer
188
+
189
+ # LRP - Decomposition-based attribution with conservation property
190
+ explainer = LRPExplainer(
191
+ model=adapter,
192
+ feature_names=feature_names,
193
+ class_names=class_names,
194
+ rule="epsilon", # Propagation rule: epsilon, gamma, alpha_beta, z_plus, composite
195
+ epsilon=1e-6 # Stabilization constant
196
+ )
197
+
198
+ # Basic explanation
199
+ explanation = explainer.explain(X[0], target_class=0)
200
+ print(explanation.explanation_data["feature_attributions"])
201
+
202
+ # Verify conservation property (sum of attributions ≈ target output)
203
+ explanation = explainer.explain(X[0], return_convergence_delta=True)
204
+ print(f"Conservation delta: {explanation.explanation_data['convergence_delta']:.6f}")
205
+
206
+ # Compare different LRP rules
207
+ comparison = explainer.compare_rules(X[0], rules=["epsilon", "gamma", "z_plus"])
208
+ for rule, result in comparison.items():
209
+ print(f"{rule}: top feature = {result['top_feature']}")
210
+
211
+ # Layer-wise relevance analysis
212
+ layer_result = explainer.explain_with_layer_relevances(X[0])
213
+ for layer, relevances in layer_result["layer_relevances"].items():
214
+ print(f"{layer}: sum = {sum(relevances):.4f}")
215
+
216
+ # Composite rules: different rules for different layers
217
+ explainer_composite = LRPExplainer(
218
+ model=adapter,
219
+ feature_names=feature_names,
220
+ class_names=class_names,
221
+ rule="composite"
222
+ )
223
+ explainer_composite.set_composite_rule({
224
+ 0: "z_plus", # Input layer: focus on what's present
225
+ 2: "epsilon", # Middle layers: balanced
226
+ 4: "epsilon" # Output layer
227
+ })
228
+ explanation = explainer_composite.explain(X[0])
229
+ ```
230
+
231
+ **LRP Propagation Rules:**
232
+
233
+ | Rule | Description | Use Case |
234
+ |------|-------------|----------|
235
+ | `epsilon` | Adds stabilization constant | General purpose (default) |
236
+ | `gamma` | Enhances positive contributions | Image classification |
237
+ | `alpha_beta` | Separates pos/neg (α-β=1) | Fine-grained control |
238
+ | `z_plus` | Only positive weights | Input layers, what's present |
239
+ | `composite` | Different rules per layer | Best practice for deep nets |
240
+
241
+ **Supported Layers:**
242
+ - Linear, Conv2d
243
+ - BatchNorm1d, BatchNorm2d
244
+ - ReLU, LeakyReLU, ELU, Tanh, Sigmoid, GELU
245
+ - MaxPool2d, AvgPool2d, AdaptiveAvgPool2d
246
+ - Flatten, Dropout
247
+
183
248
  ### DeepLIFT and DeepSHAP
184
249
 
185
250
  ```python
@@ -571,7 +636,7 @@ explainiverse/
571
636
  │ └── pytorch_adapter.py # With gradient support
572
637
  ├── explainers/
573
638
  │ ├── attribution/ # LIME, SHAP, TreeSHAP
574
- │ ├── gradient/ # IG, DeepLIFT, DeepSHAP, SmoothGrad, Saliency, GradCAM, TCAV
639
+ │ ├── gradient/ # IG, DeepLIFT, DeepSHAP, SmoothGrad, Saliency, GradCAM, LRP, TCAV
575
640
  │ ├── rule_based/ # Anchors
576
641
  │ ├── counterfactual/ # DiCE-style
577
642
  │ ├── global_explainers/ # Permutation, PDP, ALE, SAGE
@@ -595,10 +660,10 @@ poetry run pytest
595
660
  poetry run pytest --cov=explainiverse --cov-report=html
596
661
 
597
662
  # Run specific test file
598
- poetry run pytest tests/test_smoothgrad.py -v
663
+ poetry run pytest tests/test_lrp.py -v
599
664
 
600
665
  # Run specific test class
601
- poetry run pytest tests/test_smoothgrad.py::TestSmoothGradBasic -v
666
+ poetry run pytest tests/test_lrp.py::TestLRPConv2d -v
602
667
  ```
603
668
 
604
669
  ---
@@ -609,6 +674,7 @@ poetry run pytest tests/test_smoothgrad.py::TestSmoothGradBasic -v
609
674
  - [x] Core framework (BaseExplainer, Explanation, Registry)
610
675
  - [x] Perturbation methods: LIME, KernelSHAP, TreeSHAP
611
676
  - [x] Gradient methods: Integrated Gradients, DeepLIFT, DeepSHAP, SmoothGrad, Saliency Maps, GradCAM/GradCAM++
677
+ - [x] Decomposition methods: Layer-wise Relevance Propagation (LRP) with ε, γ, αβ, z⁺, composite rules
612
678
  - [x] Concept-based: TCAV (Testing with Concept Activation Vectors)
613
679
  - [x] Rule-based: Anchors
614
680
  - [x] Counterfactual: DiCE-style
@@ -618,9 +684,6 @@ poetry run pytest tests/test_smoothgrad.py::TestSmoothGradBasic -v
618
684
  - [x] Evaluation: Stability metrics (RIS, ROS, Lipschitz)
619
685
  - [x] PyTorch adapter with gradient support
620
686
 
621
- ### In Progress 🚧
622
- - [ ] Layer-wise Relevance Propagation (LRP)
623
-
624
687
  ### Planned 📋
625
688
  - [ ] Attention-based explanations (for Transformers)
626
689
  - [ ] TensorFlow/Keras adapter
@@ -640,7 +703,7 @@ If you use Explainiverse in your research, please cite:
640
703
  author = {Syed, Muntaser},
641
704
  year = {2025},
642
705
  url = {https://github.com/jemsbhai/explainiverse},
643
- version = {0.7.1}
706
+ version = {0.8.0}
644
707
  }
645
708
  ```
646
709
 
@@ -668,4 +731,4 @@ MIT License - see [LICENSE](LICENSE) for details.
668
731
 
669
732
  ## Acknowledgments
670
733
 
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.
734
+ Explainiverse builds upon the foundational work of many researchers in the XAI community. We thank the authors of LIME, SHAP, Integrated Gradients, DeepLIFT, LRP, GradCAM, TCAV, Anchors, DiCE, ALE, SAGE, and ProtoDash for their contributions to interpretable machine learning.
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "explainiverse"
3
- version = "0.7.1"
4
- description = "Unified, extensible explainability framework supporting LIME, SHAP, Anchors, Counterfactuals, PDP, ALE, SAGE, and more"
3
+ version = "0.8.0"
4
+ description = "Unified, extensible explainability framework supporting 18 XAI methods including LIME, SHAP, LRP, TCAV, GradCAM, and more"
5
5
  authors = ["Muntaser Syed <jemsbhai@gmail.com>"]
6
6
  license = "MIT"
7
7
  readme = "README.md"
@@ -2,9 +2,10 @@
2
2
  """
3
3
  Explainiverse - A unified, extensible explainability framework.
4
4
 
5
- Supports multiple XAI methods including LIME, SHAP, TreeSHAP, Anchors,
6
- Counterfactuals, Permutation Importance, PDP, ALE, and SAGE through a
7
- consistent interface.
5
+ Supports 18 state-of-the-art XAI methods including LIME, SHAP, TreeSHAP,
6
+ Integrated Gradients, DeepLIFT, DeepSHAP, LRP, GradCAM, TCAV, Anchors,
7
+ Counterfactuals, Permutation Importance, PDP, ALE, SAGE, and ProtoDash
8
+ through a consistent interface.
8
9
 
9
10
  Quick Start:
10
11
  from explainiverse import default_registry
@@ -33,7 +34,7 @@ from explainiverse.adapters.sklearn_adapter import SklearnAdapter
33
34
  from explainiverse.adapters import TORCH_AVAILABLE
34
35
  from explainiverse.engine.suite import ExplanationSuite
35
36
 
36
- __version__ = "0.7.1"
37
+ __version__ = "0.8.0"
37
38
 
38
39
  __all__ = [
39
40
  # Core
@@ -375,6 +375,7 @@ def _create_default_registry() -> ExplainerRegistry:
375
375
  from explainiverse.explainers.gradient.smoothgrad import SmoothGradExplainer
376
376
  from explainiverse.explainers.gradient.saliency import SaliencyExplainer
377
377
  from explainiverse.explainers.gradient.tcav import TCAVExplainer
378
+ from explainiverse.explainers.gradient.lrp import LRPExplainer
378
379
  from explainiverse.explainers.example_based.protodash import ProtoDashExplainer
379
380
 
380
381
  registry = ExplainerRegistry()
@@ -587,6 +588,23 @@ def _create_default_registry() -> ExplainerRegistry:
587
588
  )
588
589
  )
589
590
 
591
+ # Register LRP (Layer-wise Relevance Propagation)
592
+ registry.register(
593
+ name="lrp",
594
+ explainer_class=LRPExplainer,
595
+ meta=ExplainerMeta(
596
+ scope="local",
597
+ model_types=["neural"],
598
+ data_types=["tabular", "image"],
599
+ task_types=["classification", "regression"],
600
+ description="LRP - Layer-wise Relevance Propagation for decomposition-based attributions (requires PyTorch)",
601
+ paper_reference="Bach et al., 2015 - 'On Pixel-wise Explanations for Non-Linear Classifier Decisions by Layer-wise Relevance Propagation' (PLOS ONE)",
602
+ complexity="O(n_layers * forward_pass)",
603
+ requires_training_data=False,
604
+ supports_batching=True
605
+ )
606
+ )
607
+
590
608
  # =========================================================================
591
609
  # Global Explainers (model-level)
592
610
  # =========================================================================
@@ -13,6 +13,7 @@ Explainers:
13
13
  - SmoothGradExplainer: Noise-averaged gradients
14
14
  - SaliencyExplainer: Basic gradient attribution
15
15
  - TCAVExplainer: Concept-based explanations (TCAV)
16
+ - LRPExplainer: Layer-wise Relevance Propagation
16
17
  """
17
18
 
18
19
  from explainiverse.explainers.gradient.integrated_gradients import IntegratedGradientsExplainer
@@ -21,6 +22,7 @@ from explainiverse.explainers.gradient.deeplift import DeepLIFTExplainer, DeepLI
21
22
  from explainiverse.explainers.gradient.smoothgrad import SmoothGradExplainer
22
23
  from explainiverse.explainers.gradient.saliency import SaliencyExplainer
23
24
  from explainiverse.explainers.gradient.tcav import TCAVExplainer, ConceptActivationVector
25
+ from explainiverse.explainers.gradient.lrp import LRPExplainer
24
26
 
25
27
  __all__ = [
26
28
  "IntegratedGradientsExplainer",
@@ -31,4 +33,5 @@ __all__ = [
31
33
  "SaliencyExplainer",
32
34
  "TCAVExplainer",
33
35
  "ConceptActivationVector",
36
+ "LRPExplainer",
34
37
  ]