Unmasking Clever Hans Predictors and Assessing What Machines Really Learn
Sebastian Lapuschkin Stephan Wäldchen Alexander Binder Grégoire Montavon Wojciech Samek Klaus-Robert Müller
 
[
    Endre Süli
    December 30, 2023
=====================




Current learning machines have successfully solved hard application problems, reaching high accuracy and displaying seemingly “intelligent” behavior. Here we apply recent techniques for explaining decisions of state-of-the-art learning machines and analyze various tasks from computer vision and arcade games. This showcases a spectrum of problem-solving behaviors ranging from naive and short-sighted, to well-informed and strategic. We observe that standard performance evaluation metrics can be oblivious to distinguishing these diverse problem solving behaviors. Furthermore, we propose our semi-automated Spectral Relevance Analysis that provides a practically effective way of characterizing and validating the behavior of nonlinear learning machines. This helps to assess whether a learned model indeed delivers reliably for the problem that it was conceived for. Furthermore, our work intends to add a voice of caution to the ongoing excitement about machine intelligence and pledges to evaluate and judge some of these recent successes in a more nuanced manner.





§ INTRODUCTION

Artificial intelligence systems, based on machine learning, are increasingly assisting our daily life. They enable industry and the sciences to convert a never ending stream of data – which per se is not informative – into information that may be helpful and actionable. Machine learning has become a basis of many services and products that we use.

While it is broadly accepted that the nonlinear machine learning (ML) methods being used as predictors to maximize some prediction accuracy, are effectively (with few exceptions such as shallow decision trees) black boxes; this intransparency regarding explanation and reasoning is preventing a wider usage of nonlinear prediction methods in the sciences (see Figure <ref>a why understanding nonlinear learning machines is difficult). Due to this black-box character, a scientist may not be able to extract deep insights about what the nonlinear system has learned, despite the urge to unveil the underlying natural structures. In particular, the conclusion in many scientific fields has so far been to prefer linear models <cit.> in order to rather gain insight (e.g. regression coefficients and correlations) even if this comes at the expense of predictivity.



Recently, impressive applications of machine learning in the context of complex games (Atari games <cit.>, Go <cit.>, Texas hold'em poker <cit.>) have led to speculations about the advent of machine learning systems embodying true “intelligence”. In this note we would like to argue that for validating and assessing machine behavior, independent of the application domain (sciences, games etc.), we need to go beyond predictive performance measures such as the
test set error towards understanding the AI system.

When assessing machine behavior, the general task solving ability must be evaluated (e.g. by measuring the classification accuracy, or the total reward of a reinforcement learning system). At the same time it is important to comprehend the decision making process itself. In other words, transparency of the what and why in a decision of a nonlinear machine becomes very effective for the essential task of judging whether the learned strategy is valid and generalizable or whether the model has based its decision on a spurious correlation in the training data (see Figure <ref>a). In psychology the reliance on such spurious correlations is typically referred to as the Clever Hans phenomenon <cit.>. A model implementing a `Clever Hans' type decision strategy will likely fail to provide correct classification and thereby usefulness once it is deployed in the real world, where spurious or artifactual correlations may not be present.

While feature selection has traditionally explained the model by identifying features relevant for the whole ensemble of training data <cit.> or some class prototype <cit.>, it is often necessary, especially for nonlinear models, to focus the explanation on the predictions of individual examples (see Figure <ref>b). A recent series of work <cit.> has now begun to explain the predictions of nonlinear machine learning methods in a wide set of complex real-world problems (e.g. <cit.>).
Individual explanations can take a variety of forms: An ideal (and so far not available) comprehensive explanation would extract the whole causal chain from input to output. In most works, reduced forms of explanation are considered, typically, collection of scores indicating the importance of each input pixel/feature for the prediction (note that computing an explanation does not require to understand neurons individually). These scores can be rendered as visual heatmaps (relevance maps) that can be interpreted by the user.

In the following we make use of this recent body of work, in particular, the layer-wise relevance propagation (LRP) method <cit.> (cf. Section <ref>), and discuss qualitatively and quantitatively, for showcase scenarios, the effectiveness of explaining decisions for judging whether learning machines exhibit valid and useful problem solving abilities. Explaining decisions provides an easily interpretable and computationally efficient way of assessing the classification behavior from few examples (cf. Figure <ref>a). It can be used as a complement or practical alternative to a more comprehensive Turing test <cit.> or other theoretical measures of machine intelligence <cit.>. In addition, the present work contributes by further embedding these explanation methods into our framework SpRAy (spectral relevance analysis) that we present in Section <ref>. SpRAy, on the basis of heatmaps, identifies in a semi-automated manner a wide spectrum of learned decision behaviors and thus helps to detect the unexpected or undesirable ones. This allows one to systematically investigate the classifier behavior on whole large-scale datasets — an analysis which would otherwise be practically unfeasible with the human tightly in the loop. Our semi-automated decision anomaly detector thus addresses the last mile of explanation by providing an end-to-end method to evaluate ML models beyond test set accuracy or reward metrics.








§ RESULTS



 §.§ Identifying valid and invalid problem-solving behaviors

In this section we will investigate several showcases that demonstrate the effectiveness of explanation methods like LRP and SpRAy for understanding and validating the behavior of a learned model.

First, we provide an example where the learning machine exploits an unexpected spurious correlation in the data to exhibit what humans would refer to as “cheating”. The first learning machine is a model based on Fisher vectors (FV) <cit.> trained on the PASCAL VOC 2007  image dataset <cit.> (see Section <ref>). The model and also its competitor, a pretrained Deep Neural Network (DNN) that we fine-tune on PASCAL VOC, show both excellent state-of-the-art test set accuracy on categories such as `person', `train', `car', or `horse' of this benchmark (see Table <ref>). Inspecting the basis of the decisions with LRP, however, reveals for certain images substantial divergence, as the heatmaps exhibiting the reasons for the respective classification could not be more different. Clearly, the DNN's heatmap points at the horse and rider as the most relevant features (see Figure <ref>). In contrast, FV's heatmap is most focused onto the lower left corner of the image, which contains a source tag. A closer inspection of the data set (of 9963 samples <cit.>) that typically humans never look through exhaustively, shows that such source tags appear distinctively on horse images; a striking artifact of the dataset that so far had gone unnoticed <cit.>. Therefore, the FV model has `overfitted' the PASCAL VOC dataset by relying mainly on the easily identifiable source tag, which incidentally correlates with the true features, a clear case of `Clever Hans' behavior. This is confirmed by observing that artificially cutting the source tag from horse images significantly weakens the FV model's decision while the decision of the DNN stays virtually unchanged (see Figure <ref>). If we take instead a correctly classified image of a Ferrari and then add to it a source tag, we observe that the FV's prediction swiftly changes from `car' to `horse' (cf. Figure <ref>a) a clearly invalid decision (see Section <ref> and Figures <ref>-<ref>  for further examples and analyses).

The second showcase example studies neural network models (see Figure <ref> for the network architecture) trained to play Atari games, here Pinball. As shown in <cit.>, the DNN achieves excellent results beyond human performance. Like for the previous example, we construct LRP heatmaps to visualize the DNN's decision behavior in terms of pixels of the pinball game. Interestingly, after extensive training, the heatmaps become focused on few pixels representing high-scoring switches and loose track of the flippers. A subsequent inspection of the games in which these particular LRP heatmaps occur, reveals that DNN agent firstly moves the ball into the vicinity of a high-scoring switch without using the flippers at all, then, secondly, “nudges” the virtual pinball table such that the ball infinitely triggers the switch by passing over it back and forth, without causing a tilt of the pinball table (see Figure <ref>b and Figure <ref> for the heatmaps showing this point, and also Supplementary Video 1). Here, the model has learned to abuse the “nudging” threshold implemented through the tilting mechanism in the Atari Pinball software. From a pure game scoring perspective, it is indeed a rational choice to exploit any game mechanism that is available. In a real pinball game, however, the player would go likely bust since the pinball machinery is programmed to tilt after a few strong movements of the whole physical machine.

The above cases exemplify our point, that even though test set error may be very low (or game scores very high), the reason for it may be due to what humans would consider as cheating rather than valid problem-solving behavior. It may not correspond to true performance when the latter is measured in a real-world environment, or when other criteria (e.g. social norms which penalize such behavior <cit.>) are incorporated into the evaluation metric. Therefore, explanations computed by LRP have been instrumental in identifying this fine difference.

Let us consider a third example where we can beautifully observe learning of strategic behavior: A Deep Neural Network playing the Atari game of Breakout <cit.> (see Table <ref> for the investigated network architectures). We analyze the learning progress and inspect the heatmaps of a sequence of DNN models in Figure <ref>c. The heatmaps reveal conspicuous structural changes during the learning process. In the first learning phase the DNN focuses on ball control, the handle becomes salient as it learns to target the ball and in the final learning phase the DNN focuses on the corners of the playing field (see Figure <ref>c). At this stage, the machine has learned to dig tunnels at the corners (also observed in <cit.>) – a very efficient strategy also used by human players. Detailed analyses using the heatmap as a function of a single game and comparison of LRP to sensitivity analysis explanations, can be found in the Figures <ref>-<ref> and in the Supplementary Video 2. Here, this objectively measurable advancement clearly indicates the unfolding of strategic behavior.

Overall, while in each scenario, reward maximization as well as incorporating a certain degree of prior knowledge has done the essential part of inducing complex behavior, our analysis has made explicit that (1) some of these behaviors incorporate strategy, (2) some of these behaviors may be human-like or not human-like, and (3) in some case, the behaviors could even be considered as deficient and not acceptable, when considering how they will perform once deployed. Specifically, the FV-based image classifier is likely to not detect horses on the real-world data; and the Atari Pinball AI might perform well for some time, until the game is updated to prevent excessive nudging.

All insights about the classifier behavior obtained up to this point of this study require the analysis of individual heatmaps by human experts, a laborious and costly process which does not scale well.



 §.§ Whole-dataset analysis of classification behavior

Our next experiment uses SpRAy to comprehend the predicting behavior of the classifier on large datasets in a semi-automated manner. Figure <ref>a displays the results of the SpRAy analysis when applied to the horse images of the PASCAL VOC dataset (see also Figures <ref> and <ref>). Four different strategies can be identified for classifying images as “horse”: 1) detect a horse and rider (Figure <ref>b), 2) detect a source tag in portrait oriented images (Figure <ref>c), 3) detect wooden hurdles and other contextual elements of horseback riding (Figure <ref>d), and 4) detect a source tag in landscape oriented images (Figure <ref>e). Thus, without any human interaction, SpRAy provides a summary of what strategies the classifier is actually implementing to classify horse images. An overview of the FV and DNN strategies for the other classes and for the Atari Pinball and Breakout game can be found in Figures <ref>-<ref> and <ref>-<ref>, respectively.

The SpRAy analysis could furthermore reveal another `Clever Hans' type behavior in our fine-tuned DNN model, which had gone unnoticed in previous manual analysis of the relevance maps. The large eigengaps in the eigenvalue spectrum of the DNN heatmaps for class “aeroplane” indicate that the model uses very distinct strategies for classifying aeroplane images (see Figure <ref>). A t-SNE visualization (Figure <ref>) further highlights this cluster structure. One unexpected strategy we could discover with the help of SpRAy is to identify aeroplane images by looking at the artificial padding pattern at the image borders, which for aeroplane images predominantly consists of uniform and structureless blue background. Note that padding is typically introduced for technical reasons (the DNN model only accepts square shaped inputs), but unexpectedly (and unwantedly) the padding pattern became part of the model's strategy to classify aeroplane images. Subsequently we observe that changing the manner in which padding is performed has a strong effect on the output of the DNN classifier (see Figures <ref>-<ref>).

We note that while recent methods (e.g. <cit.>) have characterized whole-dataset classification behavior based on decision similarity (e.g. cross-validation based AP scores or recall), the SpRAy method can pinpoint divergent classifier behavior even when the predictions look the same. The specificity of SpRAy over previous approaches is thus its ability to ground predictions to input features, where classification behavior can be more finely characterized. A comparison of both approaches is given in Section <ref> and Supplementary Figures <ref> and <ref>.
 




§ DISCUSSION

Although learning machines have become increasingly successful, they often behave very differently from humans <cit.>. Commonly discussed ingredients to make learning machines act more human-like are e.g. compositionality, causality, learning to learn <cit.>, and also an efficient usage of prior knowledge or invariance structure (see e.g. <cit.>). Our work adds a dimension that has so far not been a major focus of the machine intelligence discourse, but that is instrumental in verifying the correct behavior of these models, namely explaining the decision making.  We showcase the behavior of learning machines for two application fields: computer vision and arcade gaming (Atari), where we explain the strategies embodied by the respective learning machines. We find a surprisingly rich spectrum of behaviors ranging from strategic decision making (Atari Breakout) to `Clever Hans' strategies or undesired behaviors, here, exploiting a dataset artifact (tags in horse images), a game loophole (nudging in Atari Pinball), and a training artifact (image padding). These different behaviors go unnoticed by common evaluation metrics, which puts a question mark to the current broad and sometimes rather unreflected usage of machine learning in all application domains in industry and in the sciences.

With the SpRAy method we have proposed a tool to systematize the investigation of classifier behavior and identify the broad spectrum of prediction strategies. The SpRAy analysis is scalable and can be applied to large datasets in a semi-automated manner. We have demonstrated that SpRAy easily finds the misuse of the source tag in horse images, moreover and unexpectedly, it has also pointed us at a padding artifact appearing in the final fine-tuning phase of the DNN training. This artifact resisted a manual inspection of heatmaps of all 20 PASCAL VOC classes, and was only later revealed by our SpRAy analysis. This demonstrates the power of an automated, large-scale model analysis. We believe that such analysis is a first step towards confirming important desiderata of AI systems such as trustworthiness, fairness and accountability in the future, e.g. in context of regulations concerning models and methods of artificial intelligence, as via the General Data Protection Regulation (GDPR) <cit.>. Our contribution may also add a further perspective that could in the future enrich the ongoing discussion, whether machines are truly “intelligent”.

