Explaining NonLinear Classification Decisions with Deep Taylor Decomposition

Grégoire Montavon, Sebastian Bach, Alexander Binder, Wojciech Samek, Klaus-Robert Müller

I Introduction

Nonlinear models have been used since the advent of machine learning (ML) methods and are integral part of many popular algorithms. They include, for example, graphical models , kernels , Gaussian processes , neural networks , boosting , or random forests . Recently, a particular class of nonlinear methods, Deep Neural Networks (DNNs), revolutionized the field of automated image classification by demonstrating impressive performance on large benchmark data sets . Deep networks have also been applied successfully to other research fields such as natural language processing , human action recognition , or physics . Although these models are highly successful in terms of performance, they have a drawback of acting like a black box in the sense that it is not clear how and why they arrive at a particular classification decision. This lack of transparency is a serious disadvantage as it prevents a human expert from being able to verify, interpret, and understand the reasoning of the system.

An interpretable classifier explains its nonlinear classification decision in terms of the inputs. For instance, in image classification problems, the classifier should not only indicate whether an image of interest belongs to a certain category or not, but also explain what structures (e.g. pixels in the image) were the basis for its decision (cf. Figure 1). This additional information helps to better assess the quality of a particular prediction, or to verify the overall reasoning ability of the trained classifier. Also, information about which pixels are relevant in a particular image, could be used for determining which region of the image should be the object of further analysis. Linear models readily provide explanations in terms of input variables (see for example ). However, because of the limited expressive power of these models, they perform poorly on complex tasks such as image recognition. Extending linear analysis techniques to more realistic nonlinear models such as deep neural networks, is therefore of high practical relevance.

Recently, a significant amount of work has been dedicated to make the deep neural network more transparent to its user, in particular, improving the overall interpretability of the learned model, or explaining individual predictions. For example, Zeiler et al. have proposed a network propagation technique to identify patterns in the input data that are linked to a particular neuron activation or a classification decision. Subsequently, Bach et al. have introduced the concept of pixel-wise decomposition of a classification decision, and how such decomposition can be achieved either by Taylor decomposition, or by a relevance propagation algorithm. Specifically, the authors distinguish between (1) functional approaches that view the neural network as a function and disregard its topology, and (2) message passing approaches, where the decomposition stems from a simple propagation rule applied uniformly to all neurons of the deep network.

The main goal of this paper is to reconcile the functional and rule-based approaches for obtaining these decompositions, in a similar way to the error backpropagation algorithm that also has a functional and a message passing interpretation. We call the resulting framework deep Taylor decomposition. This new technique seeks to replace the analytically intractable standard Taylor decomposition problem by a multitude of simpler analytically tractable Taylor decompositions—one per neuron. The proposed method results in a relevance redistribution process like the one illustrated in Figure 1 for a neural network trained to detect the digit “0” in an image, in presence of another distracting digit. The classification decision is first decomposed in terms of contributions R1,R2,R3R_{1},R_{2},R_{3} of respective hidden neurons x1,x2,x3x_{1},x_{2},x_{3}, and then, the contribution of each hidden neuron is independently redistributed onto the pixels, leading to a relevance map (or heatmap) in the pixel space, that explains the classification “0”.

A main result of this work is the observation that application of deep Taylor decomposition to neural networks used for image classification, yields rules that are similar to those proposed by (the αβ\alpha\beta-rule and the ϵ\epsilon-rule), but with specific instantiations of their hyperparameters, previously set heuristically. Because of the theoretical focus of this paper, we do not perform a broader empirical comparison with other recently proposed methods such as or . However, we refer to for such a comparison.

The paper is organized as follows: Section II introduces the general idea of decomposition of a classification score in terms of input variables, and how this decomposition arises from Taylor decomposition or deep Taylor decomposition of a classification function. Section III applies the proposed deep Taylor decomposition method to a simple detection-pooling neural network. Section IV extends the method to deeper networks, by introducing the concept of relevance model and describing how it can be applied to large GPU-trained neural networks without retraining. Several experiments on MNIST and ILSVRC data are provided to illustrate the methods described here. Section V concludes.

There has been a significant body of work focusing on the analysis and understanding of nonlinear classifiers such as kernel machines , neural networks , or a broader class of nonlinear models . In particular, some recent analyses have focused on the understanding of state-of-the-art GPU-trained convolutional neural networks for image classification , offering new insights on these highly complex models.

Some methods seek to provide a general understanding of the trained model, by measuring important characteristics of it, such as the noise and relevant dimensionality of its feature space(s) , its invariance to certain transformations of the data or the role of particular neurons . In this paper, we focus instead on the interpretation of the prediction of individual data points, for which portions of the trained model may either be relevant or not relevant.

Technically, the methods proposed in do not explain the decision of a classifier but rather perform sensitivity analysis by computing the gradient of the decision function. This results in an analysis of variations of that function, without however seeking to provide a full explanation why a certain data point has been predicted in a certain way. Specifically, the gradient of a function does not contain information on the saliency of a feature in the data to which the function is applied. Simonyan et al. incorporate saliency information by multiplying the gradient by the actual data point.

