Explaining NonLinear Classification Decisions with Deep Taylor Decomposition

Nonlinear methods such as Deep Neural Networks (DNNs) are the gold standard for various challenging machine learning problems, e.g., image classification, natural language processing or human action recognition. Although these methods perform impressively well, they have a significant disadvantage, the lack of transparency, limiting the interpretability of the solution and thus the scope of application in practice. Especially DNNs act as black boxes due to their multilayer nonlinear structure. In this paper we introduce a novel methodology for interpreting generic multilayer neural networks by decomposing the network classification decision into contributions of its input elements. Although our focus is on image classification, the method is applicable to a broad set of input data, learning tasks and network architectures. Our method is based on deep Taylor decomposition and efficiently utilizes the structure of the network by backpropagating the explanations from the output to the input layer. We evaluate the proposed method empirically on the MNIST and ILSVRC data sets.


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 [1], kernels [2], [3], Gaussian processes [4], neural networks [5], [6], [7], boosting [8], or random forests [9].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 [10], [11], [12].Deep networks have also been applied successfully to other research fields such as natural language processing [13], [14], human action recognition [15], [16], or physics [17], [18].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 [19], [20]).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. [21] 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. [22] 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 [23] 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 Fig. 1.Overview of our method for explaining a nonlinear classification decision.The method produces a pixel-wise heatmap explaining why a neural network classifier has come up with a particular decision (here, detecting the digit "0" in an input image composed of two digits).The heatmap is the result of a deep Taylor decomposition of the neural network function.Note that for the purpose of the visualization, the left and right side of the figure are mirrored.
of another distracting digit.The classification decision is first decomposed in terms of contributions R 1 , R 2 , R 3 of respective hidden neurons x 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 [22] (the αβ-rule and the -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 [24] or [21].However, we refer to [25] 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.

Related Work
There has been a significant body of work focusing on the analysis and understanding of nonlinear classifiers such as kernel machines [26], [27], [28], [29], neural networks [30], [31], [32], [33], or a broader class of nonlinear models [34], [22].In particular, some recent analyses have focused on the understanding of state-of-the-art GPU-trained convolutional neural networks for image classification [35], [24], [21], 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) [26], [29], [33], its invariance to certain transformations of the data [32] or the role of particular neurons [36].
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 [27], [28] 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. [24] incorporate saliency information by multiplying the gradient by the actual data point.
The method proposed by Zeiler and Fergus [21] 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.[22] 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 [25].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 [34] as a nonlinear generalization of the Oaxaca method in econometrics [20].The idea was subsequently introduced in the context of image analysis [22], [24] 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 [22].
As an alternative to propagation methods, spatial response maps [37] 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 [38].They can also visualize what part of an image is relevant at a given time in some temporal context [39].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 p 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.
Let us consider a positive-valued function f : R d → R + .In the context of image classification, the input x ∈ R d of this function can be an image.The image can be decomposed as a set of pixel values x = {x p } where p denotes a particular pixel.The function f (x) quantifies the presence (or amount) of a certain type of object(s) in the image.This quantity can be for example a probability, or the number of occurrences of the object.A function value f (x) = 0 indicates the absence of such object(s) in the image.On the other hand, a function value f (x) > 0 expresses the presence of the object(s) with a certain probability or in a certain amount.
We would like to associate to each pixel p in the image a relevance score R p (x), that indicates for an image x to what extent the pixel p contributes to explaining the classification decision f (x).The relevance of each pixel can be stored in a heatmap denoted by R(x) = {R p (x)} of same dimensions as the image 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.Definition 1.A heatmapping R(x) is conservative if the sum of assigned relevances in the pixel space corresponds to the total relevance detected by the model, that is Definition 2. A heatmapping R(x) is positive if all values forming the heatmap are greater or equal to zero, that is: The first property was proposed by [22] 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).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: Definition 3. A heatmapping R(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).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 [22] 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 d 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 ( 2) 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.

