# Comparing Approaches for Explaining DNN-Based Facial Expression Classifications
## 3 Proposed Method
### Geometric Features-Based DNN Modeling
#### 3.1.2 SHAP-Based Explanation Generation  
After the DNN has been constructed and trained on the data, we can generate explanations for its decisions. We do so using SHAP. For each image, the SHAP value of each feature is calculated. Next, we take the \(n\) features with the highest absolute value, i.e., the most important features. Each of those geometric features corresponds to several landmarks the feature was originally calculated from and with those, the geometric features can be plotted on the face. Since we have different types of geometric features, we end up with features that are displayed as a line, an angle, an ellipse, or aspect ratio. See Figure 2 for examples on how geometric features of different types are visualized. The features are coloured according to their SHAP value from yellow to red, with the more red the colour, the more important the feature was for the model's decision.  
Accompanying these visualizations, we generate textual explanations. In these texts, we mention what the model's prediction for the image is and whether that is correct. If the prediction is incorrect, the true label is given. Furthermore, we list the names of the features that are plotted on the face in order of their importance. The sum of the SHAP values of the displayed features is calculated as a percentage of the sum of the SHAP values of all features and reported in the textual explanation.  
Figure 2: Examples of how geometric features are displayed based on the landmarks they originate from. From left to right, top to bottom, the geometric features displayed are: lower eye outer angles (L), eye aspect ratio (R), bottom lip curvature, outer mid eyebrow slope (L), eye—inner eyebrow distance (L), mouth opening/mouth width.  
We evaluate this method quantitatively by calculating both its _fidelity_ and _explanation accuracy_. The fidelity is calculated by constructing new data points where only the top \(n\) features keep their original values and all other features are set to the training set average value for that feature (note that in case of feature value standardization, this value can be zero; note also that this is the way model-agnostic SHAP handles the missing attributes). We then let the model predict the class for this newly created data point and compare this to the model's prediction of the original data point. The percentage of predictions that stay the same as the original prediction is the fidelity score.  
The _explanation accuracy_ score is calculated in a similar fashion, only now the new predictions are not evaluated against the model's original prediction, but against the ground truth. Note that this is a distinct measure from the model's accuracy, which is simply the percentage of correctly classified examples. To avoid confusion, the accuracy measure for explanations shall be called the \"explanation accuracy\" from this point onward. Furthermore, we calculate the relative cumulative SHAP weight for the top \(n\) features by dividing the sum of the SHAP values of those features by the sum of all features' SHAP values. A plot of the aforementioned measures helps the analysis of fidelity convergence.