Finally, in this paper we posit that the ability to explain decisions made by learning machines allows us to judge and gain a deeper understanding of whether or not the machine is embodying a particular strategic decision making. Without this understanding we can merely monitor behavior and apply performance measures without possibility to reason deeper about the underlying learned representation. The insights obtained in this pursuit may be highly useful when striving for better learning machines and insights (e.g. <cit.>) when applying machine learning in the sciences.




§ METHODS






 §.§ Layer-wise relevance propagation


Layer-wise relevance propagation (LRP) <cit.> is a method for explaining the predictions of a broad class of ML models, including state-of-the-art neural networks and kernel machines. It has been extensively applied and validated on numerous applications <cit.>. The LRP method decomposes the output of the nonlinear decision function in terms of the input variables, forming a vector of input features scores that constitutes our `explanation'. Denoting = (x_1,…,x_d) an input vector and f() the prediction at the output of the network, LRP produces a decomposition = (R_1,…,R_d) of that prediction on the input variables satisfying

    ∑_p=1^d R_p = f().


Unlike sensitivity analysis methods <cit.>, LRP explains the output of the function rather than its local variation <cit.> (see Section <ref> for more information on explanation methods). 

The LRP method is based on a backward propagation mechanism applying uniformly to all neurons in the network: Let a_j = ρ(∑_i a_i w_ij + b_j) be one such neuron. Let i and j denote the neuron indices at consecutive layers, and ∑_i,∑_j the summation over all neurons in these respective layers. The propagation mechanism of LRP is defined as

    R_i = ∑_j z_ij/∑_i z_ij R_j.

where z_ij is the contribution of neuron i to the activation a_j, and typically depends on the activation a_i and the weight w_ij. The propagation rule is applied in a backward pass starting from the neural network output f() until the input variables (e.g. pixels) are reached. Resulting scores can be visualized as a heatmap of same dimensions as the input (see Figure <ref>).

LRP can be embedded in the theoretical framework of deep Taylor decomposition <cit.>, where some of the propagation rules can be seen as particular instances. Note that LRP rules have also been designed for models other than neural networks, in particular, Bag of Words classifiers, Fisher vector models, and LSTMs (more information can be found in the Section <ref> and  Table <ref>).




 §.§ Spectral relevance analysis


Explanation techniques enable inspection of the decision process on a single instance basis. However, screening through a large number of individual explanations can be time consuming. To efficiently investigate classifier behavior on large datasets, we propose a technique: Spectral Relevance Analysis (SpRAy). SpRAy applies spectral clustering <cit.> on a dataset of LRP explanations in order to identify typical as well as atypical decision behaviors of the machine learning model, and presents them to the user in a concise and interpretable manner.
 
Technically, SpRAy allows one to detect prediction strategies as identifiable on frequently reoccurring patterns in the heatmaps, e.g., specific image features. The identified features may be truly meaningful representatives of the object class of interest, or they may be co-occurring features learned by the model but not intended to be part of the class, and ultimately of the model's decision process. Since SpRAy can be efficiently applied to a whole large-scale dataset, it helps to obtain a more complete picture of the classifier behavior and reveal unexpected or `Clever Hans' type decision making.

The SpRAy analysis is depicted in Figure <ref> (see also Section <ref>) and consists of four steps: 
Step 1: Computation of the relevance maps for the samples of interest. The relevance maps are computed with LRP and contain information about where the classifier is focusing on when classifying the images. 
Step 2: Downsizing of the relevance maps and make them uniform in shape and size. This reduction of dimensionality accelerates the subsequent analysis, and also makes it statistically more tractable.
Step 3: Spectral cluster analysis (SC) on the relevance maps. This step finds structure in the distribution of relevance maps, more specifically it groups classifier behaviors into finitely many clusters (see Figure <ref> for an example).
Step 4: Identification of interesting clusters by eigengap analysis. The eigenvalue spectrum of SC encodes information about the cluster structure of the relevance maps. A strong increase in the difference between two successive eigenvalues (eigengap) indicates well-separated clusters, including atypical classification strategies. The few detected clusters are then presented to the user for inspection.
Step 5 (Optional): Visualization by t-Stochastic Neighborhood Embedding (t-SNE). This last step is not part of the analysis strictly speaking, but we use it in the paper in order to visualize how SpRAy works.

Since SpRAy aims to investigate classifier behavior, it is applied to the heatmaps and not to the raw images (see Figures <ref>, <ref> and <ref> for comparison).



 §.§ Code availability

Source code for LRP and sensitivity analysis is available at <https://github.com/sebastian-lapuschkin/lrp_toolbox>.
Source code for Spectral Clustering and t-SNE as used in the SpRAy method is available from the scikit-learn at <https://github.com/scikit-learn/scikit-learn>.
Source code for the Reinforcement-Learning-based Atari Agent is available at <https://github.com/spragunr/deep_q_rl>.
Source code for the Fisher Vector classifier is available at <http://www.robots.ox.ac.uk/ vgg/software/enceval_toolkit>.

Our fine-tuned DNN model can be found at
 
<https://github.com/BVLC/caffe/wiki/Model-Zoo#pascal-voc-2012-multilabel-classification-model>.



 §.§ Data availability
 The datasets used and analyzed during the current study are available from the following sources.
 
PASCAL VOC 2007: <http://host.robots.ox.ac.uk/pascal/VOC/voc2007/#devkit>.
 
PASCAL VOC 2012: <http://host.robots.ox.ac.uk/pascal/VOC/voc2012/#devkit>.
 
Atari emulator: <https://github.com/mgbellemare/Arcade-Learning-Environment>.



§ APPENDIX



§ INTRODUCTION

AI systems are able to solve an increasing number of complex tasks. They occasionally exceed human performance spectacularly in tasks as diverse as face recognition<cit.>, traffic sign classification <cit.>, reading subway plans <cit.>, understanding quantum many-body systems <cit.> or playing games such as Atari 2600 games <cit.>, Go <cit.>, Texas hold'em poker <cit.> or Super Smash Bros. <cit.>. 
This impressive progress is largely owed to recent advances in deep learning, i.e., a class of end-to-end trainable, brain-inspired models with multiple (deep) layers of unfolding representations. Not surprisingly, these high-performance methods have quickly found their way out of research labs and are attracting much attention in the industry and the media. 
While these algorithms seem to clearly exhibit outstanding performance in the respective tasks, there is an ongoing debate on “intelligence” in AI systems in general <cit.>, how to measure it and what could be the limits thereof. Amongst others this discussion aims to elucidate the defining ingredients for truly human-like learning such as compositionality, representation and how to include prior knowledge about the world <cit.>. With this work we would like to add interpretability to this discussion as it is instrumental in judging and validating the behavior of these systems.

Let us first briefly roll out aspects of the current discussion. The authors of <cit.> analyze key aspects of human-like learning. 
A major difference between machine and human learning is that humans (even infants) are equipped with a “start-up” software <cit.> consisting of a priori representation about objects and physics <cit.> and about other agents <cit.>. This enables them to quickly learn to interact with the environment, to reason about future world states (e.g, position of objects in space) and to understand other people's goals, beliefs and strategies. Since such priors or also the knowledge about invariances <cit.> are usually not available to a machine unless coded (see e.g. <cit.>), learning them takes significantly longer, requires orders of magnitude more examples and the learned concepts are less transferable to other tasks. 
Recently, Lake et al. <cit.> proposed a learning machine that implements some of the human learning abilities and is able to learn new concepts from just a single example. The model brings together three important learning principles which have been intensively studied in cognitive science <cit.> and are regarded as indispensable ingredients of human learning. These principles are (1) compositionality, i.e., the ability to build rich concepts from simpler primitives, (2) causality, i.e., the ability to model and infer the causal structure of the world, and (3) learning to learn, i.e., the ability to develop hierarchical priors which simplify learning new concepts from previous experience. Lake et al. <cit.> incorporated these principles into a Bayesian program learning framework and showed on a restricted problem set, e.g., one-shot classification of handwritten characters, that their model achieves human-level performance and outperforms recent deep learning algorithms. Future generations of neural networks incorporating above principles may be able to approach human learning even in more realistic scenarios.

A further important aspect of human intelligence termed computational rationality was discussed in <cit.>. Humans are adapted to interact with a dynamically changing, partially unknown and uncertain environment and thus are able to identify decisions with high expected utility while taking trade-offs in effort, precision, and timeliness of computations. Finding appropriate trade-offs and optimally allocating scarce resources is a difficult task which requires intelligence on a “meta-level”. 
Recently, researchers started to bring these aspects to deep learning by incorporating mechanism such as attention <cit.> or memory <cit.> into neural network models. Future AI systems that aim to interact with the real-world to a greater extent, may possibly have to fully implement computational rationality in order to be able to make meta-level decisions to better and more efficiently regulate base-level inferences.

A crucial aspect of human behavior, and the main focus of this paper, is the ability to explain <cit.>. It facilitates practical learning, e.g., in a student-teacher context, by not only providing the solution to a problem but also the description of how to solve the problem, what features to rely on etc. Furthermore, explanations have an important social role, because they enable to comprehend and rationalize other individuals' decisions, they also help establishing trust (e.g., doctor explains therapy to patient) and they are indispensable when the correctness of a decision needs to be verified. 
Until recently, deep neural networks and other complex, non-linear learning machines have been mainly used in a black-box manner, providing little information on what aspect of the input data supports the actual prediction for a single sample. This black-box behavior can amount to a major disadvantage and prevent the application of state-of-the-art AI technology in critical application domains. For instance, in medical diagnosis the ability to verify a decision made by an AI system is crucial for a medical professional as a wrong decision can cause threats to human life <cit.>. Additionally, black-box systems are of limited value in the sciences, where it is crucial to ensure that the learned model is biologically, chemically or physically plausible or ideally contributes to a better understanding of the scientific problem <cit.>. In practice, if the learning machine is interpretable, we can visualize what it has learned, how it arrives at its conclusions and whether its task-solving strategy is meaningful, sensible and comprehensible from a human point of view. Also it can help confirming other important desiderata of AI systems such as fairness or accountability <cit.>. 

We will demonstrate in this work that state-of-the-art AI systems exhibit unexpected and to human standards not necessarily meaningful problem solution strategies. In particular, we would like to argue that this undesired behavior often goes unnoticed if AI models are not interpreted. Therefore, we will introduce in Section <ref> recent techniques which allow to explain individual predictions of black-box AI models. Then, these techniques will be showcased in Section <ref> and <ref>, by performing a detailed analysis of the behavior of Atari agents and image classifiers. Finally, we contribute in Section <ref> a novel procedure for identifying erratic behavior of these systems in a semi-automated manner. Overall, our results demonstrate that interpretability provides a very effective way of assessing the validity and dependability of AI systems and we are convinced that it will also help us design more human-like AI systems in the future.




§ BACKGROUND

We will now specifically focus on deep convolutional networks<cit.>, which incorporate the principles of hierarchy and shift-invariance. They have scored commanding successes in the venues of strategic games <cit.>, image classification <cit.>, face <cit.> recognition, speech recognition <cit.> and e.g. physics <cit.>. In the following we briefly introduce how neural networks work and how they can be combined with reinforcement learning to play arcade games.



  
Neural Networks
Neural networks are a highly nonlinear, modular and hierarchical approach to learning<cit.>. The advent of GPU accelerated training <cit.> and the availability of performant deep learning frameworks <cit.>, as well as large datasets <cit.> lead to unprecedented accuracy in a variety of tasks<cit.>. Neural networks are composed of multiple layers, each consisting of a linear and a non-linear transformation,

    x^(l+1)_j = g∑_j w^(l)_j,kx^(l)_k + b^(l)_j,

where g is a non-linear function, e.g. sigmoid function, hyperbolic tangent or a rectifier function<cit.>. The universal approximation theorem ensures that any continuous function on a compact interval of ℝ^n can be approximated by a neural network to an arbitrary precision<cit.>.

Although only one hidden layer is strictly necessary, having a deeper structure allows this approximation to be more efficient in the number of neurons required <cit.>. State-of-the-art deep neural networks achieve astounding results with many hidden layers, some numbering eight <cit.>, twenty-two <cit.> or even more than one hundred <cit.> layers. The deep structure allows the networks to operate on conceptual levels with each layer processing more complex features (e.g. edges → corners → rectangles → boxes → cars) mirroring abstraction levels similar to the human brain <cit.>. It can be shown that from layer to layer, networks compress information and enhance the signal-to-noise ratio (see <cit.>).

There are three major learning paradigms for DNN's, each corresponding to a particular abstract learning task, i.e. supervised learning, unsupervised learning and reinforcement learning. In this work we focus on supervised and reinforcement learning to train the agents and evaluate their decisions for a better understanding.



  
Supervised Learning
In supervised learning the goal is to infer a function f from a labeled training dataset consisting of the samples x_i and their label y_i. If the labels only take discrete values, then we refer to the learning problem as classification problem, otherwise it is called a regression problem. Often f belongs to a parameterized class of functions, e.g., neural networks with a particular architecture, then the learning task reduces to finding the “optimal” parameters (w.r.t. a specific loss). In practice, algorithms such as stochastic gradient descent <cit.> and variants of it such as Adam <cit.> are used for this optimization. After training we can use function f to estimate the predictions for unseen samples (i.e., testing phase) in order to approximate its generalization ability. In Section <ref> we will analyze and compare the generalization performance and task-solving strategy of two powerful systems for image categorization — a typical supervised learning task.



  
Reinforcement Learning
In a typical reinforcement learning setting, an agent is trained without explicitly labelled data, via interaction with the environment only. At each time step t of the training process, the agent to be trained performs a preferred action a_t based on a state s_t and receives a reward r_t with the goal to maximize the long term reward ∑_t r_t by adapting the model parameters determining which action is to be chosen given an input.

