Closed adrhill closed 1 year ago
Hi @adrhill !
Given the example in https://github.com/adrhill/innvestigate/blob/adrhill/custom-composite/examples/notebooks/imagenet_composite_lrp.ipynb, without the application of until_layer_rule , the only rule being applied to the model is the one specified in rule?
Hi HugoTex98,
that notebook is work in progress from PR #261 , which hasn't been merged yet due to this issue.
That being said, you can still use LRP
without the until_layer_rule
:
analyzer = LRP(
model_wo_softmax,
rule="Z",
input_layer_rule="Bounded",
bn_layer_rule="Z"
)
Thanks @adrhill!
Btw, do you have any idea of a possible release date for this LRP with the until_layer_rule?
It's high up on my to-do list, but it will have to wait until the TF2 release, which should be ready soon.
The function
is_layer_at_idx
currently doesn't return anything when it should be returning a boolean value after checking the layer:https://github.com/albermax/innvestigate/blob/c6ce89323d686a52d793177efd8d1dda3bd9526a/src/innvestigate/utils/keras/checks.py#L446-L448
This is used in all analyzers that inherit from
LRP
and use the kwargsuntil_layer_rule
anduntil_layer_idx
:https://github.com/albermax/innvestigate/blob/c3295be173b99e9fb587bec7bee4cacafeae8a2f/src/innvestigate/analyzer/relevance_based/relevance_analyzer.py#L399-L410
As Python evaluates
bool(None)
asFalse
instead of throwing an error, theuntil_layer_rule
never gets applied.Currently only
LRPSequentialPresetBFlatUntilIdx
and user-defined composite LRP methods are affected, so this bug should be fixed before merging #261. Until then PR #263 adds aNotImplementedError
.