A. Taylor Decomposition
We present a heatmapping method for explaining the classification f (x) of a data point x, that is based on the Taylor expansion of the function f at some well-chosen root point x, where f ( x) = 0.The first-order Taylor expansion of the function is given as where the sum p runs over all pixels in the image, and { x p } are the pixel values of the root point x.We identify the summed elements as the relevances R p (x) assigned to pixels in the image.The term ε 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 " " between the gradient of the function ∂f /∂x at the root point x and the difference between the image and the root (x − x): the root point x is the same image as x where the building has been blurred.The root point x plays the role of a neutral data point that is similar to the actual data point x but lacks the particular object in the image that causes f (x) to be positive.The difference between the image and the root point (x − x) is therefore an image with only the object "building".The gradient ∂f /∂x| x= x measures the sensitivity of the class "building" to each pixel when the classifier f is evaluated at the root point x.Finally, the sensitivities are multiplied element-wise with the difference (x− 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), the Taylor decomposition approach described above has one free variable: the choice of the root point 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.
More formally, a good root point is one that removes the object (e.g. as detected by the function f (x), but that minimally deviates from the original point x.In mathematical terms, it is a point x with f ( x) = 0 that lies in the vicinity of x under some distance metric, for example the nearest root.If x, x ∈ R d , one can show that for a continuously differentiable function f the gradient at the nearest root always points to the same direction as the difference x − x, and their element-wise product is always positive, thus satisfying Definition 2. Relevance conservation in the sense of Definition 1 is however not satisfied for general functions f due to the possible presence of non-zero higher-order terms in ε.The nearest root x can be obtained as a solution of an optimization problem [35], by minimizing the objective where X is the input domain.The nearest root x must therefore be obtained in the general case by an iterative minimization procedure.It is time consuming when the function f (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) when the latter is a deep neural network in order to redistribute relevance onto pixels using a single forwardbackward pass on the network.

B. Sensitivity Analysis
A simple method to assign relevance onto pixels is to set it proportional to the squared derivatives of the classifier [40]: where the power applies element-wise.This redistribution can be viewed as a special instance of Taylor decomposition where one expands the function at a point ξ ∈ R d , which is taken at an infinitesimally small distance from the actual point x, in the direction of maximum descent of f (i.e.ξ = x−δ •∂f /∂x with δ small).Assuming that the function is locally linear, and therefore, the gradient is locally constant, we get 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 (ξ), 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 R p are meaningful.

C. Deep Taylor Decomposition
A rich class of functions f (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 The function value is encoded by the output neuron x f .The output neuron is assigned relevance R f = x f .Relevances are backpropagated from the top layer down to the input, where {Rp} denotes the relevance scores of all pixels.The last neuron of the lowest hidden layer is perceived as relevant by higher layers and redistributes its assigned relevance onto the pixels.Other neurons of the same layer are perceived as less relevant and do not significantly contribute to the heatmap.
structure or factorization of the learned function emerges [41].
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 [42] 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 f , we consider the mapping of a set of neurons {x i } at a given layer to the relevance R j assigned to a neuron x j in the next layer.Assuming that these two objects are functionally related by some function R j ({x i }), we would like to apply Taylor decomposition on this local function in order to redistribute relevance R j onto lower-layer relevances {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 pixelwise relevances {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 {x i } to the upper-layer relevance R j , and of a neighboring root point { x i } such that R j ({ x i }) = 0, we can then write the Taylor decomposition of j R j at {x i } as that redistributes relevance from one layer to the layer below, where ε denotes the Taylor residual, where { xi} indicates that the derivative has been evaluated at the root point { x i }, where j runs over neurons at the given layer, and where i runs over neurons in the lower layer.Equation 4 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 This chain of equalities is referred by [22] as layerwise relevance conservation.Similarly, if Definition 2 holds for each local Taylor decomposition, the positivity of relevance scores at each layer R f , . . ., {R j }, {R i }, . . ., {R p } ≥ 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 Detection-pooling network that implements Equations 5 and 6: The first layer detects features in the input space, the second layer pools the detected features into an output score.
in Figure 4.The mapping {x i } → x k defines a function g ∈ G, where G denotes the set of functions representable by this onelayer network.We will set an additional constraint on biases, where we force b j ≤ 0 for all j.Imposing this constraint guarantees the existence of a root point { x i } of the function g (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 R 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 {x j } and R k , we would like to redistribute R k onto neurons {x j }.Using Taylor decomposition (Equation 3), redistributed relevances R j can be written as: We still need to choose a root point { x j }.The list of all root points of this function is given by the plane equation j 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, •) in the preceding layer, the root point must be positive.The only point that is both a root ( j x j = 0) and admissible (∀j : Choosing this root point in Equation 8, and observing that the derivative ∂R k ∂xj = 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 ( j R j = j x j = R k ) and positive (R j = x j ≥ 0).
Let us now express the relevance R j as a function of the input neurons {x i }.Because R j = x j as a result of applying the propagation rule of Equation 9, we can write that establishes a mapping between {x i } and R j .To obtain redistributed relevances {R i }, we will apply Taylor decomposition again on this new function.The identification of the redistributed total relevance j R j onto the preceding layer was identified in Equation 4as: Relevances {R i } can therefore be obtained by performing as many Taylor decompositions as there are neurons in the hidden layer.Note that a superscript (j) has been added to the root point { x i } in order to emphasize that a different root point is chosen for decomposing each relevance R j .We will introduce below various methods for choosing a root { x i } (j) that consider the diversity of possible input domains X ⊆ R d to which the data belongs.Each choice of input domain and associated method to find a root will lead to a different rule for propagating relevance {R j } to {R i }.
A. Unconstrained Input Space and the w 2 -Rule We first consider the simplest case where any real-valued input is admissible (X = R d ).In that case, we can always choose the root point { x i } (j) that is nearest in the Euclidean sense to the actual data point {x i }.When R j > 0, the nearest root of R j as defined in Equation 10is the intersection of the plane equation i x (j) i w ij + b j = 0, and the line of maximum descent { x i } (j) = {x i } + t • w j , where w j is the vector of weight parameters that connects the input to neuron x j and t ∈ R. The intersection of these two subspaces is the nearest root point.It is given by Injecting this root into Equation 11, the relevance redistributed onto neuron i becomes: The propagation rule consists of redistributing relevance according to the square magnitude of the weights, and pooling relevance across all neurons j.This rule is also valid for R j = 0, where the actual point {x i } is already a root, and for which no relevance needs to be propagated.
Proposition 1.For all g ∈ G, the deep Taylor decomposition with the w 2 -rule is consistent in the sense of Definition 3.
The w 2 -rule resembles the rule by [30], [40] for determining the importance of input variables in neural networks, where absolute values of w 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 R j s, which leads to an individual explanation for each data point.

B. Constrained Input Space and the z-Rules
When the input domain is restricted to a subset X ⊂ R d , the nearest root of R j in the Euclidean sense might fall outside of X .In the general case, finding the nearest root in this constrained input space can be difficult.An alternative is to further restrict the search domain to a subset of X where nearest root search becomes feasible again.
We first study the case X = R d + , which arises, for example in feature spaces that follow the application of rectified linear units.In that case, we restrict the search domain to the segment + , that we know contains at least one root at its first extremity.Injecting the nearest root on that segment into Equation 11, we obtain the relevance propagation rule: , and where w + ij denotes the positive part of w ij .This rule corresponds for positive input spaces to the αβ-rule formerly proposed by [22] with α = 1 and β = 0.The z + -rule will be used in Section IV to propagate relevances in higher layers of a neural network where neuron activations are positive.
Proposition 2. For all g ∈ G and data points {x i } ∈ R d + , the deep Taylor decomposition with the z + -rule is consistent in the sense of Definition 3.
For image classification tasks, pixel spaces are typically subjects to box-constraints, where an image has to be in the domain , where l i ≤ 0 and h i ≥ 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 ({l i 1 wij >0 +h i 1 wij <0 }, {x i }) ⊂ B, where we know that there is at least one root at its first extremity.Injecting the nearest root on that segment into Equation 11, we obtain relevance propagation rule: , where z 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 [22] and calledstabilized rule.However, the objective of [22] was to make the denominator non-zero to avoid numerical instability, while in our case, the additive terms serve to enforce positivity.
Proposition 3.For all g ∈ G and data points {x i } ∈ B, the deep Taylor decomposition with the z 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 ∈ G), their domain of applicability, their consistency, and other computational properties, are summarized in the ( ) e.g. using the continuously differentiable approximation of the detection function max(0, x) = limt→∞ t −1 log(0.5 + 0.5 exp(tx)).

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 x k = 0 if there is no digit to detect in the image and x k = 100 if there is one.We minimize the mean-square error between the true scores {0, 100}, and the neural network output x 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 × 56 pixels and is coded between −0.5 (black) and +1.5 (white).The neural network has 28×56 input neurons {x i }, 400 hidden neurons {x j }, and one output x k .Weights {w ij } are initialized using a normal distribution of mean 0 and standard deviation 0.05.Biases {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 300000 iterations of stochastic gradient descent with a minibatch of size 20 and a small learning rate.Training data is extended with translated versions of MNIST digits.The root { 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 ({x i }).The z B -rule is computed using as a lower-and upper-bounds ∀ i : l i = −0.5 and h i = 1.5.
Heatmaps are shown in Figure 5 for sensitivity analysis, nearest root Taylor decomposition, and deep Taylor decomposition with the w 2 -and z 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 w 2 -rule, are similar to nearest root Taylor, but blurred, and not perfectly aligned with the data.The domain-aware z 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 5.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 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 R 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 z 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 [43].
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 R k from {x i }, which then allows us to decompose the predicted relevance R k into lower-layer relevances {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 highlevel 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.

A. Min-Max Relevance Model
We first consider a trainable relevance model of R 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 a j = min(0, l R l v lj + d j ) is a negative bias that depends on upper-layer relevances, and where 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 y j of the relevance model in the case where no upper-level abstraction in {R l } matches the feature detected in {x i }.
The parameters {v ij , v lj , d j } of the relevance model are learned by minimization of the mean square error objective where R k is the true relevance, R k is the predicted relevance, and • 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 a j is negative and only weakly dependent on the set of neurons {x i }, one can apply the same set of rules for relevance propagation.That is, we compute for the pooling layer and for the detection layer, where choosing the w 2 -, z + -, z Brules respectively.This set of equations used to backpropagate relevance from R k to {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 differs from the true relevance R k .

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 L 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 + -rule, and indexing by l the detection neurons of that upper-layer, we can write the relevance R 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 L p /L 1 pooling ratio, which is constant under any permutation of neurons {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 d k ({R l }).Thus, we rewrite the relevance as where the pooling ratio c k > 0 and the top-down term d k ({R l }) > 0 are only weakly dependent on {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 if choosing the w 2 -, z + -, z B -rules respectively.If choosing the 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 + -rule, except the first layer for which other rules can be applied such as the w 2 -rule or the z B -rule.

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 400 detection neurons sum-pooled into 100 units (i.e.we sumpool groups of 4 detection units).A second detection-pooling layer with 400 detection neurons is applied to the resulting 100-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 + -rule in the top layer).The deep network and the relevance models are trained using stochastic gradient descent with minibatch size 20, for 300000 iterations, and using a small learning rate.
Figure 8 shows heatmaps obtained with sensitivity analysis, standard Taylor decomposition, and deep Taylor decomposition with different relevance models.We apply the z 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 z B -and z + -rule in the respective layers.

D. Experiment on ILSVRC
We now apply the fast training-free decomposition to explain decisions made by large neural networks (BVLC Reference CaffeNet [44] and GoogleNet [12]) trained on the dataset of the ImageNet large scale visual recognition challenges ILSVRC 2012 [45] and ILSVRC 2014 [46] 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 z B -rule is applied to the first convolution layer.For all higher convolution and fully-connected layers, the 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, b j ) in the denominator of z B -and z + -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 [44]) that have already been shown to achieve excellent performance on benchmarks.In both cases, our layerwise 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.

I. DERIVATIONS OF PROPAGATION RULES
In this section, we give the detailed derivations of propagation rules resulting from deep Taylor decomposition of the neural network of Section III of the paper.Each propagation rule corresponds to different choices of root point { x i } (j) .For the class of networks considered here, the relevance of neurons in the detection layer is given by where b j < 0. All rules derived in this paper are based on the search for a root in a particular search direction {v i } (j) in the input space associated to neuron j: We need to consider two cases separately: In the first case (j ∈ C 1 ), the data point itself is already the nearest root point of the function R j .Therefore, In the second case (j ∈ C 2 ), the nearest root point along the defined search direction is given by the intersection of Equation 2 with the plane equation i x i w ij + b j = 0 to which the nearest root belong.In particular, resolving t by injecting (2) into that plane equation, we get Starting from the generic relevance propagation formula proposed in Section II we can derive a more specific formula that involve the search directions {v i } (j) : From ( 5) to (6) we have considered the two listed cases separately, and injected their corresponding roots found in Equations 3 and 4. From ( 6) to (7), we have used the fact that the relevance for the case C 1 is always zero to recombine both terms.
The derivation of the various relevance propagation rules presented in this paper will always follow the same three steps: 1) Define for each neuron j ∈ C 2 a line or segment in the input space starting from data point {x i } and with direction {v i } (j) .2) Verify that the line or segment lies inside the input domain and includes at least one root of R j .3) Inject the search directions {v i } (j) into Equation 7, and obtain the relevance propagation rule as a result.An illustration of the search directions and root points selected by each rule for various relevance functions R j ({x i }) is given in Figure 1.

A. w 2 -Rule
The w 2 -rule is obtained by choosing the root of R j that is nearest to {x i } in R d .Such nearest root must be searched for on the line including the point {x i }, and with direction corresponding to the gradient of R j (the ith component of this gradient is w ij ).Therefore, the components of the search vector are given by v This line is included in the input domain R d , and always contains a root (the nearest of which is obtained by setting t = −R j / i w 2 ij in Equation 2).Injecting the defined search direction v i into Equation 7, we get

B. z-Rule
The z-rule (originally proposed by [1]) is obtained by choosing the nearest root of R j on the segment (0, {x i }).This segment is included in all domains considered in this paper (R d , R d + , B), provided that {x i } also belongs to these domains.This segment has a root at its first extremity, because R j (0) = max(0, i 0 • w ij + b j ) = max(0, b j ) = 0 since b j is negative by design.The direction of this segment on which we search for the nearest root corresponds to the data point itself: v LG] 8 Dec 2015 Fig. 1.Illustration of root points (empty circles) found for a given data point (full circle) for various propagation rules, relevance functions, and input domains.Here, for the z B -rule, we have used the bounding box Injecting this search direction into Equation 7, and defining the weighted activation z ij = x i w ij , we get

C. z + -Rule
The z + -rule is obtained by choosing the nearest root on the segment The relevance function has a root at the first extremity of the segment: and therefore x i w − ij ≤ 0, and since b j < 0 by design.The direction of this segment on which we search for the nearest root is given by: v Injecting this search direction into Equation 7, and defining z

D. z B -Rule
The z B -rule is obtained by choosing the nearest root on the segment ({l i 1 wij >0 + h i 1 wij <0 }, {x i }).Provided that {x i } is in B, the segment is also in B. The relevance function has a root at the first extremity of the segment: , because all summed terms are either negative or the product of a negative and positive value.The search direction for this choice of segment is given by v Injecting this search direction in to Equation 7, we get

II. ALGORITHMS FOR PROPAGATION RULES
We give here algorithms to implement the rules derived in Section I of the supplement.A useful property of these rules is that they can all be expressed in terms of matrix multiplications, thus, making them easily implementable with numerical libraries such as Matlab or Python/Numpy.

A. w 2 -Rule
Input: where and denote the element-wise multiplication and division respectively, and [1] is a matrix of ones.Note that for efficiency purposes, the squaring and normalization of the weight matrix can be performed once, and reused for many heatmaps computations.

B. z-Rule
Input: where and denote the element-wise multiplication and division respectively, and where the variable Z is the sum of weighted activations for each upper-layer neuron.

C. z + -Rule
Input: where and denote the element-wise multiplication and division respectively, and where the operation (•) + keeps the positive part of the input matrix.For efficiency, like for the w 2rule, the matrix V can be precomputed and reused for multiple heatmaps computations.

D. z B -Rule
Input: where and denote the element-wise multiplication and division respectively, and where the operations (•) + , (•) − keep the positive part and the negative part of the input matrix respectively.For efficiency, like for the previous rules, the matrices U and V can be precomputed and reused for multiple heatmaps computations.

III. PROOFS OF PROPOSITIONS
Definition 1.A heatmapping R(x) is conservative if the sum of assigned relevances in the pixel space corresponds to the total relevance detected by the model, that is ∀x : f (x) = p R p (x). Definition 2. A heatmapping R(x) is positive if all values forming the heatmap are greater or equal to zero, that is: ∀x, p : R p (x) ≥ 0 Definition 3. A heatmapping R(x) is consistent if it is conservative and positive.That is, it is consistent if it complies with Definitions 1 and 2.
Proposition 1.For all g ∈ G, the deep Taylor decomposition with the w 2 -rule is consistent in the sense of Definition 3.
Proof: We first show that the heatmapping is conservative: where we have assumed the weights to be never exactly zero.Then, we show that the heatmapping is positive: Therefore, because the heatmapping is both conservative and positive, it is also consistent.
For the case where i w 2 ij = 0, it implies that w ij = 0 for all i and therefore z ij = 0 for all i too.Because b j ≤ 0, then R j = x j = 0 (there is no relevance to redistribute to the lower layer).
Proposition 2. For all g ∈ G and data points {x i } ∈ R d + , the deep Taylor decomposition with the z + -rule is consistent in the sense of Definition 3.
Proof: The proof is the same as for Proposition 1 for the case where i z + ij > 0. We simply replace w 2 ij by z + ij in the proof.
For the case where i z + ij = 0, it implies that z ij ≤ 0 for all i.Because b j ≤ 0, then R j = x j = 0 (there is no relevance to redistribute to the lower layer).Proposition 3.For all g ∈ G and data points {x i } ∈ B, the deep Taylor decomposition with the z B -rule is consistent in the sense of Definition 3.
Proof: We first show that the numerator of the z B -rule q ij = z ij − l i w + ij − h i w − ij is greater or equal than zero for {x i } ∈ B: Then, the proof is the same as for Proposition 1 for the case where i q ij > 0. We simply replace w 2 ij by q ij in the proof.For the case where i q ij = 0, we will show that the contributions z ij of the inputs to the detection neurons cannot be positive, and that there is therefore no relevance that needs to be redistributed.The equality i q ij = 0 implies that ∀ i : q ij = 0, which can be satisfied by one of the four sets of conditions: a) x i = h i and x i = l i : In that case x i = 0 (because l i ≤ 0 and h i ≥ 0), and therefore z ij = 0 • w ij = 0. b) x i = h i and w + ij = 0: In that case, z ij = h i w ij , and because h i ≥ 0, then z ij ≤ 0. c) w − ij = 0 and x i = l i : In that case, z ij = l i w ij , and because l i ≤ 0, then z ij ≤ 0. d) w − ij = 0 and w + ij = 0: In that case, w ij = 0, and therefore, z ij = x i • 0 = 0.
Therefore, inputs are in all cases prevented from contributing positively to the neuron x j .In particular, the total contribution is given by z j = i z ij ≤ 0. Because b j ≤ 0, then R j = x j = 0 (there is no relevance to redistribute to the lower layer).

