# A Review of Explainable Deep Learning Cancer Detection Models in Medical Imaging
## 3 Explanation Methods for Deep Learning Cancer Detection Models
### Post-Hoc  
A majority of deep learning cancer detection models utilize post-hoc methodologies due to their ease of implementation. Post-hoc methods can be used to analyze the learned features of the model and to diagnose overfitting. This provides a feedback loop for the researcher and allows them to improve the model. It also shows the discriminative areas of the image. This section will review recent studies that apply post-hoc explanation methods to breast cancer, prostate cancer, lung cancer, brain cancer, and liver cancer. The predecessor for post-hoc techniques such as Respond-CAM, Pyramid-CAM, Grad-CAM, Grad-CAM+, and Grad-CAM++ is class activation maps (CAM) which generates a heatmap using global average pooling. In [99] the method shows the region of the image used the identity the label by outputting the spatial average of the feature maps of each unit at the last layer. It was tested as weakly supervised segmentation on the ILSVRC dataset with a top 5 error rate of 37.1 percent which is only 3 percent away from the top score. CAM is formally defined as the following. Let \(f_{k}(x,y)\) represent the activation of unit k in the last convolutional layer at spatial location \((x,y)\). The result of performing global average pooling is \(F_{k}=\sum_{x,y}f_{k}(x,y)\) therefore for a given class, c, the input to the softmax, \(S_{c}\) is \(\sum_{k}w_{k}^{c}F_{k}\) where \(w_{k}^{c}\) is the weight corresponding to class c for unit k. Essentially, \(w_{k}^{c}\) indicates the importance of \(F_{k}\) for class c. Finally the output of the softmax for class c, \(P_{c}\) is given by \(\frac{exp(S_{c})}{\sum exp(S_{c})}\) by plugging \(F_{k}=\sum_{x,y}f_{k}(x,y)\) into the class score, \(S_{c}\), we obtain  
\[S_{c}=\sum_{k}w_{k}^{c}\sum_{x,y}f_{k}(x,y)=\sum_{x,y}\sum_{k}w_{k}^{c}f_{k}(x,y) \tag{1}\]The authors define \(M_{c}\) as the class activation map for class c, where each spatial element is given by  
\[M_{c}(x,y)=\sum_{k}w_{k}^{c}f_{k}(x,y) \tag{2}\]  
A further developed version of CAM is Grad-CAM. In [84], Grad-CAM calculates the gradients of the class score with respect to the activation of the feature maps which are globally average pooled over the width and height dimensions. This is followed by a weighted combination which is passed through a ReLU function. This works best with the final layer because of the larger receptive field compared to the beginning layers. It was evaluated using the ImageNet localization challenge and outperforms CAM with a top-5 error of 10.89 percent. It achieves an IoU score of 49.6 percent on the PASCAL VOC 2012 segmentation data set. They also used a human study and found Grad-CAM outperforms guided backpropagation by 16.79 percent. In order to obtain the class-discriminative localization map Grad-CAM \(L_{Grad-CAM}^{c}\in\mathbb{R}^{u\times v}\) of width \(u\) and height \(v\) for any class \(c\), we first compute the gradient of the score for class \(c\), \(y^{c}\) (before the softmax), with respect to feature map activations \(A_{k}\) of a convolutional layer, i.e., \(\frac{\partial y^{c}}{\partial A_{k}}\). These gradients flowing back are global-average-pooled over the width and height dimensions (indexed by i and j respectively) to obtain the neuron importance weights \(a_{k}^{c}\) :  
\[a_{k}^{c}=\frac{1}{Z}\sum_{i}\sum_{j}\frac{\partial y^{c}}{\partial A_{k}} \tag{3}\]  
During computation of \(a_{k}^{c}\) while backpropagating gradients with respect to activations, the exact computation amounts to successive matrix products of the weight matrices and the gradient with respect to activation functions till the final convolution layer that the gradients are being propagated to. Hence, this weight \(a_{k}^{c}\) represents a partial linearization of the deep network downstream from \(A\), and captures the importance of feature map \(k\) for a target class \(c\).