Recently, a convolutional neural network was trained to play simple Atari video games with visual input on a human-like level<cit.>. Using Q-learning <cit.>, a model-free reinforcement learning technique, a network has been trained to fit an action-value function. The Q-learning setup consists of three elements:

 
  * the Arcade Learning Environment <cit.> that takes an action as input, advances the game and returns a visual representation of the game and a game score,
 
  * the Neural Network that predicts a long-term reward, the so-called Q-function Q(s,a;θ), for a game visual for every possible action a, and, lastly,
 
  * the Replay Memory that saves observed game transitions during the training as tuples , from now on (s_t, a_t, r_t, s_t+1).


To update the network, Mnih et al. <cit.> make use of the fact that the optimal Q-function, Q^* must obey the Bellman equation<cit.>

    Q^*(s_t,a_t) = 𝔼_s_t+1r_t + γmax_a_t+1 Q^*(s_t+1,a_t+1)  | s_t,a_t,

which can be used to train the network by choosing the cost function as the squared violation of the Bellman equation. The expectation value is approximated by the sum over a batch of game transitions B drawn uniformly at random from the replay memory.

    C(θ) = ∑_s,a,r,s'∈ BQ(s,a;θ) - r + γmax_a' Q(s',a';θ)^2.

The agent is trained by alternating three steps. First, it explores its environment using the actions that promise the highest long-term reward according to its own estimations. Second, it records the observations it encounters and saves the game transitions in the replay memory, potentially replacing older transitions. Third, one trains the network to predict the long-term reward by drawing batches from the replay memory and updating the cost functional.

The interplay of environment, network and memory is a convoluted process where convergence is not guaranteed <cit.>. Methods to explain the network decisions can be used to chart the development of the neural agent even at stages where it is not yet able to successfully interact with the environment. As we will see later, this will be useful to correct the network architecture early on.




§ UNDERSTANDING AI SYSTEMS


Nonlinear learning methods such as neural networks are often (but falsely) considered as black boxes. 
One approach to assess the quality of these learning machines is to observe the model's behavior on an independent test dataset and from that draw conclusions about it's problem solving strategies. Although theoretically valid, this approach may be very cumbersome or even practically impossible for AI systems, because evaluating the responses of the system to all possible variations of the input requires huge amount of testing (curse of dimensionality). In practice test datasets are often small and not representative. More advanced approaches exist for measuring or defining the capabilities of AI systems (e.g., <cit.>), however, these tests rather focus on assessing the system's performance in solving various tasks than on understanding the decision process (in particular the single decision) itself.

In this work we argue that to fully understand the quality of a learning machine, its intrinsic nonlinear decision making process needs to be made accessible to human judgment. 
Understanding the basis of decisions is desirable for many reasons:


  (1) In cases where we know what the decision should be based on, we can judge the soundness (according to human standards) of the decision process. 

  (2) If we do not know what the decision should be based on but we can trust the system, we may infer new domain knowledge. For example, Vidovic et al. <cit.> use an accomplished SVM classifier that predicts protein splice sites from large gene sequences to also explain which base pair motifs in genes were decisive for the classification. This can potentially increase our understanding or at least narrow down interesting domains for further, more informed, research. 

  (3) Even if we can not make sense of the explanations, e.g., because we are not domain experts, it is still possible to use this extra information for detection of erratic behavior of the AI system (see Section <ref>). We provide an example of such erratic behavior in Section <ref>, where we train a Fisher vector classifier which unintentionally bases its decision on a spurious correlation. For images showing horses, the model has learned to dominantly decide based on the presence of a copyright watermark on one of the corners of the images. Of course, in the world portrayed by an artifactual dataset it is completely valid to assume that horses are connected to the existence of a source tag. But from human perspective this is the Clever Hans phenomenon <cit.> well known in comparative psychology, i.e., the system uses a spurious correlation[The Orlov Trotter horse claimed to perform arithmetic and other intellectual tasks, but actually was watching the reactions of his trainer.] to solve the problem without understanding the problem. It is obvious that the learning system in our case does not truly understand the concept of a horse.


There is also an interesting phenomenon described in the literature, the AI effect <cit.>, saying that everytime an AI system solves a problem which has been regarded as an intelligence task, e.g., playing checkers or chess, it is is not regarded as being “intelligent” after some time, but solving the problem is regarded as rather computation. Thus AI systems (e.g., alphaGo <cit.>, DeepStack <cit.> or subway plan reading system <cit.>) which are regarded intelligent today, may be not regarded as intelligent anymore in the near future.




 §.§ Explaining Classification Decisions

In the context of image recognition, classification decisions can be explained by tracing the model decision down to the input pixels. The resulting explanation takes the form of an image of the same format as the input image, for which the content provides visualizable feedback on the classification decision of the learned model (see e.g. <cit.>). In particular, it will reveal which part of the image is important for classification, and more precisely, which pattern in the image causes the neural network to decide.

The first approaches to extract interpretable visual patterns from a classifier's decision were based on Sensitivity Analysis <cit.>. These methods rely on the gradient of the decision function and  identify input variables (e.g., pixels) which maximally strengthen or weaken the classifier decision signal when changed. Strictly speaking these methods do not explain the prediction (“what made the classifier arrive at it's decision”), but analyze the local variation of the classification function (see <cit.> for more discussion). Other more recent techniques <cit.> extract visual patterns associated to the decision of deep convolutional neural networks by using different heuristic criteria (e.g., occlusion, perturbation, sampling or deconvolution). A principled analysis technique for explaining decisions of complex models such as deep neural networks or bag-of-words-type classifiers has emerged with Layer-wise Relevance Propagation (LRP) <cit.>. We will describe this technique below and use it throughout the experiments of this paper. A theoretical foundation of LRP, called deep Taylor decomposition, can be found in <cit.>. Explanation methods were successfully applied to a wide set of complex real-world problems such as the analysis of faces <cit.>, EEG and fMRI data <cit.>, human gait <cit.>, videos <cit.>, speech <cit.>, reinforcement learning <cit.>, biological data <cit.>, text <cit.>, or comparing human and algorithm behavior in the context of visual question answering <cit.>. 




 §.§ Pixel-Wise Decompositions

A natural way of explaining a classifier's decision is to decompose its output as a sum of pixel-wise scores representing the relevance of each pixel for the decision. More precisely, denoting by R_f the output of the neural network, and R_p the relevance of pixel p, one requires that the following conservation property holds

    ∑_p R_p = R_f,

where the sum runs over all pixels in the image. Several methods, including LRP, perform such decomposition <cit.>. An advantage of the decomposition framework is versatility: If needed, one can directly recompute the analysis at a coarser level by aggregating relevance scores according to a partition of the pixel space <cit.>. For example, denoting by 𝒫 a particular region of the image (e.g. its center), we can compute the total relevance for that region as

    R_𝒫 = ∑_p ∈𝒫 R_p.

while still satisfying the coarser conservation property when summing over all regions of the partition: ∑_𝒫 R_𝒫 = R_f. This aggregation property is useful in our study to be able to produce height-aggregated heatmaps, that we can plot as a function of time, thus, allowing to monitor the evolution of the agent attention for the considered Atari games. The aggregation property is also used implicitly to sum relevance over the RGB channels of the pixels, and thus produce a single score per pixel.

Decomposition methods can be subdivided in three categories: (1) structure approaches, where the function itself has the particular summation structure, and where individual pixel-wise contributions can be identified as the summands of the function <cit.>, (2) analytic approaches, where a local analysis of the function is performed, and where pixel-wise contributions can be identified as linear terms of some local function expansion <cit.>, (3) propagation approaches <cit.>, where the model is assumed to describe a directed computational graph, where the output score is propagated through the network under local conservation constraints until the pixels are reached.




 §.§ Layer-Wise Relevance Propagation


We present here the Layer-wise Relevance Propagation (LRP) approach proposed by <cit.> for obtaining a pixel-wise decomposition of the model decision and use this technique throughout all experiments of the paper. LRP uses a propagation approach and is general enough to apply to most of the state-of-the-art architectures for image classification or neural reinforcement learning, including in particular AlexNet <cit.>, or Atari-based neural networks <cit.>, and can also be applied to other types of models such as Fisher vector with SVM classifiers or LSTMs <cit.>. LRP assumes that the decision function can be decomposed as a feed-forward graph of neuron computations of type

    x_j = g (∑_i x_i w_ij + b_j),

where g is some monotonically increasing nonlinear function (e.g. the ReLU nonlinearity), x_i are the neuron inputs, x_j is the neuron activation, and where w_ij and b_j are learned weights and bias parameters. The propagation behavior of LRP can be characterized by looking at a single neuron: The relevance R_j received by neuron j from the upper layers must be redistributed to its incoming neurons in the lower layer. For this, we produce messages R_i← j that satisfy a local conservation property:

    ∑_i R_i ← j = R_j

The exact definition of LRP rule is dependent on the neuron type, and its position in the architecture, however, the message can generally be written as

    R_i ← j = q_ij/∑_i q_ij R_j,

where q_ij is a measure of contribution of neuron i to activating neuron j. The relevance score assigned to the neuron i is subsequently obtained by pooling all relevance messages coming from the higher-layer neurons to which neuron i contributes:

    R_i = ∑_j R_i ← j = ∑_j q_ij/∑_i q_ij R_j

The intuition behind this propagation method is that a neuron is defined as relevant if it contributes to neurons that are relevant themselves. The relevance propagation procedure is iteratively applied from the top layer down to the pixel layer, at which point the procedure stops. The method is illustrated in Figure <ref>; for theoretical background see <cit.>. LRP toolboxes are described in <cit.>.

A possible propagation rule results from defining contributions as the positive part of the product between the neuron input and the weights q_ij = (x_i w_ij)^+ where ()^+ indicates the positive part. q_ij can be interpreted as the amount by which neuron i excites neuron j. This rule was advocated by <cit.>, is easy to implement and particularly suitable for neural networks with ReLU nonlinearities. In this context, this rule is an instance of the more general αβ-rules proposed by <cit.>. In practice, the rule can be replaced by other rules (e.g. the αβ-rules, the ϵ-rule, the w^2-rule, or the “flat”-rule) all based on the same local relevance conservation principles, but with different characteristics such as sparsity, amount of negative evidence, or domain of applicability. An overview of these rules is given in Table <ref>, where we use the shortcut notation z_ij = x_i w_ij and where we define the map σ : t → t + ϵ·sign(t). Finally, max-pooling layers are treated in this paper by redirecting all relevance to the neuron in the pool that has the highest activation. The Caffe reference model <cit.>, as used for image categorization in Section <ref>, employs local renormalization layers. These layers are treated with an approach based on Taylor expansion <cit.>. Pixel-wise relevance is obtained by pooling relevance over the RGB components of each pixel.





 §.§ Experiments

We analyze the decision process of convolutional neural networks in two different machine intelligence tasks, reinforcement learning for arcade video games and supervised image classification. In the first task a convolutional neural network is trained to play simple computer games. We explain the decisions of the network using LRP and visualize the relevance for different game objects. We visualize which game objects the network focuses on and how this corresponds to the current game situation and the learned strategy for the games of Breakout and Video Pinball for the Atari 2600. Taking this approach further, we monitor the importance attributed by the learning machine to different game objects as a function of the training time and quantify changes in the model's behavior that are not apparent by monitoring the game score.

Second, we analyze machine behavior for a popular computer vision task; here two ML models are trained to classify images of the Pascal VOC dataset <cit.>. Interestingly and anecdotally, one of them, a Fisher vector-based classifier trained to classify images as horses or non-horses, is shown to rely its decisions on a spurious correlation: a copyright watermark that accidentally and undetected by the computer vision community persisted in this highly popular benchmark. For the classification of ships the classifier is mostly focused on the presence of water in the bottom half of an image. Removing the copyright tag or the background results in a drop of predictive capabilities. A deep neural network, pre-trained in the ImageNet dataset <cit.>, instead shows none of these shortcomings.




§ TASK I: PLAYING ATARI GAMES


The first intelligence task inspected studies neural network agents playing simple Atari video games. The training of these models has been performed using a Python- and Theano-based implementation, which is publicly available from  and implements the system described in <cit.>. The method uses a modification to Equation <ref> to calculate the long-term reward of the next action and considers both the current set of model parameters θ, as well as an older,
temporarily fixed version thereof θ^*, where after every k steps, θ^* will be updated to the values of θ. Having a different set of parameters for the target and for the prediction stabilizes the training process. The resulting update step for the network parameters is

    θ_n+1 = θ_n + α ∑_s,a,r,s'∈ B ∇_θ Qs,a;θ DQ(s,a;θ) - r + γmax_a' Q(s',a';θ^*),

where α is the learning rate of the training process. Following the approach of <cit.>, the function D clips the difference term at the end of Equation <ref> between [-1 1] to curb oscillations in updates where the network is far from satisfying the Bellman equation. This is equivalent to employing a quadratic error term until the value 1 and a constant error term beyond.



