The explanation follows the section on neural networks in Bach et al. (2015), who proposed the method. The computation from a neuron xiβ in one layer to a neuron xjβ in the next layer is written as follows, where wijβ is the weight, bjβ the bias, and g the activation function (Eqs. 50β52).
zijβ=xiβwijβ,zjβ=iββzijβ+bjβ,xjβ=g(zjβ)
- Run the input through the forward pass and record zijβ and zjβ for each layer.
- Set the relevance of the output neuron to the score of the class to be explained (R(L)=f(x)). In the paper's MNIST experiments, the output of the last linear layer before the softmax is used.
- Split the relevance Rjβ of neuron j in the upper layer into messages Riβjβ to the neurons i in the lower layer (using one of the rules in Eqs. 56, 58, or 60).
- Set the relevance of each neuron in the lower layer to the sum of the messages it receives (Eq. 62).
- Repeat steps 3 and 4 down to the input pixels. The resulting Rd(1)β are the per-pixel relevances.
Ri(l)β=jββRiβj(l,l+1)β(62)
The basic rule splits Rjβ in proportion to each input's contribution zijβ.
Riβj(l,l+1)β=zjβzijβββ
Rj(l+1)β(56)
Under this rule, the messages sum to Rjβ(1βbjβ/zjβ), so relevance corresponding to the bias is absorbed (if the bias is 0, relevance is conserved exactly). The right side of the top figure is an example on a small network with zero biases. The output 0.36 splits into +1.00 and β0.64 in the hidden layer, and at the pixels, +1.16 goes to the circle and β0.80 to the triangle. Because h2β receives input from the circle pixels with a negative weight, the negative relevance of h2β is distributed as positive to the circle pixels and negative to the triangle pixels. The sum is 0.36 at every layer.
Eq. 56 becomes too large when zjβ is close to 0. The paper presents two rules that suppress this.
The Ξ΅ rule. Add a small positive number Ξ΅ to the denominator, matched to the sign of zjβ.
Riβj(l,l+1)β=zjβ+Ξ΅sign(zjβ)zijβββ
Rj(l+1)β(58)
The Ξ±-Ξ² rule. Distribute the positive part zij+β and the negative part zijββ of zijβ separately, where zj+β=βiβzij+β+bj+β and zjββ=βiβzijββ+bjββ.
Riβj(l,l+1)β=Rj(l+1)ββ
(Ξ±β
zj+βzij+ββ+Ξ²β
zjββzijβββ),Ξ±+Ξ²=1(60)
Papers differ in how they define Ξ± and Ξ² in the Ξ±-Ξ² rule. The original paper (Eq. 60) sets Ξ±+Ξ²=1, and Samek et al. (2017) use Ξ±=2, Ξ²=β1 under this convention. The later tutorial by Montavon et al. (2018) puts a minus sign on the negative-part term, sets Ξ±βΞ²=1 with Ξ²β₯0, and calls the rule with Ξ±=2, Ξ²=1 LRP-Ξ±2Ξ²1. These two are the same rule. When comparing with other sources, check which convention is used.
The paper also presents a method that approximates each layer with a Taylor expansion (Taylor-type decomposition), but unlike Taylor expansion, LRP does not need to search for another point in the input space (the root point of the expansion).