The method proposed by Zeiler and Fergus was designed to visualize and understand the features of a convolutional neural network with max-pooling and rectified linear units. The method performs a backpropagation pass on the network, where a set of rules is applied uniformly to all layers of the network, resulting in an assignment of values onto pixels. The method however does not aim to attribute a defined meaning to the assigned pixel values, except for the fact that they should form a visually interpretable pattern. proposed a layer-wise propagation method where the backpropagated signal is interpreted as relevance, and obeys a conservation property. The proposed propagation rules were designed according to this property, and were shown quantitatively to better support the classification decision . However, the practical choice of propagation rules among all possible ones was mainly heuristic and lacked a strong theoretical justification.

A theoretical foundation to the problem of relevance assignment for a classification decision, can be found in the Taylor decomposition of a nonlinear function. The approach was described by Bazen and Joutard as a nonlinear generalization of the Oaxaca method in econometrics . The idea was subsequently introduced in the context of image analysis for the purpose of explaining machine learning classifiers. Our paper extends the standard Taylor decomposition in a way that takes advantage of the deep structure of neural networks, and connects it to rule-based propagation methods, such as .

As an alternative to propagation methods, spatial response maps build heatmaps by looking at the neural network output while sliding the neural network in the pixel space. Attention models based on neural networks can be trained to provide dynamic relevance assignment, for example, for the purpose of classifying an image from only a few glimpses of it . They can also visualize what part of an image is relevant at a given time in some temporal context . However, they usually require specific models that are significantly more complex to design and train.

II Pixel-Wise Decomposition of a Function

In this section, we will describe the general concept of explaining a neural network decision by redistributing the function value (i.e. neural network output) onto the input variables in an amount that matches the respective contributions of these input variables to the function value. After enumerating a certain number of desirable properties for the input-wise relevance decomposition, we will explain in a second step how the Taylor decomposition technique, and its extension, deep Taylor decomposition, can be applied to this problem. For the sake of interpretability—and because all our subsequent empirical evaluations focus on the problem of image recognition,—we will call the input variables “pixels”, and use the letter pp for indexing them. Also, we will employ the term “heatmap” to designate the set of redistributed relevances onto pixels. However, despite the image-related terminology, the method is applicable more broadly to other input domains such as abstract vector spaces, time series, or more generally any type of input domain whose elements can be processed by a neural network.

We would like to associate to each pixel pp in the image a relevance score Rp(x)R_{p}(\boldsymbol{x}), that indicates for an image x\boldsymbol{x} to what extent the pixel pp contributes to explaining the classification decision f(x)f(\boldsymbol{x}). The relevance of each pixel can be stored in a heatmap denoted by R(x)={Rp(x)}\boldsymbol{R}(\boldsymbol{x})=\{R_{p}(\boldsymbol{x})\} of same dimensions as the image x\boldsymbol{x}. The heatmap can therefore also be visualized as an image. In practice, we would like the heatmapping procedure to satisfy certain properties that we define below.

A heatmapping R(x)\boldsymbol{R}(\boldsymbol{x}) is conservative if the sum of assigned relevances in the pixel space corresponds to the total relevance detected by the model, that is

A heatmapping R(x)\boldsymbol{R}(\boldsymbol{x}) is p​​ ositive if all values forming the heatmap are greater or equal to zero, that is:

The first property was proposed by and ensures that the total redistributed relevance corresponds to the extent to which the object in the input image is detected by the function f(x)f(\boldsymbol{x}). The second property forces the heatmapping to assume that the model is devoid of contradictory evidence (i.e. no pixels can be in contradiction with the presence or absence of the detected object in the image). These two properties of a heatmap can be combined into the notion of consistency:

A heatmapping R(x)\boldsymbol{R}(\boldsymbol{x}) is consistent if it is conservative and positive. That is, it is consistent if it complies with Definitions 1 and 2.

In particular, a consistent heatmap is forced to satisfy (f(x) ⁣= ⁣0)⇒(R(x) ⁣= ⁣0)(f(\boldsymbol{x})\!=\!0)\Rightarrow(\boldsymbol{R}(\boldsymbol{x})\!=\!\boldsymbol{0}). That is, in absence of an object to detect, the relevance is forced to be zero everywhere in the image (i.e. empty heatmap), and not simply to have negative and positive relevance in same amount. We will use Definition 3 as a formal tool for assessing the correctness of the heatmapping techniques proposed in this paper.

It was noted by that there may be multiple heatmapping techniques that satisfy a particular definition. For example, we can consider a heatmapping specification that assigns for all images the relevance uniformly onto the pixel grid:

where dd is the number of input dimensions. Alternately, we can consider another heatmapping specification where all relevance is assigned to the first pixel in the image:

Both (1) and (4) are consistent in the sense of Definition 3, however they lead to different relevance assignments. In practice, it is not possible to specify explicitly all properties that a heatmapping technique should satisfy in order to be meaningful. Instead, it can be given implicitly by the choice of a particular algorithm (e.g. derived from a particular mathematical model), subject to the constraint that it complies with the definitions above.

We present a heatmapping method for explaining the classification f(x)f(\boldsymbol{x}) of a data point x\boldsymbol{x}, that is based on the Taylor expansion of the function ff at some well-chosen root point x~\widetilde{\boldsymbol{x}}, where f(x~)=0f(\widetilde{\boldsymbol{x}})=0. The first-order Taylor expansion of the function is given as