The network consists of three convolutional layers and two inner product layers. The exact architecture from <cit.> is described in Figure <ref> and in Table <ref>. An input state corresponds to the last four frames of game visuals as seen by a human player, transformed into gray-scale brightness values and scaled to 84 × 84 pixels in size, is fed to the network as a 4 × 84 × 84-sized tensor with pixel values rescaled between 0 (black) and 1 (white).
The network prediction is a vector of the expected long-term reward for each possible action, where the highest rated action is then passed as input to the game. Every action is repeated for four time steps (i.e. every four frames the model receives a new input spanning four frames and makes a decision which is used as input for the next four frames) which corresponds to the typical amount of time it takes for a human player to press a button. With a probability of 10%, the trained agent will choose a random action instead of using the action predicted to be the most valuable option; as we will see in our analysis this randomness is essential. Upon training a completely fresh model, the probability of picking actions at random is initiated at 100% and linearly over time lowered to 10% with ongoing training.
As suggested in <cit.>, we use stochastic gradient descent with a batch size of 32 and a learning rate of α = 2.5·10^-4. Every fourth update step, the parameters from θ are copied to θ^*. During training, a replay memory is maintained as an active training set. The memory is updated as a FIFO-style buffer structure, as soon as its capacity of 10^6 time steps or observations is exhausted. Model weight updates are performed as soon as 5 · 10^4 observations have been collected.

We use LRP to explain how the network decides which action to take. Specifically, we use the αβ-rule, for LRP (see Table <ref>) with parameters α=1 and β=0. It distributes relevance proportionally to the positive forward contribution in every layer. In the input layer, the black background (black) of the game corresponds to a gray-scale value of zero and would receive no relevance. To be able to distribute relevance onto all pixels, in the lowest layer, we resort to the w^2-rule described in <cit.> which was designed to appropriately address this situation.




 §.§ Visualization and Comparison to Game Play


LRP is used to back-propagate the dominant action through the network onto the input which results in a 4 × 84 × 84-sized tensor of relevance values. To create a heatmap, we sum over the first axis and normalize the values to a value range of [-1 1] per pixel — R_i ←R_i/(max_j |R_j|) — and rescale the image via linear interpolation to the original size of 210×160 pixels. To give an intuition for interpreting the heatmaps, we demonstrate how they correspond to different situations and strategies for two examples, the games Breakout and Video Pinball, both of which show above-human performance for the trained learning machines
<cit.>.

Figure <ref> displays game visuals captured at different stages of the Atari games Breakout and Video Pinball alongside the corresponding heatmaps produced by a trained network.



  
DNN Agent Gameplay in Breakout:
We observe: In the early stages of the game, the neural agent concentrates on tracking the ball and follows its movements with the paddle on the bottom of the screen. The relevance is almost exclusively focused on the ball, as illustrated in Figure <ref> a). Only when the ball is in downwards movement and close to the paddle, strong positive relevance is allocated on the paddle for a very brief moment. During this game play stage, also a weak uniform relevance is attributed to the area around the colored bricks at the top, where the model aims to shoot the ball.

Each time the ball hits a block, the block disappears, and the score increases. When the ball hits an exposed block from the third row of blocks, the ball speeds up to twice its initial movement speed. The neural network agent recognizes the increase in ball velocity and transitions into the second phase of its learned game play strategy. It focuses on targeting the ball towards the leftmost column of bricks, as seen in Figure <ref> b), where it has learned to create a vertical tunnel[This behavior has been also observed by the authors of <cit.>.] through the colored wall. Relevance allocation indicates that the model still tracks the ball, but also is aware of the area where it tries to build the tunnel.

After finishing the tunnel, the model attempts to position the ball above the brick wall (Figure <ref> c) and d)) and keep it in this area, where a quick accumulation of score rewards is possible. A permanent cloud of strong positive relevance perseveres above the brick wall, as seen in Figure <ref> d), including those times the ball is below the brick wall, clearly reveals the agent's strategy. All of the above clearly embodies an appropriate “understanding” of the game and its strategic targets. 

As a side remark, we would like to add a caveat: Should the current ball be lost at this stage, then the agent will stall and not enter a new ball (should there still have been any in reserve) voluntarily if the paddle is not approximately centered. This behavior is somewhat surprising and asserts that the system still lacks some deep understanding of the game and the system's possibilities to interact with it. A restart (i.e., the agent receives a new ball) may occur, however, as a randomly chosen command. If actions are chosen solely based on the Q-function (without any randomness), then the agent will not restart and continue playing the game. Figure <ref> visualizes a sequence of interactions between the trained model and the Atari interface, until such a deadlock situation occurs and the game stalls. We conclude that this “don't known what to do” situation occurs, because the model was not exposed to sufficient amounts of training data covering a game environment almost cleared of bricks. Humans are much better in coping with such new infrequent situations, because they understand the rules of the game and have the ability to plan. Although the AI agent outperforms humans in terms of measured performance and reflexes, it fails to cope with such simple game situations, in fact the system has to rely on random action selection in this situation as it does not come at any additional costs.





  
DNN Agent Gameplay in Video Pinball:
Also in the game Video Pinball we observe a behavior of the neural agent which is surprising and which sheds an interesting new light on the overall capabilities of the system. As a result of the learning process, the agent plays solely by “nudging” the table and thus completely ignores the paddles designed to prevent the ball to fall out at the bottom. Interestingly, the agent has learned to balance the use of the “nudging” input well enough to effectively steer the ball without ever being penalized as “tilt” (which happens after “nudging” too frequently or tilting the pinball table to steeply[See game manual at ]) It has identified this peculiar control approach as the optimal strategy to play the game. Let us analyze this unexpected result closer with LRP. Initially, the “pipe” structure at the top right of the pinball table holds a high concentration of relevance. The agent tracks the location of the ball and pipe and tries to move the ball towards the pipe element, as shown in Figure <ref> e). Once the ball arrives at its destination, the agent uses “nudging” and collisions with other table elements to let the ball pass through the pipe exactly four times. For each time passing the pipe, a score increase is rewarded to the player and after the fourth passing, an extra ball is added to the player's reserve. Afterwards, no more extra balls are awarded until a ball has been lost. The agent is apparently tracking its progress by focusing on the items appearing at the bottom of the screen each time the ball moves through the pipe (Figure <ref> f)).

After the fourth change in icon appearance due to passing the top right pipe (after one Atari icon appearing each time, the middle one changes to an X), the screen flashes white once and LRP shows that all relevance focus is removed from the bottom icons and accumulated on the top left pipe element instead. The agent uses the “nudging” strategy again to move the ball towards the left, as can be seen in Figure <ref> g).
The agent now bounces the ball through the pipe and off the block below/the wall indefinitely, while using the “nudging” strategy to control the movement. Figure <ref> h) visualizes this behavior through the LRP heatmap. For each time passing the left pipe, the agent is awarded with a score increase — identical to the reward earned by passing the right pipe. Passing the left pipe, however also increases a counter, which further increases a reward added to the current score, as soon as the ball is lost.

Notably, the overall strategy followed by the agent — first ensuring to secure an extra life per round to prolong the game, and then switching sides to gain an additional score increase in case the current ball is lost — shows highly strategic behavior, targeted at maximizing long term reward. The agent has learned to stay within the rule boundaries of pinball tricking/cheating only to an extent that no tilt ends the game. Thus, the machine has found an optimal strategy to continuously increase the score at only minimal risk of hazardous ball movement, perhaps not the one targeted by the original game designers.




 §.§ Is the AI Agent Cheating ?


In both examples the neural agent learns a strategy that leads to a maximized long-term reward within the limited scope of possible game states.
Thus, it is doing what it is supposed to do according to Equation <ref>. Still the behavior is to a large extend unexpected and may be regarded as cheating, because it does not aligned with our idea of how to play these games. The agent is playing according to the rules of the game, but it exploits some weak points of the system. Such behavior may be not acceptable for humans in real life (although in the case of Atari games it is certainly fine).
Human players often have an implicit agreement what is regarded as fair play, e.g., in sports <cit.>. Not following these unwritten rules may have negative consequences up to social isolation. Learning machines are trained to solve a given task and do not have to fear these negative consequences, unless explicitly included into the game design or the agent's objective function. Thus, from the agent's point of view the “tunnel” and “nudging” strategies are not cheating, but a clever way to maximize long-term reward. 

Since unintended and unexpected behavior of the AI system may pose severe risks in real applications (e.g., in medical domain), it is important to detect it. Although it may be possible to draw conclusions about the agent's intentions and strategy by just observing the behavior of the agent, we argue that it is much easier when visualizing the focus of the networks' decision making with LRP. With the heatmap it is clearly evident from just one game that, e.g., the agent is tracking the ball, purposely wants to build a tunnel or completely ignores the paddles in pinball. Drawing such conclusions from sole observations of the agent is much more difficult (e.g., it is not obvious that the agent ignores the paddles) and certainly requires watching a lot more games. But there is also a limit to what can be practically deduced solely from the observations. Section <ref> presents a technique for automated detection erratic behavior of the model, which only works with heatmaps as they are much more informative than raw observations.
Also the fact that the artifacts in the Pascal VOC dataset have not been detected for almost a decade and probably still would not have been if methods such as LRP were not available, is clear evidence that model analysis from observations does not work.

In the next section, we take the LRP analysis even one step further and quantify how the neural agent's strategy is being refined during training by monitoring the relevance attributed to certain game regions; this will permit automated quantitative analysis without the need to manually watch long sequences of game play.




 §.§ Quantifying Strategy Shifts


During training of neural agents, different stages of behavior can be observed. This is mirrored by our analysis of the networks focusing on different game aspects. Using LRP, we can measure the relevance of input regions and changes in relevance allocation with ongoing training, allowing us to quantify changes in the neural network agent's focus of attention. As a case study, we will now analyze the complex tunnel-building strategy that the agent follows in a game of Atari Breakout. Here the network training progresses from initially just being able to recognize the ball and later the paddle with which the network learns to control the game, until finally acquiring long-term strategies as subsequent behavioral stages. Specifically, we are able to observe that the network recognizes certain game objects reliably before it is even able to play the game rudimentarily well. We take that as an indicator that early in training the convolution filters have adapted to respond to the moving game elements such as the ball and paddle well, while the top layers of the network are not yet able to use this information to form an appropriate strategic response for the current state of the game, other than correlating ball movements to changes in the score. That is, the model has learned that the ball is relevant for the game. We note that analysis like this can help to investigate shortcomings of a network-based predictor, e.g. to distinguish between problems within the lower level architecture, responsible for tracking, from shortcomings in the top layers, responsible for devising a decision.




  §.§.§ Quantifying the Focus of the Deep Networks over Training


To consolidate our observations from watching the network play at different levels of training progression, we analyze how the focus of the neural agent changes during training using the various heatmaps computed with LRP. For our analysis, a neural network agent has been trained for 200 epochs to play Atari Breakout, with each epoch spanning 100,000 parameter update steps. At the end of each training epoch, a snapshot of the current model state is saved, resulting in 200 models of different levels of expertise at playing the game.

To get a sample set of game states to be analyzed, we let the fully trained network play a game of Atari Breakout for a series of 2000 frames, where every input state, Q-value and action passed to the game interface are recorded. From this set of 2000 frames, 500 frames from the early game phase and another 500 from the late game phase are taken and used as inputs for each of the 200 network training stages obtained earlier.
To reach comparability across networks, the same inputs are used for all the networks, instead of letting each network generate its own input by playing. Clearly, for a model reflecting an earlier state of training it is quite unlikely that complex strategies such as tunnel building could be observed, thus leaving the focus on the tunnel for this model undefined. With our protocol, we intend to see whether networks in earlier learning stages are already able to recognize the usefulness of a tunnel or not, although this knowledge would only be exploited in the strategy at a later stage.

For every model and input sample, relevance maps are computed with respect to the model decision. For a set of important game objects we measure the total amount of relevance allocated to their respective pixel regions. To minimize the influence of randomization effects from the training process, the experiment is repeated over six different training runs (i.e. we have trained 6 networks in total, with 200 network snapshots created in regular intervals for each network), with the individual network responses and the mean thereof being reported in Figure <ref>. The tracked game objects are:



The ball: A rectangular region enclosing the ball with two pixels of padding in each direction. The relevance response is only measured if the ball is below the brick area, in order to distinguish the amount of relevance attributed to the ball from the amount of relevance score covering the bricks.
  
The paddle: A rectangular region around the paddle with two pixels of padding in each direction. The relevance response for the paddle is only measured when the measurement regions of ball and paddle do not overlap, to avoid confusion in the relevance allocation measurements taken.
  
The tunnel: A region defined by all the pixels in the leftmost and rightmost columns of the brick wall, which have been cleared.



For every frame, the relative amount of relevance attributed to an object is calculated by summing over the pixel region defined for each object as described above, divided by the number of pixels per object, to compute a measurement of relevance per pixel score for each object. Additionally, this value is then divided again by the average pixel relevance score taken from the full frame to mitigate the effect of better trained networks generally predicting higher Q-values (and thus attributing higher relevance scores). The resulting relative relevance r per game object is then

    r = relevance on object/total relevance in frame·area of frame/area of object.




The object to be recognized earliest during training is the ball, since its position and movement direction are a direct indicator of a change in score or an expected penalty due to losing the ball. This is a prediction task that can be solved without knowledge about future frames. In fact, the networks are able to recognize the ball before grasping the controls well enough to play the game. The importance of the paddle manifests itself only a few training epochs later. The paddle indirectly influences the rewarded score by preventing the ball from leaving the screen, allowing the game to accumulate additional reward in future frames. Connecting an action to a delayed reward or penalty is a considerably more complex strategic task than just recognizing an immediate score increase which is connected to an event.

