albermax / albermax/innvestigate

[BUG] Relevances not conserved in A1B0, W2, Bounded

未關閉
#327 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
triage
主要語言
Python
星號
1.3k
分支
230
PR 合併指標
30 天內沒有已合併 PR

描述

### Describe the bug
It seems that relevances are not conserved across layers when using LRP-A1B0, LRP-W2, and LRP-Bounded rules. I am able to manually write the code to conserve these relevances if needed and don't fully understand why the library cannot do it. I do have some intuition though as you can see in the minimum working example below. The Manual LRP-A1B0 without bias in the numerator and only one bias in the denominator can completely reproduce the library's A1B0 output. While this is great, not having a multiple of the bias term in the denominator means that relevances are then not conserved across layers. Using the library's LRP-A1B0-IB seems to improve things a bit, but not up to machine precision.

In mathematical terms, what the library is doing is this (for a 2x2 weight matrix and 2x1 bias and LRP-A1B0 rule):

```
denominator = x[0,0]*np.max(W[0,pred_class],0)+x[0,1]*np.max(W[1,pred_class],0)+np.max(b[pred_class],0)
```

What should be expected for relevance conservation is this:

```
denominator = x[0,0]*np.max(W[0,pred_class],0)+x[0,1]*np.max(W[1,pred_class],0)+2*np.max(b[pred_class],0)
```

A (almost) minimum working example can be found here: https://github.com/Shreyas911/XAIRT/blob/main/examples_TomsQoI/LRP_manual_MWE.ipynb

### Expected behavior
I expected the relevance to be conserved for all these rules, especially since manually implementing them for a single-layer network I am able to achieve relevance conservation across the layers up to machine precision.

Any help/insights are appreciated. Thanks a lot!

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。