where the sum ∑p\sum_{p} runs over all pixels in the image, and {x~p}\{\widetilde{x}_{p}\} are the pixel values of the root point x~\widetilde{\boldsymbol{x}}. We identify the summed elements as the relevances Rp(x)R_{p}(\boldsymbol{x}) assigned to pixels in the image. The term ε\varepsilon denotes second-order and higher-order terms. Most of the terms in the higher-order expansion involve several pixels at the same time and are therefore more difficult to redistribute. Thus, for simplicity, we will consider only the first-order terms for heatmapping. The heatmap (composed of all identified pixel-wise relevances) can be written as the element-wise product “⊙\odot” between the gradient of the function ∂f/∂x\partial f/\partial\boldsymbol{x} at the root point x~\widetilde{\boldsymbol{x}} and the difference between the image and the root (x−x~)(\boldsymbol{x}-\widetilde{\boldsymbol{x}}):

Figure 2 illustrates the construction of a heatmap in a cartoon example, where a hypothetical function ff detects the presence of an object of class “building” in an image x\boldsymbol{x}. In this example, the root point x~\widetilde{\boldsymbol{x}} is the same image as x\boldsymbol{x} where the building has been blurred. The root point x~\widetilde{\boldsymbol{x}} plays the role of a neutral data point that is similar to the actual data point x\boldsymbol{x} but lacks the particular object in the image that causes f(x)f(\boldsymbol{x}) to be positive. The difference between the image and the root point (x−x~)(\boldsymbol{x}-\widetilde{\boldsymbol{x}}) is therefore an image with only the object “building”. The gradient ∂f/∂x∣x=x~\partial f/\partial\boldsymbol{x}|_{\boldsymbol{x}=\widetilde{\boldsymbol{x}}} measures the sensitivity of the class “building” to each pixel when the classifier ff is evaluated at the root point x~\widetilde{\boldsymbol{x}}. Finally, the sensitivities are multiplied element-wise with the difference (x−x~)(\boldsymbol{x}-\widetilde{\boldsymbol{x}}), producing a heatmap that identifies the most contributing pixels for the object “building”. Strictly speaking, for images with multiple color channels (e.g. RGB), the Taylor decomposition will be performed in terms of pixels and color channels, thus forming multiple heatmaps (one per color channel). Since we are here interested in pixel contributions and not color contributions, we sum the relevance over all color channels, and obtain as a result a single heatmap.

For a given classifier f(x)f(\boldsymbol{x}), the Taylor decomposition approach described above has one free variable: the choice of the root point x~\widetilde{\boldsymbol{x}} at which the Taylor expansion is performed. The example of Figure 2 has provided some intuition on what are the properties of a good root point. In particular, a good root point should selectively remove information from some pixels (here, pixels corresponding to the building at the center of the image), while keeping the surroundings unchanged. This allows in principle for the Taylor decomposition to produce a complete explanation of the detected object which is also insensitive to the surrounding trees and sky.

where X\mathcal{X} is the input domain. The nearest root x~\widetilde{\boldsymbol{x}} must therefore be obtained in the general case by an iterative minimization procedure. It is time consuming when the function f(x)f(\boldsymbol{x}) is expensive to evaluate or differentiate. Furthermore, it is not necessarily solvable due to the possible non-convexity of the minimization problem.

We introduce in the next sections two variants of Taylor decomposition that seek to avoid the high computational requirement, and to produce better heatmaps. The first one called sensitivity analysis makes use of a single gradient evaluation of the function at the data point. The second one called deep Taylor decomposition exploits the structure of the function f(x)f(\boldsymbol{x}) when the latter is a deep neural network in order to redistribute relevance onto pixels using a single forward-backward pass on the network.

II-B Sensitivity Analysis

A simple method to assign relevance onto pixels is to set it proportional to the squared derivatives of the classifier :

where the second-order terms are zero because of the local linearity. The resulting heatmap is positive, but not conservative since almost all relevance is absorbed by the zero-order term f(ξ)f(\boldsymbol{\xi}), which is not redistributed. Sensitivity analysis only measures a local effect and does provide a full explanation of a classification decision. In that case, only relative contributions between different values of RpR_{p} are meaningful.

II-C Deep Taylor Decomposition

A rich class of functions f(x)f(\boldsymbol{x}) that can be trained to map input data to classes is the deep neural network (DNN). A deep neural network is composed of multiple layers of representation, where each layer is composed of a set of neurons. The neural network is trained by adapting its set of parameters at each layer, so that the overall prediction error is minimized. As a result of training a deep network, a particular structure or factorization of the learned function emerges . For example, each neuron in the first layer may react to a particular pixel activation pattern that is localized in the pixel space. The resulting neuron activations may then be used in higher layers to compose more complex nonlinearities that involve a larger number of pixels.

The deep Taylor decomposition method presented here is inspired by the divide-and-conquer paradigm, and exploits the property that the function learned by a deep network is structurally decomposed into a set of simpler subfunctions that relate quantities in adjacent layers. Instead of considering the whole neural network function ff, we consider the mapping of a set of neurons {xi}\{x_{i}\} at a given layer to the relevance RjR_{j} assigned to a neuron xjx_{j} in the next layer. Assuming that these two objects are functionally related by some function Rj({xi})R_{j}(\{x_{i}\}), we would like to apply Taylor decomposition on this local function in order to redistribute relevance RjR_{j} onto lower-layer relevances {Ri}\{R_{i}\}. For these simpler subfunctions, Taylor decomposition should be made easier, in particular, root points should be easier to find. Running this redistribution procedure in a backward pass leads eventually to the pixel-wise relevances {Rp}\{R_{p}\} that form the heatmap.