After roughly 40 epochs of training, the networks attempt to build tunnels at the sides of the brick wall, quickly breaking through the bricks. After the breakout, the ball ricochets between the borders limiting the game area and the highest valued blocks at the top for longer series of frames, limiting the need for interaction while maximizing the received reward. The relevance plot in Figure <ref> mirrors the discovery of this strategy of the learning machine. It shows increasing amounts of relevance attributed to the tunnel region over time until about the 80th training epoch, from which on the attributed proportion of relevance remains almost constant.

On the one hand, building a tunnel can be interpreted as an advanced strategic task, since the AI has to plan ahead many steps in advance to create a favorable game state that will ultimately result in high rewards. On the other hand, one could argue that the only intelligence to be found is in the design of the training process, since the use of reinforcement learning encourages delayed gratification to increase the overall reward. The latter view is backed up by the observation that network agents having seen 200 epochs of training curiously fail to restart a new ball (see Figure <ref>) due to the apparent lack of transfer knowledge, a key element of true intelligence. In this case the agent fails to transfer knowledge to later stages of the game, namely that the “fire” button needs to be pressed if the ball is lost. This was learned in beginning stages of the game, but is not transferred since the game situation is only observed seldomly in the advanced game phases.




  §.§.§ Varying Depth of Architecture

In this section we compare the relevance responses of neural network agents with different model architectures, namely the architecture from <cit.> (denoted as Nature architecture), the architecture of its predecessor in <cit.>, (denoted as NIPS architecture) and a third network with an architecture similar to <cit.> (Small architecture). The NIPS architecture has one convolutional layer less than its successor, whereas the Small architecture has the same number of convolutional layers as the Nature network, but is limited in its decision making capacity by only one fully connected layer instead of two. An overview in the different network architectures is given in Table <ref>.



 

For the NIPS architecture, the focus on ball and paddle is delayed, emerging approximately 5 training epochs later when compared to the Nature network (see Figure <ref>). The relevance on the tunnel region shifts in two stages and finally rises to an amount higher than that recorded for the Nature architecture. A possible interpretation is that the shallower convolutional architecture slows down the recognition of the important game elements, but once recognized the development of higher level strategies is possible.

For the Small architecture, the focus switches very early to ball and paddle. The three convolutional layers allow for a quick recognition of the important game objects. However, the game play performance remains at a sub-human level and more advanced strategies like tunnel building remain out of focus. The agent learns to follow the ball with the paddle, but is only able to successfully reflect the ball in three out of four interactions.




  §.§.§ Varying Size of Replay Memory

We investigate the influence of replay memory size on the development of a neural network agent. The replay memory is a dataset of previous game situations described as the tuple . After each interaction with the Atari emulator one new game situation is added to the memory. Once the memory capacity is reached, the earliest entries are replaced with newer ones. For training, a random batch is drawn from the memory.


In Figure <ref> we present the development of the relevance of the ball, paddle and tunnel to neural network agents, for memories of capacities 5·10^4, 10^6 and 5·10^6. For all memory size settings, the corresponding models shift their attention to the tunnel area with ongoing training. For the smallest memory size of 5·10^4 game states we note a more gradual shift in strategy that starts earlier in training and leads to less concentrated model attention registered on the tunnel area. The largest memory of 5·10^6 game states shifts to the advanced strategy at a later time, but more abruptly so. Relevance scores concentrate more on the tunnel area when compared to the other models. A later onset of strategically recognizing the tunnel during training as an effect of replay memory size can be attributed to the vast amount of early game states still populating the memory. Many more training epochs are needed to fully eliminate the effect of those game states that have resulted from many short games with uncontrolled game play in early training epochs. A smaller replay memory might replace those game state recordings faster, but does not allow for enough memorized observations of later phases of the game (or full games played more expertly) to learn the tunnel building strategy successfully.




  §.§.§ Changes of Model Attention during Game Play


Over the course of a running game of Atari Breakout, we investigate how and where relevance allocation changes over time. To visualize heatmaps over time, the relevance map computed for each frame is summed over the horizontal axis, resulting in a relevance vector with an entry for each vertical pixel location. Then, the compacted frames from all time steps are concatenated column-wise with the time now being the new horizontal axis. Relevance values attributed to the ball, the paddle and the tunnel can still be distinguished since they have different vertical positions for most of the time. We complement this analysis with information about at which time steps or events, certain actions are predicted significantly stronger than the other options. For a trained network, the Q-values of all possible actions generally only differ by relatively small quantities. If the ball is far from the paddle, for example, the next action does not influence the predicted score and game play much. At points in time when single actions do have a large impact, the predicted Q-values diverge. We measure this relative deviation of Q-values as

    Δ q = q_max - q_min/q_max

where q_max and q_min are the maximum and minimum predicted Q-value for a given input, respectively. Over the course of training, the networks become more decisive. Figure <ref> shows Δ q during a game sequence of 500 frames for three different stages in training: After two, twenty and two hundred epochs of training, with 100.000 training steps per epoch. We observe that the fully trained network's prediction output focuses on single output neurons at times when it has to interact with the ball, while earlier versions of the same network are not yet fully able to decide with a comparable amount of certainty.



The apparent zig-zag structure in the heatmap visualizations in Figure <ref> is the up-and-down movement of the ball, as tracked by the neural network agent over time. Applying LRP allows us to track the ball without having to design a specific tracker. Combining this with the temporal focus of the network we can discern at which height of the ball the decision for an action is made. Figure <ref> illustrates these more important action predictions for a fully trained network as red circles and visualize the change in relevance allocation over the time of a game. Note that the network itself becomes more focused over training time (cf. the discussion in Section <ref>).




  §.§.§ Comparing Relevance Maps to Gradient Map

Another popular method to analyze neural network type models or reinforcement learning systems is Sensitivity Analysis (cf. <cit.>), a gradient-based saliency method. In a nutshell, Sensitivity Analysis computes the network gradient at a specific input point and then applies the ℓ_2-norm over the input channels at each pixel. The magnitude of this gradient response at input level then yields information about the sensitivity of the model to changes in certain
regions of the input.

We repeat our experiments from Section <ref> and <ref> with the gradient maps computed via Sensitivity Analysis to compare both methods. As we will observe, LRP provides clearer results.

Figure <ref> presents the results obtained when using Sensitivity Analysis instead using LRP for the setup of Figure <ref>. Observing the gradient maps during game play reveals that the saliency follows the general area where the ball is located, but is not focussed on the ball itself. The response obtained with Sensitivity Analysis, when given a model and an input data point, measures how much a change in the input would affect the model prediction. Here, peaking gradient values in close proximity to the ball essentially indicate where the ball should be to cause the steepest change in predicted Q-values, compared to where it actually is. Furthermore, for each of the neural network agents trained, gradient maps did not attribute weights on the pixels covering the tunnel element. The changes in game play strategy are not observable through Sensitivity Analysis.



In Figure <ref>, we repeat the analysis from Figure <ref> with gradient maps instead of LRP maps. Similarly, gradient maps are summed up and then concatenated along the horizontal axis, providing a representation of gradient responses over time and vertical game coordinate. The same Δ q plot line is drawn below the heatmap time line to contrast importance prediction with pixel-wise responses. While the vertical movement of the ball is still distinguishable in the gradient map, the response is by far more blurred and less local compared to the heatmaps computed using LRP. This can be explained with the visualizations described in Figure <ref>, demonstrating strong gradient responses in areas around the ball — where the ball has to be in order to maximally change the predictor output. The gradient map, however, is unable to indicate situations or game elements that are per se of importance to the predictor. It lacks, next to interpretability, in a clear relationship between game elements and gradient responses. We refer the reader to <cit.> for a more detailed discussion on the advantages of LRP over gradient-based explanation methods.




§ TASK II: IMAGE CATEGORIZATION



As emphasized in <cit.>, generalization error rates and accuracy ratings are often not sufficient for assessing the reliability of a trained classifier and the appropriateness of its problem solution strategy. This aspect is especially important for application scenarios where the usage of the machine learning model in question is for e.g. safety critical data or in medical analysis. Explanation algorithms such as LRP can help in various ways, i.e. for identifying flaws in predictors and also for detecting weaknesses and artifacts in the used datasets rsp. benchmarks.

Even though huge data collections with millions of samples such as ImageNet <cit.> exist, their size is finite and models trained based on said datasets will in most cases only ever see a small subset of all possible configurations an object might be represented in. In some image dataset for example, a ship might regularly be depicted floating on a body of water but seldomly under maintenance on a dry dock. In the latter case a human observer would still recognize a ship, but the unusual background it has been captured in might cause a classifier trained to recognize aquatic vehicles to incorrectly reject the sample. This would indicate that the concept of “boat” or “ship” has not been understood as such but heavily depends on the co-occurrence of a suitable background environment.

Therefore, analysis should be extended beyond simply calculating test set error rates and also explain the behavior of a classifier. In this section, two
state-of-the-art model architectures in their respective predictor families — a Fisher Vector (FV) classifier and a Deep Neural Network — are briefly described and subsequently their prediction strategies are contrasted with the help of LRP.
 



 §.§ The Fisher Vector Classifier



The FV model evaluated in this section follows the configuration and implementation from <cit.> and can easily be replicated by using the Encoding Evaluation Toolkit <cit.>. Twenty one-vs-all object detection models are trained on the  partition of the Pascal VOC 2007 dataset — one for each object class. The FV model pipeline consists of a local feature extraction step, computing dense SIFT descriptors <cit.> from an input image, which are then mapped to Fisher Vector representations via a Gaussian mixture model (GMM) fit to the set of local descriptors of the whole training set. The FV representations of each image are then used for training a linear SVM <cit.> model. The parameters used in each step of the pipeline are as follows:

The images are normalized in size to a side length of at most 480 pixels, while maintaining the original aspect ratio. From a gray-scale version of the image, SIFT features are computed with spatial bin sizes of { 4,6,8,10 } pixels with fixed feature mask orientation at spatial strides of { 4,6,8,10 } pixels respectively. Using PCA, the descriptors are then projected from the originally 128-dimensional feature space to an 80-dimensional subspace, onto which a GMM with k=256 Gaussian mixture components is fit. The trained GMM is then used as a soft visual vocabulary for mapping the projected local descriptors to a FV. The mapping process involves a spatial pyramid mapping scheme, subdividing an input image into 1 × 1, 3 × 1 and 2 × 2 grid areas. For each of the in total 8 image areas, a FV is computed based on the corresponding descriptor set, which are then concatenated to form one FV descriptor per image. After the application of power- and ℓ_2-normalization steps, reducing the sparsity of the vector and benefitting the model quality <cit.> this Improved Fisher Vector<cit.> representation is used for training and prediction together with a linear SVM <cit.> classifier.

Evaluating the model in the  partition of the Pascal VOC 2007 dataset results in a 61.69% mAP score in <cit.> and 59.99% mAP in <cit.>.




 §.§ The Multilabel Deep Neural Network

In order to contrast a Deep Neural Network to the previously introduced FV classifier, a pre-trained model has been fine-tuned on the Pascal VOC data and classes to achieve a comparable evaluation setting. For fine-tuning, we use the Caffe Deep Learning Framework <cit.> and the pre-trained BVLC Caffe reference model available from  as a starting point. The model has been adjusted to match the number of Pascal VOC classes by setting the number of output neurons of the topmost fully connected layer to 20. The softmax layer has been replaced with a standard hinge loss layer to accommodate for the appearance of multiple object classes per input sample as it is the case with the Pascal VOC data.

The training dataset consists of the  partition of the Pascal VOC 2012 dataset, augmented by first resizing each image to 256 pixels on its longest side and padding the image by repeating the border pixels to a size of 256×256, then cropping 227×227 sized subimages at the corners and the image center. Together with a horizontally mirrored version for each of the subimages, the tenfold augmented training data then counts 115,300 training samples. Fine-tuning is performed for 15,000 iterations with training patches holding 256 samples per iteration and a fixed learning rate of 0.001. The resulting model achieves an mAP score of 72.12% on the Pascal VOC 2007 dataset. We have made this fine-tuned multi-label model available as part of the Caffe Model Zoo[].




 §.§ Comparing Fisher Vector and Deep Network Prediction Strategies
 

We compare the reasoning of two different classifiers — an Improved Fisher Vector SVM classifier from <cit.> as a state-of-the-art Bag of Words-type model to the much deeper convolutional neural network architecture described before — by analyzing the relevance feedback obtained via LRP on pixel level. Both models are trained / fine-tuned to predict the 20 object classes defined in the Pascal VOC datasets. In order to compute pixel-level relevance scores for the FV model, we employ the ϵ-rule to obtain a numerically stable decomposition of the FV mapping step and the “flat” rule to project local descriptor relevances to pixels. The relevance decompositions for the SVM predictor layer are computed using the “simple” (ϵ=0) rule (cf. <cit.> and <cit.> for further technical details). Since the fine-tuned DNN model structure is composed of a repeating sequence of convolutional or fully connected layers interleaved with pooling and ReLU activation layers, we uniformly apply the αβ-rule with α=2,β=-1 throughout the network, which complements the ReLU-activated inputs fed into hidden layers especially well for explanation. Since the output of ReLUs is strictly ≥ 0, positive weights in the succeeding convolutional or linear layer do carry the input activation to further layers, whereas negatively weighted connections serve as inhibitors to a layer's output signals. Using the  αβ decomposition rule allows for a numerically stable relevance decomposition, where the parameter α controls the balance of neuron exciting and neuron inhibiting patterns for the explanation.