IV. EMPIRICAL COMPARISON WITH LRP
In this section, we compare heatmaps produced by the rules based on deep Taylor decomposition, and the layer-wise relevance propagation (LRP) rules proposed by [1].The last rules include in particular, the αβ-rule: where α − β = 1, and the -stabilized rule: where s(t) = t+ (1 t≥0 −1 t<0 ) is a stabilizing function whose output is never zero.The respective hyperparameters α and of these rules are typically selected such that the produced heatmaps have the desired quality.Figure 2 and 3 compare heatmaps obtained by applying deep Taylor and LRP to the one-layer and two-layer networks considered in this paper for the MNIST problem.In the twolayer case, deep Taylor uses the min-max relevance model.LRP applies the same rules in both layers.It can be observed that the quality of the deep Taylor heatmaps is less influenced by the choice of model and dataset than LRP with a fixed set of parameters.Deep Taylor heatmaps look similar in all cases.LRP also produces high-quality heatmaps, but the best parameters differ in each setting.For example, the parameters α = 2, β = 1 perform well for the CaffeNet, but tend to produce too sparse heatmaps for the GoogleNet, or to produce a large amount of negative relevance on the MNIST dataset.Various parameters of LRP produce various artefacts such as the presence of residual relevance on the irrelevant MNIST digit, or the presence of negative relevance in the black areas of the MNIST images.On the other hand, LRP-based heatmaps are sharper than Taylor-based heatmaps and less subject to the stride artefact that arises with convolutional neural networks.They also tend to assign very little evidence to irrelevant parts of the image.Future work will seek to identify the reason for the superiority of LRP on these particular aspects, and investigate whether the deep Taylor decomposition method and its underlying principles can be refined to incorporate these desirable properties of a heatmap while retaining its stability.

