# TorchEsegeta: Framework for Interpretability and Explainability of Image-Based Deep Learning Models
## 2 Methods
### Implemented Interpretability Techniques
#### 2.2.2 Layer Attribution Techniques  
Layer attribution methods evaluate the effect of each individual neuron in a particular layer on the model output. There are various types of layer attribution methods that have been explored as part of this research work. Perturbation-based approaches [19] perturb the original input and observe the change in the prediction of the model, and they are highly time-consuming. 1. _Inverted Representation_--The aim of this technique is to generate the given input image after a number of n target layers. An inverse of the given input image representation is computed [28] in order to find an image \(\Phi(x_{0})\) whose representation best matches the input image \(\Phi_{0}\) while minimising the given loss l such that \[x^{*}=\operatorname*{arg\,min}_{x\in\mathbb{R}^{H\times W\times C}}l(\Phi(x), \Phi_{0})+\lambda R(x).\] (9)
2. _Layer Activation with Guided Backpropagation_--This method [21] is quite similar to guided backpropagation, but instead of guiding the signal from the last layer and a specific target, it guides the signal from a specific layer and filter. The guided backpropagation method adds an additional guidance signal from the higher layers to the usual backpropagation. 3. _Layer DeepLift_--This is the DeepLift method as mentioned in the model attribution techniques [13] but applied with respect to the particular hidden layer in question. 4. _Layer DeepLiftShap_--This method is similar to the DeepLIFT SHAP technique mentioned in the model attribution techniques [13], which was applied for a particular layer. The original distribution of baselines is taken, the attribution for each input-baseline pair is calculated using the Layer DeepLIFT method, and the resulting attributions are averages per input example. Assuming model linearity, \(\phi(f_{3},y)\approx m_{y}i\). 5. _Layer GradCam_--The GradCam attribution for a given layer is provided by this method [25]. The target output's gradients are computed concerning the particularly given layer. The resultant gradients are averaged for each output channel (dimension 2 of output). Then, the average gradient for each channel is multiplied by the layer activations. Then, the results are added over all the channels. For the class feature weights w, global average pooling is performed over the feature maps A such that \[S^{c}=\sum_{k}u_{k}^{c}\frac{1}{Z}\sum_{i}\sum_{j}A_{ij}^{k}.\] (10)
6. _Layer GradientShap_--This is analogous with the GradientSHAP [13] method as mentioned in the model attribution techniques but applied for a particular layer. Layer GradientSHAP adds Gaussian noise to each input sample multiple times, wherein a random point along the path between the baseline and input is selected, and the gradient of the output with respect to the identified layer is computed. The final SHAPvalues approximate the expected value of gradients \(*\) (layer activation of inputs \(-\) layer activation of baselines). 7. _Layer Conductance_--This method [29] provides the conductance of all neurons of a particular hidden layer. Conductance of a particular hidden unit refers to the flow of Integrated Gradients attribution through this hidden unit. The main idea behind using this method is to decompose the computation of the Integrated Gradients via the chain rule. One property that this method of conductance satisfies is that of completeness. Completeness means that the conductances of a particular layer add up to the prediction difference of \(\mathrm{F}(\mathrm{x})-\mathrm{F}(x^{\prime})\) for input \(\mathrm{x}\) and baseline input \(x^{\prime}\). Other properties that are satisfied by this method are those of Linearity and insensitivity. 8. _Internal Influence_--This method calculates the contribution of a layer to the final prediction of the model by integrating the gradients with respect to the particular layer under observation.