Clustering-Based Interpretation of Deep ReLU Network

Amongst others, the adoption of Rectified Linear Units (ReLUs) is regarded as one of the ingredients of the success of deep learning. ReLU activation has been shown to mitigate the vanishing gradient issue, to encourage sparsity in the learned parameters, and to allow for efficient backpropagation. In this paper, we recognize that the non-linear behavior of the ReLU function gives rise to a natural clustering when the pattern of active neurons is considered. This observation helps to deepen the learning mechanism of the network; in fact, we demonstrate that, within each cluster, the network can be fully represented as an affine map. The consequence is that we are able to recover an explanation, in the form of feature importance, for the predictions done by the network to the instances belonging to the cluster. Therefore, the methodology we propose is able to increase the level of interpretability of a fully connected feedforward ReLU neural network, downstream from the fitting phase of the model, without altering the structure of the network. A simulation study and the empirical application to the Titanic dataset, show the capability of the method to bridge the gap between the algorithm optimization and the human understandability of the black box deep ReLU networks.


Introduction
The "black box" nature of deep neural network models is often a limit for highstakes applications like diagnostic techniques, autonomous guide etc. since the reliability of the model predictions can be affected by the incompleteness in the optimization problem formalization [1]. Recent works have shown that an adequate level of interpretability could enforce the neural network trustworthiness (see [2]). However, this is generally difficult to achieve without alter the mechanism of deep learning [3]. The topic has became particularly relevant in the last decades, since technology development and data availability led to the adoption of more and more complex models, and widened the gap between performances on train/test data and interpretability.
Much work has been done in order to explain and interpret the models developed by AI in a human comprehensible manner. The main reason behind these effort is that the human experience and capacity for abstraction allow to monitor the process of the model decisions in a sound way, trying to mitigate the risks of data-driven models. On the other hand, the recent developments of deep neural networks offer enormous progress in artificial intelligence in various sectors. In particular, the ReLU functions have been shown to mitigate the vanishing gradient issue, encourage sparsity in the learned parameters and allow for efficient backpropagation.
In this paper, we tackle the explainability problem of deep ReLU networks, by characterizing the natural predisposition of the network to partition the input dataset in different clusters. The direct consequence of the clustering process is that, within each cluster, the network can be simplified and represented as an affine map. Surprisingly, the deep network provides a notion of cluster-specific importance for each feature, thus easier to interpret.