Figure 2 Fig. 2 .
Figure2illustrates the construction of a heatmap in a cartoon example, where a hypothetical function f detects the presence of an object of class "building" in an image x.In this example,

Fig. 3 .
Fig. 3. Graphical depiction of the computational flow of deep Taylor decomposition.A score f (x) indicating the presence of the class "cat" is obtained by forward-propagation of the pixel values {xp} into a neural network.The function value is encoded by the output neuron x f .The output neuron is assigned relevance R f = x f .Relevances are backpropagated from the top layer down to the input, where {Rp} denotes the relevance scores of all pixels.The last neuron of the lowest hidden layer is perceived as relevant by higher layers and redistributes its assigned relevance onto the pixels.Other neurons of the same layer are perceived as less relevant and do not significantly contribute to the heatmap.
Fig. 4.Detection-pooling network that implements Equations 5 and 6: The first layer detects features in the input space, the second layer pools the detected features into an output score.

Fig. 7 .
Fig. 7. Left: Example of a 3-layer deep network, composed of increasingly high-level feature extractors.Right: Diagram of the two proposed relevance models for redistributing relevance onto lower layers.
Figure 4 compares heatmaps obtained by deep Taylor and LRP on the BVLC Caf-feNet and the GoogleNet.For deep Taylor, we use the trainingfree relevance model.Normalization layers are ignored in the backward pass.

Fig. 4 .
Fig. 4. Heatmaps produced by deep Taylor decomposition and LRP when applied to the predictions of the CaffeNet and GoogleNet networks.