Skip to content

Commit 5c8e8a2

Browse files
committed
Update README with composites
1 parent d384404 commit 5c8e8a2

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed

README.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ heatmap(input, analyzer, 920) # for heatmap
5353
```
5454
Heatmaps for all implemented analyzers are shown in the following table. Red color indicate regions of positive relevance towards the selected class, whereas regions in blue are of negative relevance.
5555

56-
| **Analyzer** | **Heatmap for class "castle"** |**Heatmap for class "street sign"** |
57-
|:--------------------- |:------------------------------:|:----------------------------------:|
58-
| `LRP` composite | ![][castle-lrp-comp] | ![][streetsign-lrp-comp] |
59-
| `LRP` | ![][castle-lrp] | ![][streetsign-lrp] |
60-
| `InputTimesGradient` | ![][castle-ixg] | ![][streetsign-ixg] |
61-
| `Gradient` | ![][castle-grad] | ![][streetsign-grad] |
62-
| `SmoothGrad` | ![][castle-smoothgrad] | ![][streetsign-smoothgrad] |
63-
| `IntegratedGradients` | ![][castle-intgrad] | ![][streetsign-intgrad] |
56+
| **Analyzer** | **Heatmap for class "castle"** |**Heatmap for class "street sign"** |
57+
|:---------------------------------------- |:------------------------------:|:----------------------------------:|
58+
| `LRP` composite using `EpsilonGammaBox` | ![][castle-lrp-comp] | ![][streetsign-lrp-comp] |
59+
| `LRP` | ![][castle-lrp] | ![][streetsign-lrp] |
60+
| `InputTimesGradient` | ![][castle-ixg] | ![][streetsign-ixg] |
61+
| `Gradient` | ![][castle-grad] | ![][streetsign-grad] |
62+
| `SmoothGrad` | ![][castle-smoothgrad] | ![][streetsign-smoothgrad] |
63+
| `IntegratedGradients` | ![][castle-intgrad] | ![][streetsign-intgrad] |
6464

6565
The code used to generate these heatmaps can be found [here][asset-code].
6666

@@ -78,19 +78,27 @@ Currently, the following analyzers are implemented:
7878
├── SmoothGrad
7979
├── IntegratedGradients
8080
└── LRP
81-
├── ZeroRule
82-
├── EpsilonRule
83-
├── GammaRule
84-
├── WSquareRule
85-
├── FlatRule
86-
├── ZBoxRule
87-
├── ZPlusRule
88-
├── AlphaBetaRule
89-
└── PassRule
81+
├── Rules
82+
│ ├── ZeroRule
83+
│ ├── EpsilonRule
84+
│ ├── GammaRule
85+
│ ├── WSquareRule
86+
│ ├── FlatRule
87+
│ ├── ZBoxRule
88+
│ ├── ZPlusRule
89+
│ ├── AlphaBetaRule
90+
│ └── PassRule
91+
└── Composite
92+
├── EpsilonGammaBox
93+
├── EpsilonPlus
94+
├── EpsilonAlpha2Beta1
95+
├── EpsilonPlusFlat
96+
└── EpsilonAlpha2Beta1Flat
97+
9098
```
9199

92100
One of the design goals of ExplainableAI.jl is extensibility.
93-
Individual LRP rules [can be composed][docs-composites] and are easily extended by [custom rules][docs-custom-rules].
101+
Custom [composites][docs-composites] are easily defined and the package is easily extended by [custom rules][docs-custom-rules].
94102

95103
## Roadmap
96104
In the future, we would like to include:
@@ -106,16 +114,16 @@ Contributions are welcome!
106114
107115
[banner-img]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/banner.png
108116

109-
[asset-code]: https://github.com/adrhill/ExplainableAI.jl/blob/gh-pages/assets/heatmaps/readme_assets.jl
117+
[asset-code]: https://github.com/adrhill/ExplainableAI.jl/blob/gh-pages/assets/heatmaps/generate_assets.jl
110118
[castle]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle.jpg
111119
[castle-lrp]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_LRP.png
112-
[castle-lrp-comp]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_LRP_composite.png
120+
[castle-lrp-comp]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_LRPEpsilonGammaBox.png
113121
[castle-ixg]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_InputTimesGradient.png
114122
[castle-grad]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_Gradient.png
115123
[castle-smoothgrad]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_SmoothGrad.png
116124
[castle-intgrad]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/castle_IntegratedGradients.png
117125
[streetsign-lrp]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_LRP.png
118-
[streetsign-lrp-comp]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_LRP_composite.png
126+
[streetsign-lrp-comp]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_LRPEpsilonGammaBox.png
119127
[streetsign-ixg]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_InputTimesGradient.png
120128
[streetsign-grad]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_Gradient.png
121129
[streetsign-smoothgrad]: https://raw.githubusercontent.com/adrhill/ExplainableAI.jl/gh-pages/assets/heatmaps/streetsign_SmoothGrad.png
@@ -133,7 +141,7 @@ Contributions are welcome!
133141
[codecov-img]: https://codecov.io/gh/adrhill/ExplainableAI.jl/branch/master/graph/badge.svg
134142
[codecov-url]: https://codecov.io/gh/adrhill/ExplainableAI.jl
135143

136-
[docs-composites]: https://adrhill.github.io/ExplainableAI.jl/dev/generated/advanced_lrp/#Custom-LRP-composites
144+
[docs-composites]: https://adrhill.github.io/ExplainableAI.jl/dev/generated/advanced_lrp/#Custom-composites
137145
[docs-custom-rules]: https://adrhill.github.io/ExplainableAI.jl/dev/generated/advanced_lrp/#Custom-LRP-rules
138146

139147
[doi-img]: https://zenodo.org/badge/337430397.svg

docs/literate/advanced_lrp.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ heatmap(input, analyzer)
4949
#
5050
# To obtain the same set of rules as in the previous example, we can define
5151
composite = Composite(
52-
ZeroRule(), # default rule
52+
ZeroRule(), # default rule
5353
GlobalTypeRule(
54-
Conv => GammaRule(), # apply GammaRule on all convolutional layers
55-
MaxPool => EpsilonRule(), # apply EpsilonRule on all pooling-layers
54+
Conv => GammaRule(), # apply GammaRule on all convolutional layers
55+
MaxPool => EpsilonRule(), # apply EpsilonRule on all pooling-layers
5656
),
5757
FirstLayerRule(ZBoxRule(0.0f0, 1.0f0)), # apply ZBoxRule on the first layer
5858
)
5959

60-
analyzer = LRP(model, composite) # construct LRP analyzer from composite
60+
analyzer = LRP(model, composite) # construct LRP analyzer from composite
6161
heatmap(input, analyzer)
6262

6363
# This analyzer contains the same rules as our previous one:

0 commit comments

Comments
 (0)