Figure 3 illustrates in details the procedure of layer-wise relevance propagation on a cartoon example where an image of a cat is presented to a hypothetical deep network. If the neural network has been trained to detect images with an object “cat”, the hidden layers have likely implemented a factorization of the pixels space, where neurons are modeling various features at various locations. In such factored network, relevance redistribution is easier in the top layer where it has to be decided which neurons, and not pixels, are representing the object “cat”. It is also easier in the lower layer where the relevance has already been redistributed by the higher layers to the neurons corresponding to the location of the object “cat”.

Assuming the existence of a function that maps neuron activities {xi}\{x_{i}\} to the upper-layer relevance RjR_{j}, and of a neighboring root point {x~i}\{\widetilde{x}_{i}\} such that Rj({x~i})=0R_{j}(\{\widetilde{x}_{i}\})=0, we can then write the Taylor decomposition of ∑jRj\sum_{j}R_{j} at {xi}\{x_{i}\} as

that redistributes relevance from one layer to the layer below, where ε\varepsilon denotes the Taylor residual, where \big{|}_{\{\widetilde{x}_{i}\}} indicates that the derivative has been evaluated at the root point {x~i}\{\widetilde{x}_{i}\}, where ∑j\sum_{j} runs over neurons at the given layer, and where ∑i\sum_{i} runs over neurons in the lower layer. Equation 6 allows us to identify the relevance of individual neurons in the lower layer in order to apply the same Taylor decomposition technique one layer below.

If each local Taylor decomposition in the network is conservative in the sense of Definition 1, then, the chain of equalities Rf=…=∑jRj=∑iRi=…=∑pRpR_{f}=\ldots=\sum_{j}R_{j}=\sum_{i}R_{i}=\ldots=\sum_{p}R_{p} should hold. This chain of equalities is referred by as layer-wise relevance conservation. Similarly, if Definition 2 holds for each local Taylor decomposition, the positivity of relevance scores at each layer Rf,…,{Rj},{Ri},…,{Rp}≥0R_{f},\dots,\{R_{j}\},\{R_{i}\},\dots,\{R_{p}\}\geq 0 is also ensured. Finally, if all Taylor decompositions of local subfunctions are consistent in the sense of Definition 3, then, the whole deep Taylor decomposition is also consistent in the same sense.

III Application to One-Layer Networks

As a starting point for better understanding deep Taylor decomposition, in particular, how it leads to practical rules for relevance propagation, we work through a simple example, with advantageous analytical properties. We consider a detection-pooling network made of one layer of nonlinearity. The network is defined as

where {xi}\{x_{i}\} is a dd-dimensional input, {xj}\{x_{j}\} is a detection layer, xkx_{k} is the output, and θ={wij,bj}\theta=\{w_{ij},b_{j}\} are the weight and bias parameters of the network. The one-layer network is depicted in Figure 4. The mapping {xi}→xk\{x_{i}\}\to x_{k} defines a function g∈Gg\in\mathcal{G}, where G\mathcal{G} denotes the set of functions representable by this one-layer network. We will set an additional constraint on biases, where we force bj≤0b_{j}\leq 0 for all jj. Imposing this constraint guarantees the existence of a root point {x~i}\{\widetilde{x}_{i}\} of the function gg (located at the origin), and thus also ensures the applicability of standard Taylor decomposition, for which a root point is needed.

We now perform the deep Taylor decomposition of this function. We start by equating the predicted output to the amount of total relevance that must be backpropagated. That is, we define Rk=xkR_{k}=x_{k}. The relevance for the top layer can now be expressed in terms of lower-layer neurons as:

Having established the mapping between {xj}\{x_{j}\} and RkR_{k}, we would like to redistribute RkR_{k} onto neurons {xj}\{x_{j}\}. Using Taylor decomposition (Equation 5), redistributed relevances RjR_{j} can be written as:

We still need to choose a root point {x~j}\{\widetilde{x}_{j}\}. The list of all root points of this function is given by the plane equation ∑jx~j=0\sum_{j}\widetilde{x}_{j}=0. However, for the root to play its role of reference point, it should be admissible. Here, because of the application of the function max⁡(0,⋅)\max(0,\cdot) in the preceding layer, the root point must be positive. The only point that is both a root (∑jx~j=0\sum_{j}\widetilde{x}_{j}=0) and admissible (∀j:x~j≥0\forall j:\widetilde{x}_{j}\geq 0) is {x~j}=0\{\widetilde{x}_{j}\}=\boldsymbol{0}. Choosing this root point in Equation 10, and observing that the derivative ∂Rk∂xj=1\frac{\partial R_{k}}{\partial x_{j}}=1, we obtain the first rule for relevance redistribution:

In other words, the relevance must be redistributed on the neurons of the detection layer in same proportion as their activation value. Trivially, we can also verify that the relevance is conserved during the redistribution process (∑jRj=∑jxj=Rk\sum_{j}R_{j}=\sum_{j}x_{j}=R_{k}) and positive (Rj=xj≥0R_{j}=x_{j}\geq 0).

Let us now express the relevance RjR_{j} as a function of the input neurons {xi}\{x_{i}\}. Because Rj=xjR_{j}=x_{j} as a result of applying the propagation rule of Equation 11, we can write

that establishes a mapping between {xi}\{x_{i}\} and RjR_{j}. To obtain redistributed relevances {Ri}\{R_{i}\}, we will apply Taylor decomposition again on this new function. The identification of the redistributed total relevance ∑jRj\sum_{j}R_{j} onto the preceding layer was identified in Equation 6 as:

The propagation rule consists of redistributing relevance according to the square magnitude of the weights, and pooling relevance across all neurons jj. This rule is also valid for Rj=0R_{j}=0, where the actual point {xi}\{x_{i}\} is already a root, and for which no relevance needs to be propagated.

For all g∈Gg\in\mathcal{G}, the deep Taylor decomposition with the w2w^{2}-rule is consistent in the sense of Definition 3.

The w2w^{2}-rule resembles the rule by for determining the importance of input variables in neural networks, where absolute values of wijw_{ij} are used in place of squared values. It is important to note that the decomposition that we propose here is modulated by the upper layer data-dependent RjR_{j}s, which leads to an individual explanation for each data point.

III-B Constrained Input Space and the z𝑧z-Rules

(called z+ ⁣z^{+}\!-rule), where zij+=xiwij+z_{ij}^{+}=x_{i}w_{ij}^{+}, and where wij+w_{ij}^{+} denotes the positive part of wijw_{ij}. This rule corresponds for positive input spaces to the αβ\alpha\beta-rule formerly proposed by with α=1\alpha=1 and β=0\beta=0. The z+ ⁣z^{+}\!-rule will be used in Section IV to propagate relevances in higher layers of a neural network where neuron activations are positive.

For image classification tasks, pixel spaces are typically subjects to box-constraints, where an image has to be in the domain B={{xi}:∀i=1d li≤xi≤hi}\mathcal{B}=\{\{x_{i}\}:\forall_{i=1}^{d}~{}l_{i}\leq x_{i}\leq h_{i}\}, where li≤0l_{i}\leq 0 and hi≥0h_{i}\geq 0 are the smallest and largest admissible pixel values for each dimension. In that new constrained setting, we can restrict the search for a root on the segment ({li1wij>0+hi1wij<0},{xi})⊂B(\{l_{i}1_{w_{ij}>0}+h_{i}1_{w_{ij}<0}\},\{x_{i}\})\subset\mathcal{B}, where we know that there is at least one root at its first extremity. Injecting the nearest root on that segment into Equation 13, we obtain relevance propagation rule:

(called zB ⁣z^{\mathcal{B}}\!-rule), where zij=xiwijz_{ij}=x_{i}w_{ij}, and where we note the presence of data-independent additive terms in the numerator and denominator. The idea of using an additive term in the denominator was formerly proposed by and called ϵ\epsilon-stabilized rule. However, the objective of was to make the denominator non-zero to avoid numerical instability, while in our case, the additive terms serve to enforce positivity.

For all g∈Gg\in\mathcal{G} and data points {xi}∈B\{x_{i}\}\in\mathcal{B}, the deep Taylor decomposition with the zB ⁣z^{\mathcal{B}}\!-rule is consistent in the sense of Definition 3.

Detailed derivations of the proposed rules, proofs of Propositions 1, 2 and 3, and algorithms that implement these rules efficiently are given in the supplement. The properties of the relevance propagation techniques considered so far (when applied to functions g∈Gg\in\mathcal{G}), their domain of applicability, their consistency, and other computational properties, are summarized in the table below:

(⋆) e.g. using the continuously differentiable approximation of the detection function max⁡(0,x)=lim⁡t→∞t−1log⁡(0.5+0.5exp⁡(tx))\max(0,x)=\lim_{t\to\infty}t^{-1}\log(0.5+0.5\exp(tx)).

III-C Experiment

We now demonstrate empirically the properties of the heatmapping techniques introduced so far on the network of Figure 4 trained to predict whether a MNIST handwritten digit of class 0–3 is present in the input image, next to a distractor digit of a different class 4–9. The neural network is trained to output xk=0x_{k}=0 if there is no digit to detect in the image and xk=100x_{k}=100 if there is one. We minimize the mean-square error between the true scores {0,100}\{0,100\}, and the neural network output xkx_{k}. Treating the supervised task as a regression problem forces the network to assign approximately the same amount of relevance to all positive examples, and as little relevance as possible to the negative examples.