Observing the selection of results presented in Figure <ref>, the lower granularity of the relevance maps computed for the FV classifier is apparent. This effect results from the application of the “flat” decomposition rule for computing pixel level relevance scores from local descriptor relevances for the FV model: Whereas for DNN type predictors pixel to neuron and neuron to neuron relationships are given via distinguished (weighted) connections, such a relationship is often obscured (or does outright not exist) in the process of local feature extraction, e.g. especially when features based on histograms or quantiles computed from a set of pixels are used to describe parts of an image. The “flat” decomposition rule bridges this gap between two layers of computation at the cost of potential heatmap resolution, by uniformly distributing the relevance value of a top layer neuron or feature onto the neuron or feature's receptive field. The receptive field of e.g. a standard SIFT descriptor as used for the FV model is the image area the descriptor output is computed from. Analogously, the receptive field of an output neuron in a neural network context then is the set of input neurons connected and contributing to the considered output.




  §.§.§ Detecting Boats & Horses
 
The relevance maps computed for both predictors have been compared qualitatively as well as quantitatively in <cit.>. On a qualitative level we see that the DNNs prediction is dominantly based on the objects in the images themselves, whereas the FV model often resorts to using background information or co-occurring objects and image elements for support. This observation also reflects the reported prediction performances of both models, shown in Table <ref>.


Of special interest are our findings related to the categories “boat” and “horse” (boa and hor in Table <ref>): Both classes are amongst those for which both models predict with high confidence. No statistically significant difference can be seen for the class “horse”. Figure <ref> presents results for both object classes. To the left, input images show boats alongside pixel-level relevance maps computed for the corresponding predictors, visualized as heatmaps. We observe that for the class “boat”, the FV model dominantly decides depending on the presence of a body of water in the bottom of the image. The DNN however has based its decision on the silhouette of the boat itself, in line with human intuition. When an image of a shipwreck on land is passed as input to both classifiers, the relevance maps computed for class “boat” show that the DNN still finds positive evidence in the outline of the wreck, whereas the FV model detects evidence strongly contradicting the target class “boat”, predicting the label “aeroplane” instead.
 
The observation that the FV model consistently predicts boats based on the presence of water holds for almost all samples in the dataset. For other object classes, the FV model has learned a similarly biased contextualized prediction rule. The prediction of object category “aeroplane”, for example, relies heavily on sky as background in the top left and top right quadrants of the image. Figure <ref> shows some examples for class “aeroplane”, for which both models predict with high average precision (AP) rating.



Most notably, the FV model has also developed a strong bias towards making use of a copyright watermark to detect samples of class “horse”, as shown in the right half of Figure <ref> — notably this artifact had gone undetected when establishing the benchmark. Removing the watermark in the second row of the figure results in a false negative prediction of the FV model. In the explanatory heatmap computed using LRP, the aggregation of strong positive relevance in the area of the copyright watermark vanishes as well, while the remainder of the heatmap remains unchanged. The neural network model is invariant to this input change in prediction and heatmap response. Upon closer inspection of the Pascal benchmark data on which the FV model has been trained and evaluated, similar copyright watermarks were located in approximately 20% of all images containing horses in the bottom, or bottom left of the image. A large part of the remaining benchmark images with horses were taken in a horse show tournament setting, where obstacles and hurdles being jumped over are identified as decisive image features representing the class “horse”. The presence of simple and easy to learn visual features which are not part of the animal horse explain the classifier's strong focus on contextual information at prediction time, and the relatively low amounts of relevance attributed to the pixels showing the horses themselves (cf. also the following Section <ref>
for an investigation of the importance of image context for both the considered FV and the DNN models).

Such artifactual learning has also been described in other work, e.g, in <cit.> where the model leaned to distinguish wolves and Huskies by the presence of snow, or in the context of reinforcement learning <cit.> where the RL agent finds an isolated lagoon where it can turn in a large circle and repeatedly knock over three targets, timing its movement so as to always knock over the targets just as they repopulate due to the misspecify of the reward function. All these are concrete problems on AI safety, which has been recently studied in <cit.>.

We provide another example for the extent of the influence the learned bias has for prediction. Figure <ref>a shows an image belonging to class “horse” as it originally occurs within the Pascal VOC 2007 data. Using the FV model to predict the class of the image results in a true positive prediction for class “horse”. Again, the corresponding relevance map identifies the copyright watermark in the bottom left corner as the most important feature for the classifier to make its decision. When the copyright tag is removed (Figure <ref>b), however, the model fails to recognize the sample as a member of its true class.

Conversely Figure <ref>d shows an artificially created image, where a sports car has been placed on a lush green meadow, causing a true negative prediction by the FV model. By adding the copyright watermark corresponding to class “horse” to the image (Figure <ref>c), the model recognizes the tag and false positively classifies the image as “horse”. That the learned biases for the classes “boat” and “horse” are global phenomena for the FV model reflects well in the bottom row of Figure <ref>. For both object classes, average heatmaps for the FV classifier (left) and the DNN (right) are shown. Whereas for the FV model, positive relevance tends to aggregate in the same area — the bottom of the image for class “boat” and the bottom as well as the bottom left corner for class “horse” where the copyright watermark is located — the average relevance response computed for the DNN classifier shows distinguishable localized patterns around the image center, recapitulating our observations on a class-wide scale and underlining that the DNN model predicts based on the true object appearance, which shifts and differs from image to image.






  §.§.§ Importance of Context
 

To quantify above observations, we measure image context importance against object importance for prediction, per class and for both the FV and the fine-tuned DNN model. The image annotations of the Pascal datasets provide coordinates for tightly fit object bounding boxes for each image. For each object class of the dataset, we collect all positively labelled samples and compute an average outside-inside relevance ratio per image as

    μ = |P_out|^-1∑_q∈ P_outR_q/|P_in|^-1∑_p∈ P_inR_p

where P_in is the set of pixels inside the class-specific object bounding boxes (multiple instances of an object class can appear simultaneously) with positive relevance scores, P_out covers the set of pixels with positive relevance scores outside of the bounding boxes and R_p and R_q are relevance values for pixel coordinates p and q. Large values indicate model decisions being largely based on background information, whereas low values speak for object-centric predictions. Figure <ref> reports the average ratios per class over all samples representing that class.



Both bar charts confirm that the DNN predicts by using visual information provided by the class-representing objects themselves, while the FV model resorts more to using contextual information. Well-predicted classes such as “aeroplane” and especially “boat” are predicted based on a consistently occurring contextual bias. For these classes the model might predict the label correctly in a majority of trials, i.e. the model performs well in number, but it has not learned to generalize the concept well and will most likely fail when deployed for a task outside the controlled benchmark laboratory setting. Figure <ref> for example shows boats in water, partially below the horizon line, yielding negative relevance values, since their presence occludes the water. Figure <ref> demonstrates, that the DNN classifier does not show this effect.







  §.§.§ Why do FV and DNNs exhibit different strategies ?
 
We attribute this effect to a combination of circumstances: For one, the FV mapping step includes the subdivision of the input image into multiple image sub-areas, a technique known to considerably boost the predictive performance of Bag of Words models due to the incorporation of weak geometric information. In this mapping scheme, one FV representation is computed for each image sub-area, spanning a separate set of dimensions in the final image representation in vector form. This encourages the classifier to optimize by concentrating on the subset of input dimensions providing information which correlates most with the expected label. Secondly, the Pascal VOC 2007 training dataset is comparatively small and lacks diversity. Some classes are under-represented or class labels frequently co-occur. The lack in diversity is common cause for the development of prediction biases, while object co-occurrence will cause the model to also learn features from other classes, located outside the target class object's bounding box area.

The DNN predicts dominantly based on the objects themselves. Therefore, most class context values reported in Figure <ref> (left) are much lower for the DNN than for the FV model. The DNN has been fine-tuned on Pascal VOC data and moreover many of the 1000 classes from the ImageNet challenge semantically overlap with the classes present in the Pascal VOC data. The class “horse” for example corresponds to the (semantic) subcategories “zebra” and “sorrel” in the ImageNet label set. While Pascal VOC provides the class “cat”, ImageNet has a range of labels describing subtypes of cats (“tabby”, “burmese cat”, “manx”, …). This visually and semantically similar overlap allows the network to resort to robust prior knowledge accumulated during training for the comparatively larger and more diverse ImageNet. This prior knowledge — the learned set of filters insensitive to the biases, but sensitive to the appearance of the objects in the Pascal VOC data — benefits the fine-tuning and results in a model which — loosely speaking — merely has to adapt its outputs to the new semantic feature groupings in the Pascal VOC label set.

There are, however, outlying classes in the measurements shown in Figure <ref> (left) for the DNN model, namely the classes “chair”, “diningtable” and “sofa” and other classes describing interior items. This set of labels often co-occurs in the images of the Pascal datasets, showing cluttered indoor scenes (see Figure <ref>). The frequently and simultaneously present set of features makes it difficult for both models to distinguish between the present classes as individual categories. Furthermore, from the results in Figure <ref> (left) and Table <ref> we may conjecture that performance may indeed correlate with “object understanding”, as shown in Figure <ref> (right) which combines both results. Equally speculating, we consider the results for the neural network agent playing Atari games as shown in Figure <ref> suggestive for the hypothesis that tight groupings of relevance scores on intuitively important image elements indicate a well-performing predictor even beyond typical classification tasks.





§ SEMI-AUTOMATED ANALYSIS OF CLASSIFIER



This section demonstrates the usefulness of relevance maps as features for analyzing classifier behavior automatically. The proposed approach constitutes a new tool for semi-automated model analysis – based on the computation of relevance maps <cit.> and spectral analysis <cit.> – which closes the gap between
 

  * (classical) performance evaluations over whole datasets (e.g. error rates). Here, no human inspection is needed, but this approach does not provide any information about the inner working of the classifier. 

  * visual assessment of single predictions using methods such as LRP. Here, information about the decision process is provided,
but this analysis requires human attention for each data point and thus does not scale to whole datasets.
 
We name our novel analysis method Spectral Relevance Analysis or short SpRAy. 
To the best of our knowledge it is the first method to investigate the predictions strategies of the classifier on the whole dataset in a (semi-)automated manner. 

Technically, our novel technique SpRAy allows to detect predictions based on irregularly frequent reoccurrence of non-obvious and highly similar image features, which can assist in the uncovering of intriguing or suspicious patterns in either the data used for training (and testing), the prediction strategies learned by the model, or both. The identified features may be benign and truly meaningful representatives of the object class of interest, or they may be co-occurring features learned by the model but not intended to be part of the class, and ultimately of the model's decision process. In the latter case, SpRAy will assist researchers and software engineers to systematically find weak points in their trained models or training datasets, or even generate new knowledge about the data and problem solving strategies.




 §.§ Spectral Relevance Analysis


The predictions made by the FV model for class “horse” are based on image features frequently appearing in a very structured manner in the object class' image data, despite not describing the animal in any way visually. The artifact in question is a copyright tag in approximately one fifth of the test and training images representing the object class, which has been picked up by the model as an even stronger indicator of horseness than the pictured horses themselves. Since the copyright watermark is already present in the input data, a very attentive human observer might have observed it, yet since those samples found their way into the Pascal data, which also was widely used as a benchmark dataset for several years, we suppose ultimately no one did. Humans often solve tasks in certain ways predisposed by life (long) experience. Any assessors of the data might thus have directed their attention towards the intended objects (known through life experience) shown on the image samples instead of auxiliary and unexpected features. Machine learning algorithms on the other hand can only connect information which is available in the discrete samples of finite example datasets.

With the goal to systematically identify pitfalls in the data a model might – or in fact does – fall victim to, we establish a novel Spectral Relevance Analysis (SpRAy) pipeline, which finds features correlated with a target class. Although those features appear during correlation analysis between pixel space and the target label, they might not be obvious to a human observer at all. If said features are very descriptive of a prediction target or object class, their presence is expected to result in concentrated relevance feedback within the corresponding models' and samples' relevance maps.

For our analysis, we employ the following steps: 


  * Computation of the relevance maps (potentially over the whole dataset).

  * Preprocessing (downsizing, padding, normalizing ...).

  * Spectral cluster analysis (SC) on the relevance maps.

  * Identification of interesting clusters by eigengap analysis.

  * Optional: Visualization by t-Stochastic Neighborhood Embedding (t-SNE).


After computing the heatmaps for multiple samples from the training / test dataset, the initial preprocessing step (2) renders all relevance maps uniform in shape and size, creating viable inputs for the following application of SC and t-SNE. Some predictors such as the FV classifier can accept as inputs images of arbitrary size, making this step a necessity in some cases. Also, by downsizing the input relevance maps, e.g. by pooling relevance spatially wrt. a regular grid, the dimensionality of the analysis problem is decreased (in general, this step is practically useful but not absolutely necessary). This expedites the process considerably and produces more robust results. Suitable preprocessing choices can be used to focus the following steps on certain characteristics within the input relevance maps.

The SC <cit.>  used in step (3) is a clustering algorithm with interesting analytic properties, which constitutes the foundation of the analysis pipeline. The method relies on the computation of a weighted affinity or adjacency matrix W = (w_ij)_i,j=1,…,N, measuring the similarity w_ij>=0 between all N samples s_i and s_j of a dataset. E.g. when building affinity matrices based on k-nearest-neighborhood relationships as we do in Section <ref>, we compute w_ij as

    w_ij =
    
    1 	    ;  s_j is among the k nearest neighbors of s_i  
    
    0				    ; else

Since this is an asymmetrical relationship between s_i and s_j we follow <cit.> and create a symmetric affinity matrix W with w_ij = max(w_ij, w_ji), describing an undirected adjacency graph between all samples. The evaluations in Section <ref> (which are based on binary neighborhood relationships) yielded highly similar results when using (euclidean) distances ||s_i - s_j|| between connected neighbors instead of above binary neighborhood relationships with only small differences in eigenvalue spectra.

From the matrix W, a graph Laplacian L is then computed as 

    d_i = ∑_j w_ij
    
    D = diag([d_1, …, d_N])
    
    L = D - W