Bibliographic review
Despite the benefits and the expressiveness of Rectifier Networks have been widely investigated, e.g. in [4], the cluster analysis and the consequent interpretability of the networks via the modelling of the pattern of active neurons has not been discussed in the literature, to our knowledge.
On the other hand, many model-specific methodologies can be applied for gaining interpretability in neural network models (see [5] and [6] for a review). The importance of a feature is one of the most used strategies to gain local explainability from an opaque machine learning model. Permutation feature importance methods evaluate the feature importance through the variation of a loss metric by permuting the feature's values on a set of instances in the training or validation set. The approach is introduced for random forest in [7] and for neural network in [8]. Other methods, such as class model visualization [9], compute the partial derivative of the score function with respect to the input, and [10] introduces expert distribution for the input giving activation maximization. In [11] the author introduces deep lift and computes the discrete gradients with respect to a baseline point, by backpropagating the scoring difference through each unit. Integrated gradients [12] cumulates the gradients with respect to inputs along the path from a given baseline to the instance. Finally, a set of well known methods called additive feature attribution methods defined in [13], rely on the redistribution of the predicted valuef (x) over the input features. They are designed to mimic the behaviour of a predictive functionf with a surrogate Boolean linear function g.
Let us denote by W i , i ∈ [1, . . . , p] the weight matrices associated with the p layers of a given multilayer network with predictorf (of a q-dim target variable) and collect 4Ŵ i inŴ = [Ŵ 1 , . . . ,Ŵ p ]. For any input u ∈ R d , the initial Directed Acyclic Graph (DAG) G of the deep network is reduced to G u which only keeps the units corresponding to active neurons 5 and the corresponding arcs. This DAG is clearly associated with a given set of weightsŴ . We can formally state this pruning for the given neural network, characterized by G, paired with input u with weightsŴ by where, since all neurons operate in "linear regime" (affine functions), as stated in the following, the output, the composition of affine functions, is in fact an affine function itself.
and assume that Y i is chosen in such a way that ∀i = 1, . . . , p − 1 : being W p+1 := .
Proof. The proof is given by induction on p.
-Basis: For p = 1 we havef = W 1 u + b 1 and Ω(1) = W 1 which confirms (2), and when considering W 2 := , we have in according to (3). 4 Theˆin the notation means that the bias term is incorporated in the variable. 5 A neuron is considered active for a particular pattern if the input falls in the right linear part of the domain's function. 6 We stress the dependence of Ω and b from the number of layer (p) since it will be useful for the proof.
-Induction step: By induction, a network with p − 1 layers is defined by an affine transformation that is Hence Now let U ⊂ R d the input space. The given deep net yields a partition on U which is associated with the following equivalence relation: . We denote 7 by [u] ∼ = {v ∈ U : v ∼ u} and by U / ∼ the corresponding quotient set. Hence, [u] ∼ is the equivalent class associated with representer u which, in turn, corresponds with G u . Notice that, as a consequence, [u] ∼ is fully defined by the set of neurons of the active neural network.
Feature Importance Explanation The characterization done above allows to assigning a matrixΩ to each cluster of the network. In this way, the matrix is able to represent the network for the patterns of the specific cluster as an affine map.
For simplicity, if we consider a problem where the output of the network is scalar, the matrix Ω reduces to a d-dimensional effective vector ω whose components can be interpreted as the feature importance of the cluster's solution.

Simulation study
In this section, we report the simulation studies carried out on the ReLU network architecture applied to a Boolean artificial dataset, in order to assess the power of the clustering-based interpretation.
We consider a set of 10 Boolean feature variables v i∈[1,...,10] . The first 3 features determine the target variable through the following relation: whereas the other 7 features introduce noise. The rationale of the formula is that the feature v 3 split the data set in two groups (v 3 and ¬v 3 ), each ruled by a different term of the Boolean formula involving either v 1 or v 2 respectively. In the following, we investigate whether the network clustering is able to recognize the different terms of the formula.
We simulated 100, 000 samples, and we exploited a two-hidden-layer Multilayer Perceptron (MLP) with 4 and 2 neurons characterized by ReLU activation function and an output neuron with a sigmoid activation function. The cross-entropy loss is minimized via the Adam stochastic optimizer with a step size of 0.01 for 10 epochs, and a batch size of 100. An activity regularizer with 0.02 is added to the empirical loss. At the end of the training, the network solves the problem with an accuracy of 100%. The experiments are implemented with Keras in the Python environment on a regular CPU.
The analysis of the network, by considering the possible patterns of the active neurons, originates three clusters.

A trivial cluster characterized by all non-active neurons including all the
patterns predicted as 0.
Instead, the other two clusters activate the two neurons of the last layer but a different neuron of the first hidden layer. In figure 1 we report the table resuming the 8 possibilities of the Boolean function restricted to the first 3 features, as well as the bar plot for the importance of the features for the two non-trivial clusters. As explained above, the importance of the feature is computed by the coefficients of the effective vector for that cluster.
2. The second cluster, represented by the blue bars in Fig. 1, includes patterns predicted as 1 and characterized either by v 1 = v 2 = v 3 = 1 or by v 1 = 1, v 2 = 0, v 3 = 1. We can argue that this cluster takes in charge the patterns predicted as 1 due to the first term of Eq. (5), i.e. v 1 ∧ v 3 . Coherently with this setting, the feature importance given by the effective vector is zero for the feature v 2 that does not appear in the first term of Eq. (5). On the other side, the coefficient of the effective vector is positive for the feature v 1 . 3. In a similar way, the third cluster denoted with the orange color, represents the term v 2 ∧ ¬v 3 of Eq. (5) since the patterns belonging to it are predicted as 1 and are characterized either by v 1 = v 2 = 1 v 3 = 0 or by v 1 = 0 , v 2 = 1 , v 3 = 0. As expected, the feature importance of v 1 is zero, whereas for v 2 the feature importance is positive. From the simulation study, we note that the clustering-based interpretation of the ReLU network helps to achieve a more profound understanding of the solution meaning. In particular, the methodology tries to disentangle the complexity of the solutions into a set of more comprehensible linear solutions within a specific cluster.
As a further confirmation of the usefulness of cluster-based interpretation, when the activity regularizer is removed, the network keeps solving the task giving rise to 8 clusters, each one specific for each combination of the first three features. Based on the cluster interpretation, we conclude that the network has chosen a less abstract way to solve the problem.