The input image is of size 28×5628\times 56 pixels and is coded between −0.5-0.5 (black) and +1.5+1.5 (white). The neural network has 28×5628\times 56 input neurons {xi}\{x_{i}\}, 400400 hidden neurons {xj}\{x_{j}\}, and one output xkx_{k}. Weights {wij}\{w_{ij}\} are initialized using a normal distribution of mean and standard deviation 0.050.05. Biases {bj}\{b_{j}\} are initialized to zero and constrained to be negative or zero throughout training, in order to meet our specification of the one-layer network. The neural network is trained for 300000300000 iterations of stochastic gradient descent with a minibatch of size 2020 and a small learning rate. Training data is extended with translated versions of MNIST digits. The root {x~i}\{\widetilde{x}_{i}\} for the nearest root Taylor method is chosen in our experiments to be the nearest point such that f({x~i})<0.1f({xi})f(\{\widetilde{x}_{i}\})<0.1f(\{x_{i}\}). The zB ⁣z^{\mathcal{B}}\!-rule is computed using as a lower- and upper-bounds ∀i:li=−0.5\forall_{i}:l_{i}=-0.5 and hi=1.5h_{i}=1.5.

Heatmaps are shown in Figure 6 for sensitivity analysis, nearest root Taylor decomposition, and deep Taylor decomposition with the w2w^{2}- and zB ⁣z^{\mathcal{B}}\!-rules. In all cases, we observe that the heatmapping procedure correctly assigns most of the relevance to pixels where the digit to detect is located. Sensitivity analysis produces unbalanced and incomplete heatmaps, with some input points reacting strongly, and others reacting weakly, and with a considerable amount of relevance associated to the border of the image, where there is no information. Nearest root Taylor produces selective heatmaps, that are still not fully complete. The heatmaps produced by deep Taylor decomposition with the w2w^{2}-rule, are similar to nearest root Taylor, but blurred, and not perfectly aligned with the data. The domain-aware zB ⁣z^{\mathcal{B}}\!-rule produces heatmaps that are still blurred, but that are complete and well-aligned with the data.

Figure 6 quantitatively evaluates heatmapping techniques of Figure 6. The scatter plots compare the total output relevance with the sum of pixel-wise relevances. Each point in the scatter plot is a different data point drawn independently from the input distribution. These scatter plots test empirically for each heatmapping method whether it is conservative in the sense of Definition 1. In particular, if all points lie on the diagonal line of the scatter plot, then ∑pRp=Rf\sum_{p}R_{p}=R_{f}, and the heatmapping is conservative. The histograms just below test empirically whether the studied heatmapping methods satisfy positivity in the sense of Definition 2, by counting the number of times (shown on a log-scale) pixel-wise contributions RpR_{p} take a certain value. Red color in the histogram indicates positive relevance assignments, and blue color indicates negative relevance assignments. Therefore, an absence of blue bars in the histogram indicates that the heatmap is positive (the desired behavior). Overall, the scatter plots and the histograms produce a complete description of the degree of consistency of the heatmapping techniques in the sense of Definition 3.

Sensitivity analysis only measures a local effect and therefore does not conceptually redistribute relevance onto the input. However, we can still measure the relative strength of computed sensitivities between examples or pixels. The nearest root Taylor approach, although producing mostly positive heatmaps, dissipates a large fraction of the relevance. The deep Taylor decomposition on the other hand ensure full consistency, as theoretically predicted by Propositions 1 and 3. The zBz^{\mathcal{B}}-rule spreads relevance onto more pixels than methods based on nearest root, as shown by the shorter tail of its relevance histogram.

IV Application to Deep Networks

In order to represent efficiently complex hierarchical problems, one needs deeper architectures. These architectures are typically made of several layers of nonlinearity, where each layer extracts features at different scale. An example of deep architecture is shown in Figure 7 (left). In this example, the input is first processed by feature extractors localized in the pixel space. The resulting features are combined into more complex mid-level features that cover more pixels. Finally, these more complex features are combined in a final stage of nonlinear mapping, that produces a score determining whether the object to detect is present in the input image or not. A practical example of deep network with similar hierarchical architecture, and that is frequently used for image recognition tasks, is the convolutional neural network .

In Section II and III, we have assumed the existence and knowledge of a functional mapping between the neuron activities at a given layer and relevances in the higher layer. However, in deep architectures, the mapping may be unknown (although it may still exist). In order to redistribute the relevance from the higher layers to the lower layers, one needs to make this mapping explicit. For this purpose, we introduce the concept of relevance model.

A relevance model is a function that maps a set of neuron activations at a given layer to the relevance of a neuron in a higher layer, and whose output can be redistributed onto its input variables, for the purpose of propagating relevance backwards in the network. For the deep network of Figure 7 (left), on can for example, try to predict RkR_{k} from {xi}\{x_{i}\}, which then allows us to decompose the predicted relevance RkR_{k} into lower-layer relevances {Ri}\{R_{i}\}. For practical purposes, the relevance models we will consider borrow the structure of the one-layer network studied in Section III, and for which we have already derived a deep Taylor decomposition.

Upper-layer relevance is not only determined by input neuron activations of the considered layer, but also by high-level information (i.e. abstractions) that have been formed in the top layers of the network. These high-level abstractions are necessary to ensure a global cohesion between low-level parts of the heatmap.

We first consider a trainable relevance model of RkR_{k}. This relevance model is illustrated in Figure 7-1 and is designed to incorporate both bottom-up and top-down information, in a way that the relevance can still be fully decomposed in terms of input neurons. It is defined as

