# TorchEsegeta: Framework for Interpretability and Explainability of Image-Based Deep Learning Models
## 2 Methods
### Implemented Interpretability Techniques
#### 2.2.1 Model Attribution Techniques
Given a convolutional layer 1, class c, number of channels k, and activations A:  
\[L^{c}_{Score-CAM}=ReLU(\sum_{k}\alpha^{c}_{k}A^{k}_{l}). \tag{3}\]  
Gradient-Based Techniques  
This group of methods mainly use the model's parameter space to generate the attribute maps, which are calculated with the help of the gradients. 1. _Saliency_--It was initially designed for visualising the image classification done by convolutional networks and the saliency map for a specific image [20]. It is used to check the influence of each pixel of the input image in assigning a final class score to the image \(I\) using the linear score model \(S_{c}(I)=w^{T}_{c}I+b_{c}\) for weight w and bias b. 2. _Guided Backpropagation_--In this approach, during the backpropagation, the gradients of the outputs are computed with respect to the inputs [21]. The RELU activation function is applied to the input gradients, and direct backpropagation is performed, ensuring that the backpropagation of non-negative gradients does not occur. 3. _Deconvolution_--This approach is similar to the guided backpropagation approach wherein it applies RELU to the output gradients instead of the input gradients and performs direct backpropagation [17]. Similarly, RELU backpropagation is overridden to allow only non-negative gradients to be backpropagated. 4. _Input X Gradient_--It extends the saliency approach such that the contribution of each input to the final prediction is checked by multiplying the gradients of outputs and their corresponding inputs in a setting of a system of linear equations AX = B where A is the gradient and B is the calculated final contribution of input X [22]. 5. _Integrated Gradients_--This technique [23] calculates the path integral of the gradients along the straight line path from the baseline \(x^{\prime}\) to the input x. It satisfies the axioms of Completeness i.e., the attributions must account for the difference in output for the baseline \(x^{\prime}\) and input x, Sensitivity--i.e., a non-zero attribution must be provided even to inputs that flatten the prediction function where the input differs from the baseline--and Implementation Invariance of gradients--i.e., two functionally equivalent networks must have identical feature attributions. It requires no instrumentation of the deep neural network for its application. All the gradients along the straight line path from \(x^{\prime}\) to \(x\) are integrated along the \(i\)th dimension as: \[IG_{i}(x)::=(x_{i}-x_{i}^{\prime})\times\int_{\alpha=0}^{1}\frac{\partial F(x^{ \prime}+\alpha\times(x-x^{\prime}))}{\partial x_{i}}d\alpha.\] (4) _Grad Times Image_--In this technique [22], the gradients are multiplied with the image itself. It is a predecessor of the DeepLift method, as the activation of each neuron for a given input is compared to its reference activation, and contribution scores are assigned according to the difference for each neuron. _DeepLift_--It is a method [24] that considers not only the positive but also the negative contribution scores of each neuron based on its activation concerning its reference activation. The difference in the output of the activation function of the neuron t under observation is calculated based on the difference in input with respect to a reference input. Contribution scores for each of the preceding neurons \(x_{1},\dots,x_{n}\) that influence t are assigned \(C_{\triangle x_{i\triangle t}}\), which sums up to the difference in t's activation: \[\sum_{i=1}^{n}C_{\triangle x_{i\triangle t}}=\triangle t.\] (5) _DeepLiftShap_--This method extends the DeepLift method and computes the SHAP values on an equivalent, linear approximation of the model [13]. It assumes the independence of input features. For model f, the effective linearization from SHAP for each component is computed as: \[\phi_{i}(f_{3},y)\approx m_{y_{i}f_{3}}(y_{i}-E[y_{i}]).\] (6) _GradientShap_--This technique also assumes the independence of the inputs and computes the game-theoretic SHAP values of the gradients on the linear approximation of the model [13].