with D being a diagonal matrix with entries d_ii describing the degree (of connectivity) of a sample i. Performing an eigenvalue decomposition on the Laplacian L then yields N eigenvalues λ_i,…,λ_N, with the guarantee of min_i λ_i = 0, and a set of corresponding eigenvectors. Here, the number of eigenvalues λ_i = 0 identifies the number of (completely) disjoint clusters within the analyzed set of data. For non-empty datasets, there is at least one cluster and thus the guarantee for at least one eigenvalue to be zero-valued. The final step of cluster label assignment can then be performed using an (arbitrary) clustering method – e.g. k-means – on the N eigenvectors. On non-synthetic data, however, there seldomly are cleanly disjoint groups of samples, and the (main) cluster densities usually are at least weakly connected. In that case,  the main densities can be identified by eigenvalues close to zero as opposed to exactly zero, followed by an eigengap. The eigengap is a sudden increase in the difference between two eigenvalues in sequence |λ_i+1 - λ_i|. In Figure <ref> we recreate an example from <cit.> which demonstrates the change in the eigenvalue spectrum with increasing overlap between the sampled distributions.


With σ=0.2, four non-overlapping sample sets have been generated. The four smallest eigenvalues of this dataset thus are exactly zero and the eigengap is distinctive. With increasing overlap of the sampled distributions (σ=0.4), the eigengap still indicates four clusters of data clearly, although the four smallest eigenvalues indicating well defined groups of samples are not exactly equal to zero anymore. Once the distributions overlap considerably (σ=0.8), there is no well-distinguished eigengap anymore to identify the number of densities sampled from truthfully. We can use the eigengap property of an analyzed dataset to identify structural similarities in the image input data of an object class, but also the corresponding relevance maps computed for each sample of the dataset wrt. to a trained model, reflecting the model's prediction strategy (step (4)).

In step (5) t-SNE <cit.> is used to compute a two-dimensional (or in general, a human-interpretable lower dimensional) embedding of the analyzed data, based on pair-wise distances between samples. The resulting embedding is used to visualize groups of input images or relevance maps by similarity, aiding in the identification of interesting patterns in the models' prediction. Properties of the t-SNE are known to be connected to cluster assignments computed via SC <cit.>. Sample to sample relationships computed during the SC step can be re-used in the t-SNE embedding phase by transforming the affinity matrix W to a distance matrix, e.g. as DIST = 1/W + ϵ for above binary k-nearest-neighbor affinity matrix by adding a small ϵ to the denominator to encode high distances between (via k-nearest-neighbors) unconnected points.




 §.§ Uncovering Prediction Strategies of the Pascal VOC Classifiers


Searching to uncover distinct prediction strategies within the scope of single object classes, we analyze for all classes of the Pascal VOC 2007 test set separately. Given the extensive amount of options to configure the SC algorithm, we perform our analysis using the recommended parameters from <cit.>, i.e. we build neighborhood graphs using the k-nearest neighbor algorithm with k = log(n) and n being the number of samples and use normalized, symmetric and positive semi-definite Laplacians <cit.> L_sym instead of the unnormalized L. The use of L_sym also allows for meaningful comparisons between input sample sets of different sizes, which will be important in a moment with Figure <ref>. For t-SNE, we set the perplexity to 7, the parameter for early exaggeration to 6. The method is known to be insensitive to small changes in both input parameters. For downsizing images, we use standard interpolation algorithms for images and sum pooling over a regular grid of pixels for relevance maps to reduces the inputs to 20× 20 sized matrices, representing local relevance allocation behavior throughout the dataset. Our experiments have shown that the qualitative results as presented in below setting can also be reliably obtained for input sizes 5 × 5, 10 × 10 and 50 × 50.

In the following we inspect the eigenvalue spectra for all classes and both the FV and DNN model. Figure <ref> shows the eigenvalue spectrum for class “horse” for input images and relevance maps for both the FV and DNN model. Previous manual inspection has revealed that the FV predictor primarily relies on a copyright watermark embedded into the pixels of some images for predicting the class. The gaps after λ_3 and λ_4 in the eigenvalue spectrum of the FV model's relevance maps are apparent and indicate multiple well-separated clusters. In the eigenvalue spectra of the images and the relevance maps obtained with the DNN model, the largest gap between eigenvalues occurs after λ_1, indicating only one densely connected cluster over all test samples for that object category.



Likewise to the eigenvalue spectra in Figure <ref>, the cluster label assignments computed via SC as displayed in Figure <ref> clearly show point clouds of homogeneous density for both DNN relevance maps and input images and well separated clusters for the FV relevance maps. Figure <ref> also demonstrates that the clusters found with SC (color coded) in the input data correspond well to the embeddings computed by t-SNE (embedding locations in ℝ^2) from the same input data with very high similarity. The connection between SC and t-SNE described in <cit.> can also be observed in all following results, making t-SNE a suitable tool for visually supporting the analysis via SC.


While for the DNN relevance maps the embedding and clustering results seem to be grouped by dominant combinations of horse and rider in the foreground vs. the presence of contradictory image features, the results for color images as input features are determined by visual scene similarity in structure and color composition (Figure <ref>). For the Fisher Vector relevance maps, the presence of two well defined groups besides the main cluster can be identified by both the cluster labels assigned via SC and also the embedding locations computed with t-SNE. This result suggests that the FV model picks up on information which is apparently correlated strongly with the target label “horse”, but not obvious from the input images alone.
Both clusters separated from the main point cloud contain relevance maps for image samples with the copyright watermark in question, which only covers a small number of pixels within the images originating from the same horse-themed online image repository.
The blue cluster groups samples which are predicted dominantly based on the presence of hurdles in a tourney setting. For a zoomed-in view of affected samples and their respective relevance maps from that cluster, please refer to Figure 3 in the main paper and Figure <ref> below.

With the application of SpRAy on the input images and relevance maps computed for both models, we have gained a clue that the FV model picks up on input information  in a structured and consistent way, which is not obviously present in the image domain and not used by the DNN model (the copyright watermark).
Further results reveal predictions based on image features co-appearing with the target class “horse” (the hurdles), which are not intended to represent instances of the target object.
That is, on relevance maps we obtain clusters of samples which are predicted with a very similar localized strategy by the FV model, which we may not find when inspecting the raw input samples.
The model has learned prediction strategies suitable for small subsets of training and test samples based on image features which are hard to find on the images directly, or are not intended to represent the target class. The usage of such a classifier that is relying on spurious correlations would lead to overfitting when applied to real world data, where spurious correlations appear much more rarely.

A recent and interesting study <cit.> compares behavioural patterns of primates (humans and rhesus macaque monkeys) and recent state-of-the-art DNNs in an image prediction setting.
The authors systematically investigate several image attributes and characteristics and their effect on prediction performance in a carefully controlled setting, in order to explain the performance gap between primates and the less well performing DNN models.
One component of the analysis presented in <cit.> explores the difference of prediction signatures between e.g. DNN and primate. Signatures may be built for each model from the class-level or example-level recognition performance. Another component of the analysis in <cit.> focuses on the effect of predefined visual cues on recognition performance.
Among the considered visual cues are pixel attributes (e.g. mean image luminosity) and object viewpoint attributes (e.g. object size and pose).
Results of the analysis in <cit.> suggest that these predefined cues do not exhaustively explain the whole prediction difference, and that there are potentially other (unknown) factors at play, that prevent the analyzed DNN models from attaining primate level image recognition performance.