where aj=min⁡(0,∑lRlvlj+dj)a_{j}=\min(0,\textstyle{\sum}_{l}R_{l}v_{lj}+d_{j}) is a negative bias that depends on upper-layer relevances, and where ∑l\sum_{l} runs over the detection neurons of that upper-layer. This negative bias plays the role of an inhibitor, in particular, it prevents the activation of the detection unit yjy_{j} of the relevance model in the case where no upper-level abstraction in {Rl}\{R_{l}\} matches the feature detected in {xi}\{x_{i}\}.

The parameters {vij,vlj,dj}\{v_{ij},v_{lj},d_{j}\} of the relevance model are learned by minimization of the mean square error objective

where RkR_{k} is the true relevance, R^k\widehat{R}_{k} is the predicted relevance, and ⟨⋅⟩\langle\cdot\rangle is the expectation with respect to the data distribution.

Because the relevance model has exactly the same structure as the one-layer neural network described in Section III, in particular, because aja_{j} is negative and only weakly dependent on the set of neurons {xi}\{x_{i}\}, one can apply the same set of rules for relevance propagation. That is, we compute

for the detection layer, where qij=vij2q_{ij}=v_{ij}^{2}, qij=xivij+q_{ij}=x_{i}v_{ij}^{+}, or qij=xivij−livij+−hivij−q_{ij}=x_{i}v_{ij}-l_{i}v_{ij}^{+}-h_{i}v_{ij}^{-} if choosing the w2w^{2}-, z+ ⁣z^{+}\!-, zB ⁣z^{\mathcal{B}}\!-rules respectively. This set of equations used to backpropagate relevance from RkR_{k} to {Ri}\{R_{i}\}, is approximately conservative, with an approximation error that is determined by how much on average the output of the relevance model R^k\widehat{R}_{k} differs from the true relevance RkR_{k}.

IV-B Training-Free Relevance Model

A large deep neural network may have taken weeks or months to train, and we should be able to explain it without having to train a relevance model for each neuron. We consider the original feature extractor

where the LpL^{p}-norm can represent a variety of pooling operations such as sum-pooling or max-pooling. Assuming that the upper-layer has been explained by the z+ ⁣z^{+}\!-rule, and indexing by ll the detection neurons of that upper-layer, we can write the relevance RkR_{k} as

The first term is a linear pooling over detection units that has the same structure as the network of Section III. The second term is a positive Lp/L1L^{p}/L^{1} pooling ratio, which is constant under any permutation of neurons {xj}\{x_{j}\}, or multiplication of these neurons by a scalar. The last term is a positive weighted sum of higher-level relevances, that measures the sensitivity of the neuron relevance to its activation. It is mainly determined by the relevance found in higher layers and can be viewed as a top-down contextualization term dk({Rl})d_{k}(\{R_{l}\}). Thus, we rewrite the relevance as

where the pooling ratio ck>0c_{k}>0 and the top-down term dk({Rl})>0d_{k}(\{R_{l}\})>0 are only weakly dependent on {xj}\{x_{j}\} and are approximated as constant terms. This relevance model is illustrated in Figure 7-2. Because the relevance model above has the same structure as the network of Section III (up to a constant factor), it is easy to derive its Taylor decomposition, in particular one can show that

where relevance is redistributed in proportion to activations in the detection layer, and that

where qij=wij2q_{ij}=w_{ij}^{2}, qij=xiwij+q_{ij}=x_{i}w_{ij}^{+}, or qij=xiwij−liwij+−hiwij−q_{ij}=x_{i}w_{ij}-l_{i}w_{ij}^{+}-h_{i}w_{ij}^{-} if choosing the w2w^{2}-, z+ ⁣z^{+}\!-, zB ⁣z^{\mathcal{B}}\!-rules respectively. If choosing the z+ ⁣z^{+}\!-rule for that layer again, the same training-free decomposition technique can be applied again to the layer below, and the process can be repeated until the input layer. Thus, when using the training-free relevance model, all layers of the network must be decomposed using the z+ ⁣z^{+}\!-rule, except the first layer for which other rules can be applied such as the w2w^{2}-rule or the zB ⁣z^{\mathcal{B}}\!-rule.

The technical advantages and disadvantages of each heatmapping method are summarized in the table below:

† Conservative up to a fitting error between the redistributed relevance and the relevance model output. ‡ Root finding and relevance model training are in the general case both nonconvex.

IV-C Experiment on MNIST

We train a neural network with two layers of nonlinearity on the same MNIST problem as in Section III. The neural network is composed of a first detection-pooling layer with 400400 detection neurons sum-pooled into 100100 units (i.e. we sum-pool groups of 4 detection units). A second detection-pooling layer with 400400 detection neurons is applied to the resulting 100100-dimensional output of the previous layer, and activities are sum-pooled onto a single unit representing the deep network output. In addition, we learn a min-max relevance model for the first layer. The relevance model is trained to minimize the mean-square error between the relevance model output and the true relevance (obtained by application of the z+ ⁣z^{+}\!-rule in the top layer). The deep network and the relevance models are trained using stochastic gradient descent with minibatch size 2020, for 300000300000 iterations, and using a small learning rate.