Titanic dataset
In this section, we report the experimental analysis performed on the well-known Titanic dataset 8 . Each sample represents a passenger with specific features, and the binary target variable indicates if the person survived the Titanic disaster.
Standard data cleaning and feature selection procedures 9 are implemented. In Table 1 we report a brief description of the features. Similar to the previous experiment, we exploit an MLP with two hidden layers (4 and 2 neurons) characterized by ReLU activation function and an output neuron with a sigmoid activation function. The cross-entropy loss is minimized via the Adam stochastic optimizer with a step size of 0.01 for 10 epochs and a batch size of 100. An activity regularizer with 0.02 is added to the empirical loss. The experiments are implemented with Keras in the Python environment. The code is freely available at https://github.com/nicolapicchiotti/relu_ nn_clustering.
The accuracy of the network is 77% (see [14]) and the study of the active neurons patterns provides a partition of the dataset into three clusters, whose feature importance is shown in Figure 2.
(a) The first cluster a) includes passengers with mixed features and a percentage of survived ones equal to 38%. As expected from the univariate exploratory analyses, gender and class had the most significant relationship for survival rate. (b) The cluster b) instead, includes only males belonging to the third class (4% of the overall): the prediction for these passengers is always 0. This cluster confirms the expectation on the male gender and third class as relevant features for not survive. We observe that the feature importance is quite similar to the one of cluster a) except for the fact that the "age" feature assumes slightly more relevance. Finally, (c) in the cluster c) the passengers are females and belonging to the first class (16% of the overall), the predicted value is always 1. The feature importance, in this case, shows that the high value of the title, age, and the other features contribute to survival, in addition to being female. This cluster helps us to understand the solution provided by the network. For instance, we note that the "age" feature has an opposite behavior with respect to the other two clusters: in this cluster the older the women, the higher the survival probability.
In this experiment, we have shown that the ReLU network can be disentangled into a set of clusters that can be analyzed individually. The clusters have a practical meaning helping the human to interpret the mechanism of prediction of the network.

Conclusions and Limitations
This paper proposes a methodology for increasing the level of interpretability of a fully connected feedforward neural network with ReLU activation functions, downstream from the fitting phase of the model. It is worth noting that the methodology does not alter neither the structure nor the performance of the network and can be applied easily after the training of the model. The methodology relies on the clustering that naturally arises from the binary status of the different neurons of the network, in turns, related to the non-linearity of the ReLU function. The existence of a feature importance explanation based on a affine map for each cluster is proved. A simulation study and the empirical application to the Titanic dataset show the capability of the method to bridge the gap between the algorithm optimization and the human understandability.
A possible limitation of the work is related to the potential high number of clusters that the networks could generates. Further ways should be explored in order to grant a parsimonious principle of the dataset partition process, such as a principle of minimum entropy or the orthogonality of the hyperplanes representing the clusters. Finally, it is worth mentioning that, if the input variables are highly correlated or belong to a very high-dimensional spaces, the weights of the affine map cannot be trivially interpreted as the features importance, see for instance [15].