We recreate the experiment described in <cit.> on our Pascal VOC setting to test if class-level prediction signatures are capable of identifying differences of classification behavior between the considered models, and whether the additional visual cues found by SpRAy (e.g. the source tags) are capable of further explaining this difference of classification behavior between models. We consider the FV model and compare it to the DNN model which here plays the role of the `ground truth' due to its higher overall performance. The class-level signature-based analysis, rendered as a scatter plot in Figure <ref> (left), singles out classes such as `bird', `dog', `sheep' as strongly discrepant when considering the recognition performance of DNN and FV. On the other hand, classes `horse', `boat', and `airplane' previously identified by SpRAy all remain close to the diagonal line.
For the second part of the analysis relating visual cues to recognition performance, we focus on the class “horse”, for which the SpRAy eigenvalue spectrum in Figure <ref> identifies four well-distinguishable prediction strategies for the FV model.
The cluster structure identifies the features “copyright tag” and “tourney hurdle” as strong indicators for class “horse”.
Given our less controlled data setting (real photographic images, multiple labels per sample possible, no segmentation mask for all images), we evaluate the effects of different sample characteristics by splitting the test samples for class “horse” into groups of samples exhibiting the chosen characteristics at different strengths.
Like <cit.>, we choose as image specific features mean pixel luminosity and group images into non-empty bins of luminosity values ]0.2,  0.3] to ]0.6,  0.7] in steps of 0.1.
Similarly, we compute object specific features from the bounding box annotations available for the Pascal VOC data.
Firstly, as an approximate measure to relative object size, we compute the fraction of image pixels covered by class-relevant bounding box areas, in group ranges of 0.1.
Secondly, we approximate object pose via the (mean) angle to ground of the diagonal line of the class-relevant bounding boxes, in degree.
That is, a value of 45^∘ corresponds to a square bounding box. Values close to 90^∘ indicate very slim and tall objects, while values close to 0^∘ identify images with very flat or wide objects.

Next to those intuitively expectable features, we add the features identified by SpRAy to our analysis, the “copyright tag” and “hurdle”.
We arrange the test samples for class “horse” into three groups: One group is comprised of all samples without the considered feature.
A second group is comprised of only those samples showing the feature.
The last group combines both former groups and presents the mixture of samples as present in the test dataset.

We then measure the AP score[
In contrast to the carefully controlled evaluation setting of <cit.>, the class populations of the Pascal VOC setting are highly imbalanced.
We therefore choose to report our results in Average Precision <cit.> (AP), which is in use for model evaluation in the Pascal VOC challenge since 2007 <cit.> and yields more representative measures in highly class-imbalanced object retrieval settings compared to accuracy.
]

for those groups (vs. all non-“horse” test samples) and report the Recall (as detection performance within the groups sorted by feature expressiveness).
Results for both models and all considered features are shown in Figure <ref> and are similar to the ones reported in <cit.> for image-specific and object-specific features:
Both models seem to  prefer reasonably sized samples for the prediction of class “horse” and perform better when bounding boxes are oriented upright (i.e. horses are expected to stand, not lie down on the ground).

However, the copyright tag feature identified earlier clearly is indicative for class “horse” as perceived by the Fisher vector model.
Its presence increases the reported Recall values considerably compared to the absence of the feature, whereas the DNN model is largely unaffected.

The results in Figure <ref> show that SpRAy is able to identify features crucial to the model's decision making, which can not be discovered by comparing (differences in) AP values.



Another interesting observation from that analysis is that seemingly  both models depend on the presence of tourney hurdles.
A closer inspection of the sample sets reveals that the presence of hurdles is indeed correlated with tall and slim object bounding boxes.
By looking at the corresponding relevance maps, we quickly recognize that neither of both features is the reason for the prediction of class “horse” for the DNN model:

Figure <ref> shows images of horses from the group with the tallest bounding boxes, which obtain a perfect Recall value for the DNN model, alongside corresponding relevance maps for both the DNN and FV model.

As identified by SpRAy, the FV model indeed uses the hurdles as feature for predicting class “horse”.
The DNN however is focusing on the horses themselves – photographed  mid-jump in frontal view causing the characteristic bounding box shape – as well as the knees of the rider.
The hurdles themselves, however, are not used for prediction (and thus do not light up in relevance maps and do not form detectable clusters of relevance maps).

Given our results we reason that the above analysis, replicating the execution of the experiment from <cit.>, may be of use as a verification of already identified features relevant to concept recognition.
The analysis <cit.> might however prove insufficient for the identification of features themselves:
There is no guarantee that the effect of (only) the target feature expression is quantified, and not the expression of another correlating but unintended feature.



We further proceed with the spectral and embedding analysis for all classes of the Pascal VOC dataset. For that we compare the spectrum of the first k=5 eigenvalues for input images, FV relevances and DNN relevances in search for classes which are candidates for suspicious samples or learned prediction strategies. Figure <ref> gives an overview over the measured eigenvalue spectra.



We can observe, that the class “horse” appears first in the ranking of FV based eigenvalues, at fourth position for images and position six for DNN based eigenvalues. For the FV model, the first two to three eigenvalues are comparatively low, compared to all other classes in all other settings. The eigenvalue spectra for the majority of classes behave similarly in all settings. That is, λ_2 is significantly larger than λ_1 (which is always 0 in all cases, as expected), with the consecutive distances between the following eigenvalues being approximately equal, which speaks for one single well-connected point cloud without disjoint clusters. When comparing λ_2 in all three settings, we observe its value is gradually rising between neighboring  classes in the ranking order. Between the classes “boat” ranked 2nd and “car” ranked 3rd on the bar plot regarding the FV model, there is a noticeable gap, motivating closer inspection via Figure <ref>.



Image inputs for class “boat” are clustered due to visual similarity and do not show – except for one outlier image showing a sundown scene – unexpected information. The DNN embeddings, together with the relevance plots reveal the locally heterogeneous prediction structure of the DNN, which predicts based on the shape of the shown boats themselves and structures related to boats such as sails. The results for the FV model however reveal one to two weakly connected subclusters besides the main group of samples, with frequently reoccurring relevance structure especially related to true positive predictions (visualized via red aurae). The pattern the FV model has learned to predict on is the water around and below the boats, not the boats themselves. Closer inspection reveals that features from the boats themselves are rated as contradictory information by the FV classifier. We relate the strong reaction of the FV model to water patters to the spatial pyramid mapping scheme <cit.> used in the computation of the FV descriptor <cit.>. The use of spatial pyramid mapping allows models to incorporate a weak sense of global shapes and scene geometry into the optimization process, and is known to improve the prediction performance among Bag of Words type models. Conversely, this method of feature pooling also facilitates the development of spatial biases, which might also have affected class “horse”.

Another class raising further interest is the class “aeroplane”. Here λ_2 ≈λ_3 for the input images already and for the DNN results show an uncharacteristically fast increase in eigenvalues (i.e. there are large gaps between several of the smallest eigenvalues), despite the class being ranked 3rd in Figure <ref>.



Figure <ref> shows that the low 2nd and 3rd eigenvalues for images can be explained by a cluster of samples which t-SNE embeds as the lower left arc in the visualized ℝ^2-coordinates. The cluster contains images of airplanes in flight in front of blue clear sky. The other half of the embedded images show planes on the ground on rollways and in front of airport structures. The DNN relevance maps cluster a subset of images in front of blue sky, but for an entirely different reason, which becomes apparent by inspecting the relevance maps of the small cluster in the top right of Figure <ref>: Relevance maps reveal that the DNN model predicts these samples based on the top and bottom border of the image.

We assume the model has learned to predict based on image information introduced as part of the input preprocessing used for training the multi-label model  for <cit.>: For preparing the Pascal VOC images as inputs for our DNN model from  <cit.>, we scaled down the images to 256 pixels on the longest edge and then padded the image into square shape by copying pixels from the image border, which is a common practice in computer vision. Then, the 227 × 227 sized image center was cropped and used as input for the DNN model.
The relevance maps show, that the DNN model picks up heavily on the border regions (especially top and bottom) introduced during image preprocessing, which reflects in the assigned cluster labels and embeddings in ℝ^2.
Considering the DNN model's weak dependency on context for class “aeroplane” – as measured in Figure <ref> in Section <ref> – suggests that the border artefact detected by SpRAy is occurring consistently, even though the model does not dominantly depend on it for correctly recognizing airplanes.

We can also observe another artifact for the FV model's predictions which becomes apparent from the t-SNE at closer inspection but is not as apparent in the spectrum of eigenvalues. Again, with high probability due to the use of spatial pyramid mapping, the model reacts strongly to uniform and structureless background in the images, but dominantly in the top half of the image and especially in the top left quadrant. The model's reliance on a lack of structure in the background attributes negative relevance to any object occluding the background. The model has learned to generalize the class  “uniform image background” instead of the intended class label “aeroplane”. 




  §.§.§ Verifying the Detected Bias in Prediction behavior

The results obtained with SpRAy in Figure <ref> suggest a previously unknown bias in the decision making of the DNN model, namely that the classifier for class “aeroplane” (as part of the trained multi-label DNN) has learned an image border devoid of structure as a characteristic describing the object class, namely class “airplane”. To further our understanding and to verify our hypothesis of this undesired prediction bias (we wish for the DNN to predict based on the airplane itself) we compare different approaches for obtaining square images as DNN inputs from the Pascal VOC test samples, with examples shown in Figures <ref> and <ref>:

copy border: Image padding by copying pixel values from the image border, as it is performed in the current image prediction pipeline.

mirror: Mirror padding, which extends the image as needed by copying image content and may add natural structures to the image border already present in the image.

crop: Cropping of the largest possible centered image patch, which removes image content from the border and enlarges structures from the image center relatively.

sky blue color: Padding with sky-blue color sampled from a test image, uniformly applied to the padded image area.

random color: Padding with a random color, uniformly applied to the padded image area.

random noise: Padding with random pixel values, adding non-uniform random structure of high frequency to the image border.


We hypothesize, that the model has learned to expect uniformly colored image borders for samples belonging to class “aeroplane”. We verify that hypothesis in Figure <ref> (left), which shows that any processing resulting in a square image besides the copying of border pixels will result in a decrease airplaneness of the sample. Mirror padding can e.g. repeat the structure of clouds and cropping will altogether remove border information and move structures from the image center to the (new) image border.



Extending with random pixel values adds high frequency content to the image border, which directly contradicts what the model has learned, resulting in the highest measurable decrease in  the predictor output across all image processing approaches. This approach also reliably removes the artifact of positive prediction contribution of the image border as observable in Figure <ref>. While the overall prediction scores for noise-affected samples declines drastically, the center of the relevance maps, showing the actual images, remain almost the same.

Our experiment shows that padding the images with random yet per image constant color value results in a lower decrease of the predictor output compared to random noise. This further verifies that the model expects the absence of structure-rich information. Setting the border color to a sky-blue hue (as taken from test images) reduces the decrease of f() to an lower extent than for cropping and a considerably lower extent than padding with randomly colors. For both examples in Figure <ref>, padding with sky-blue color even (marginally) increases the predictor output compared to baseline (copy border) and enhances or even causes the strong appearance of the observed border artifact, despite not matching the natural image background color. Further, we observe that the model reacts strongly to transitions between two uniformly colored image areas for both padding variants adding uniformly colored areas, as shown in Figure <ref>. This raises further questions about the influence of padding choices of the pre-training phase on ImageNet.



We conduct a second experiment to verify our hypothesis at hand of all test  images not being labelled as “aeroplane” and apply the same padding approaches (See Figure <ref> for examples). We provide those sample images as input to the DNN and observe the effect on the model output corresponding to the prediction of airplanes. The results are shown in Figure <ref> (right) verify again that introducing structure (which is with a certain likelihood much stronger for non-“aeroplane” images) to the border regions of the image (mirror and crop, random noise) reduce the airplaneness of the inputs further, while padding with (a fitting) constant color results in a comparatively high increase in the prediction score.



The relevance maps in Figure <ref> show that positive relevance is strongest on the top and bottom borders of the image, while the left and right image borders only receive weak relevance attribution for aeroplane images. This classifier reaction makes sense intuitively, since photographing an object in the sky likely removes objects located on or near the ground (e.g. roof tops), due to the camera's tilt along the vertical axis.

We further investigate and subdivide all non-“aeroplane” images into images which require vertical padding (landscape format, ≈ 3800 images) and images which require horizontal padding (portrait format, ≈ 900 images). The results in Figure <ref> show that padding the horizontal axis (Figure <ref> (right)) has on average less of an effect to the increase of airplaneness via constant border padding compared to padding of the vertical axis (Figure <ref> (left)).



We can conclude that the DNN has learned to detect airplanes in part based on uniform image areas of constant (sky-like) color at the top and bottom of the image. Using that model as a predictor for airplanes outside of laboratory settings might cause high rates of false positive predictions when observing the sky with a camera system and feeding the image input to the model. With SpRAy, we have pin-pointed that previously unknown artifact in the model's prediction behavior. Future iterations of the model, its training data and preprocessing choices could thus be adapted accordingly to avoid predictions of aeroplanes based on very low frequency image borders.




 §.§ Spectral Relevance Analysis on Atari Gameplay Sequences

In Section <ref> we could observe DNNs play the Atari 2600 games “Breakout” and “Video Pinball”. Clearly, for each of the observed games, the respective DNN agent has transitioned through several strategic phases of gameplay. We expect that these observed phases can be detected with the SpRAy algorithm over the duration of a recorded game in the DNNs relevance responses and thus repeat the spectral relevance analysis process from Section <ref> with the Atari gameplay data from Section <ref> for both the Atari 2600 games “Breakout” and “Video Pinball” as shown in Figure <ref>. That is, we first record sessions of the trained DNNs playing both games for ≈ 95 seconds and extract the frames rendered by the Atari emulator, as well as the relevance maps computed for the actions taken by the DNN. Then we apply SpRAy to that data. Figure <ref> presents the eigenvalue spectra computed for relevance maps and recorded video frames for both games.



Other than for the experiments based on Pascal VOC, the eigenvalue spectra in Figure <ref> show a series of eigenvalues close to zero for the set of frames, indicating a strong fragmentation of the input space into many smaller clusters. As expected, the eigenvalue spectra computed over the relevance values corresponding to each game frame show fewer and more distinctive groupings of samples. For the game “Breakout”, two eigenvalues are close to zero, followed by two comparatively large eigengaps. The analysis of the sequence of “Video Pinball” gameplay reveals three eigenvalues very close to zero, followed by a smaller, yet still distinct eigengap. Both sets of results pronounce many smaller clusters of samples in the input space of game frames (points in time)  and fewer larger clusters among the relevance maps.



The clusters in the relevance maps in Figure <ref> together with the color-coded temporal progression of the gameplay Figure <ref> confirm our assumption. Relevance maps are grouped in two to three distinct clusters, covering different phases in gameplay. We can clearly identify important gameplay phases the DNN agent progresses through throughout the recorded sequence of game states. The largest homogeneously connected main group of embedded relevance maps covers an early game phase where the wall of bricks is mostly intact (Figure <ref>: t≤300). A second, smaller and clearly disconnected cluster contains time points from the final stages of the game (Figure <ref>: t≥850) when the playing DNN has created the tunnel and was able to maneuver the ball above the wall of bricks, quickly increasing the score counter.

The cluster structure for the input frames show a much higher number of dense groups of samples, dominantly grouped via temporal segments (visible in cluster assignments and t-SNE) of the game. With ongoing progression of the recorded game session the top row of bricks is eroded ongoingly. Next to the fast moving ball and paddle elements this provides a slowly changing connection between points in time for the video frames.

For the game “Video Pinball” the relative size of the eigengap in Figure <ref> is not as noticable as for “Breakout”, but three main clusters can clearly be identified for the analyzed relevance maps. The (two to) three main clusters can also clearly be identified in the t-SNE plots in Figure <ref>. Again, both the assigned cluster labels and groups formed identified via t-SNE correlate with the temporal progression of the game for images as well as inputs, albeit the identification of fewer larger groups corresponding to game time intervals is more clear for the analyzed relevance maps. Again, the video frame based analysis makes use of the change (and similarity) in ball position and the state of the game screen itself. The relevance maps computed during gameplay effectively act as filters for momentarily important game areas and thus lead to a more coherent temporal groupings in the embedding space.

The first main cluster found when analyzing the relevance maps computed for the model's preferred actions (i.e. maximally firing network outputs) during gameplay corresponds to the early stages of the game, where the DNN spends ≈ 30%  of the recorded time. Here, the model makes efforts positioning the ball near the top right game element (Figure <ref>: t ≤ 225), before passing through exactly four times to gain an extra ball. In this phase, most relevance is attributed to the ball, as well as the targeted top right area of the screen, where the model aims to move the ball.

Then, after having the ball pass the top right game element exactly four times, the playing DNN moves the ball to the left of the playing field, where it tries to move the ball as often as possible through the top left game element. This repeated up and down movement results in the second and third clusters (high ball position vs. low ball position, relevance allocated accordingly) (Figure <ref>: 500 ≤ t ≤ 800) and explains the convoluted temporal structure within this cluster of samples. The model spends about 50% of the recorded game time in that phase.

The DNN eventually makes a mistake and the ball ricochets away from the top left game element. The model re-enters the first stage of game play where it has to re-gain control over the ball to position it advantageously in the game field (Figure <ref>: t ≥ 880).



Our results from Figures <ref> and <ref> demonstrate that with SpRAY, relevance maps can be used to identify and isolate important temporal phases in time series data which are not as clearly recognizable from the model's input data directly.




 §.§ Concluding Remarks on Spectral Relevance Analysis

SpRAy enables researchers and machine learning engineers to understand the classifier's prediction strategy in detail and in only a matter of seconds, closing the gap between one-dimensional performance measures over test datasets – such as accuracy and loss ratings – and the manual assessment of explanation heatmaps for single predictions. With the help of relevance inputs generated with LRP, spectral analysis reveals the composition of selected sample sets in terms of different applied prediction strategies, e.g. whether a model's predictions are heterogeneous across all samples or show suspicious or artifactual behavior, using unintended or surprising information. The complementary embeddings computed via t-SNE – a non-linear technique related to spectral clustering – aid in the presentation of the spectral analysis in a human-interpretable manner. Our work presents a comparative analysis of the eigenvalue spectra of all object categories of the Pascal VOC 2007 test set – a widely used benchmark dataset in computer vision – which points out issues with the composition of some classes on their own and in combination with choices made regarding the model architecture and preprocessing steps for both the investigated FV and the DNN predictor. 

We found a systematic bias in the prediction strategies of the FV model for classes “boat”, “horse” and “aeroplane” connected to the spatial pyramid mapping scheme employed to profit from global shape and geometry information. Regarding the DNN model, our pipeline has helped with the identification of a previously unknown issue caused by the preprocessing of the network inputs, which can thus be rectified in the model's next iteration in the development cycle. Our work proposes an initial application of relevance maps as features for detailed model analysis, focussing on the strategies as  applied by a trained model and as revealed by a meaningful set of explanation heatmaps. 

Applied to recorded gameplay sequences of the Atari 2600 games “Breakout” and “Video Pinball” as data with a strong temporal aspect, SpRAy was able to find and isolate important gameplay phases on relevance data observed earlier manually which was not as transparently available from the recorded game frames when used input to the analysis.

For future work, we see much potential in the diverse applicability of SpRAy. The choice of explanation method is not limited to LRP and may be used to direct the semantics of the analysis. A first preprocessing choice has been a simple sum pooling algorithm for aggregating relevance onto a smaller grid of values, which preserves the locality of the relevance responses in a robust manner. Different choices for preprocessing will guide the focus onto specific aspects within the heatmap, e.g. incorporating an interpolation component could act as a low pass filter and revealing different structures in the explanation. Applying Fourier transforms on the relevance maps in order to operate in the frequency domain instead of the pixel space is another promising alternative for preprocessing.

naturemag