Figure 9 shows heatmaps obtained with sensitivity analysis, standard Taylor decomposition, and deep Taylor decomposition with different relevance models. We apply the zB ⁣z^{\mathcal{B}}\!-rule to backpropagate relevance of pooled features onto pixels. Sensitivity analysis and standard Taylor decomposition produce noisy and incomplete heatmaps. These two methods do not handle well the increased depth of the network. The min-max Taylor decomposition and the training-free Taylor decomposition produce relevance maps that are complete, and qualitatively similar to those obtained by deep Taylor decomposition of the shallow architecture in Section III. This demonstrates the high level of transparency of deep Taylor methods with respect to the choice of architecture. The heatmaps obtained by the trained min-max relevance model and by the training-free method are of similar quality.

Similar advantageous properties of the deep Taylor decomposition are observed quantitatively in the plots of Figure 9. The standard Taylor decomposition is positive, but dissipates relevance. The deep Taylor decomposition with the min-max relevance model produces near-conservative heatmaps, and the training-free deep Taylor decomposition produces heatmaps that are fully conservative. Both deep Taylor decomposition variants shown here also ensures positivity, due to the application of the zB ⁣z^{\mathcal{B}}\!- and z+ ⁣z^{+}\!-rule in the respective layers.

IV-D Experiment on ILSVRC

We now apply the fast training-free decomposition to explain decisions made by large neural networks (BVLC Reference CaffeNet and GoogleNet ) trained on the dataset of the ImageNet large scale visual recognition challenges ILSVRC 2012 and ILSVRC 2014 respectively. For these models, standard Taylor decomposition methods with root finding are computationally too expensive. We keep the neural networks unchanged.

The training-free relevance propagation method is tested on a number of images from Pixabay.com and Wikimedia Commons. The zB ⁣z^{\mathcal{B}}\!-rule is applied to the first convolution layer. For all higher convolution and fully-connected layers, the z+ ⁣z^{+}\!-rule is applied. Positive biases (that are not allowed in our deep Taylor framework), are treated as neurons, on which relevance can be redistributed (i.e. we add max⁡(0,bj)\max(0,b_{j}) in the denominator of zB ⁣z^{\mathcal{B}}\!- and z+ ⁣z^{\mathcal{+}}\!-rules). Normalization layers are bypassed in the relevance propagation pass. In order to visualize the heatmaps in the pixel space, we sum the relevances of the three color channels, leading to single-channel heatmaps, where the red color designates relevant regions.

Figure 10 shows the resulting heatmaps for eight different images. Deep Taylor decomposition produces exhaustive heatmaps covering the whole object to detect. On the other hand, sensitivity analysis assigns most of the relevance to a few pixels. Deep Taylor heatmaps for the Caffenet and Googlenet have a high level of similarity, showing the transparency of the heatmapping method to the choice of deep network architecture. However, GoogleNet being more accurate, its corresponding heatmaps are also of better quality, with more heat associated to the truly relevant parts of the image. Heatmaps identify the dorsal fin of the shark, the head of the cat, the flame above the matchsticks, or the wheels of the motorbike. The heatmaps are able to detect two instances of the same object within a same image, for example, the two frogs and the two stupas. The heatmaps also ignore most of the distracting structure, such as the horizontal lines above the cat’s head, the wood pattern behind the matches, or the grass behind the motorcycle. Sometimes, the object to detect is shown in a less stereotypical pose or can be confused with the background. For example, the sheeps in the top-right image are overlapping and superposed to a background of same color, and the scooter is difficult to separate from the complex and high contrast urban background. This confuses the network and the heatmapping procedure, and in that case, a significant amount of relevance is lost to the background.

Figure 11 studies the special case of an image of class “volcano”, and a zoomed portion of it. On a global scale, the heatmapping method recognizes the characteristic outline of the volcano. On a local scale, the relevance is present on both sides of the edge of the volcano, which is consistent with the fact that the two sides of the edge are necessary to detect it. The zoomed portion of the image also reveals different stride sizes in the first convolution layer between CaffeNet (stride 4) and GoogleNet (stride 2). Therefore, our proposed heatmapping technique produces explanations that are interpretable both at a global and local scale in the pixel space.

V Conclusion

Nonlinear machine learning models have become standard tools in science and industry due to their excellent performance even for large, complex and high-dimensional problems. However, in practice it becomes more and more important to understand the underlying nonlinear model, i.e. to achieve transparency of what aspect of the input makes the model decide.

To achieve this, we have contributed by novel conceptual ideas to deconstruct nonlinear models. Specifically, we have proposed a novel relevance propagation approach based on deep Taylor decomposition, that is used to efficiently assess the importance of single pixels in image classification applications. Thus, we are now able to compute heatmaps that clearly and intuitively allow to better understand the role of input pixels when classifying an unseen data point.

In particular, we have shed light on theoretical connections between the Taylor decomposition of a function and rule-based relevance propagation techniques, showing a clear relationship between these two approaches for a particular class of neural networks. We have introduced the concept of relevance model as a mean to scale deep Taylor decomposition to neural networks with many layers. Our method is stable under different architectures and datasets, and does not require hyperparameter tuning.

We would like to stress, that we are free to use as a starting point of our framework either an own trained and carefully tuned neural network model or we may also download existing pre-trained deep network models (e.g. the Caffe Reference ImageNet Model ) that have already been shown to achieve excellent performance on benchmarks. In both cases, our layer-wise relevance propagation concept can provide explanation. In other words our approach is orthogonal to the quest for enhanced results on benchmarks, in fact, we can use any benchmark winner and then enhance its transparency to the user.

References