albermax / albermax/innvestigate

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

Đang mở
#327 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
triage
Ngôn ngữ chính
Python
Star
1.3k
Fork
230
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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!

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.