# Contextual Explanations for Decision Support in Predictive Maintenance
## 4 Experiments
### Results
#### 4.3.1 Basic Representation
Figure 3 presents the global context for the most important attribute (C) according to the SHAP-based explanation and the second most important attribute (D). The figures presenting global context contain a scatter plot of all the attribute importance values calculated for the preceding examples of the alarm class. Moreover, there is a line in the figure representing the smoothed mean of the plotted values to support interpretation of the data characteristics. The mean value for the example \(y_{i}\) was determined as follows:  
\[\overline{y}_{i}=\frac{1}{l-k+1}\sum_{j=k}^{l}y_{j}, \tag{1}\]  
where \(k=max(1,i-\frac{w}{2})\), \(l=min(n,i+\frac{w}{2})\), \(n\) is the number of data examples forming the context and visualisation, \(w=\lfloor\frac{a,n}{2}\rfloor\cdot 2\) is a smoothing window size, and \(\alpha\) is a parameter defining the size of the smoothing window and it was set to 0.1. Additionally, each scatter plot has a rug plot on the \(x\) axis illustrating the density of the identified alarms. The basic results presented in Figure 3 are the SHAP-based explanations consisting of the attribute rankings presented in Figure 3A. Case 1 represents the outlier identified during the correct machine operation; therefore, for Case 1, Figure 3A does not allow any conclusions to be drawn with regard to supporting the identification of the pre-failure state of the machine. The analyses of the next two cases can be performed regarding data characteristics presented in Section 4.1. They showed that the values measured by sensor C123 may carry important information about the impending Failure 1 and the values measured by sensor C122 may carry important information about the impending Failure 2. The explanation of Case 2 presented in Figure 3A shows that vibrations measured by sensor C123 were among the most important for the decision of the model, whereas the explanation of Case 3 presented in Figure 3A shows that vibrations measured by sensor C122 were the most important. Thus, the SHAP-based explanations are consistent with conclusions based on the distribution of data and can support decision-making. The local context (Figure 3B) shown for each explanation is consistent, i.e., the attribute importance rankings are similar for the alarms reported most recently. This means that the _alarm_ class definition is consistent for the recent examples. The results show that the global context presented in Figure 3C,D for the most significant attributes provides valuable additional information. For Case 1, this context consists of relatively few examples and the plot they create does not illustrate any clear trend. For Case 2 and Case 3, the context in Figure 3C,D shows a clear change in SHAP-determined attribute importance. This change means that the characteristics of the class whose examples were identified have changed. Assuming that the machine was working correctly at the beginning, a change in the concept _alarm_ may indicate an impending failure. Moreover, the changes in characteristics visible in Figure 3C,D in Cases 2 and 3 are consistent with the change in characteristics of the recorded measurements presented in Section 4.1. Furthermore, in Case 2, with the change in attribute importance, the density of identified alarms increased. An increase in alarms reported should be regarded as a clear indicator of impending failure. The alarm frequency for the global context for Case 1 is relatively low, which is consistent with the fact that this period is unrelated to the failure. In contrast, in Case 3 the frequency of reported alarms is very high from the very beginning, indicating a poorly calibrated model that identifies too many outliers.