## 3 Experimenting Results
### Diagnosis
These data were used to fit a SOM, projecting 32 input neurons to a 20 \(\times\) 20 feature space map, and configuring its hyperparameters as sigma = 5, learning_rate = 0.5, neighborhood function = bubble and random training of 6000. This map projects similar instances on the original space to neurons that are near in the new space, which are represented in light colors. It also projects different instances to different groups of neurons in the new space, being separated with high distance neurons that are represented with dark colors. The result of SOM is exhibited in Figure 6, which shows a clear separation among all failure types, where instances of the same class belong to near and light color neurons, and at the same time are separated with instances of other classes with high distance dark color neurons. In addition, normal data are separated from failures by high distance dark neurons, but at the same time, being in the middle of the map is reasonable as it is the root data used to create all failure data. Few outlier samples are located in big distance SOM cells; these belong to outlier strokes that were previously identified as outliers given their damage indexes were much higher than the majority of correct strokes'. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline
**Number Clusters** & **(3) Power Increase** & **(2) Force Anticipation** & **(1) Force Increase** & **(4) Switch Forces** \\ \hline  & **prec** & **rec** & **prec** & **rec** & **prec** & **rec** & **prec** & **rec** \\ \hline outliers & 0.41 & 0.74 & 0.20 & 0.72 & 0.40 & 0.72 & 0.00 & 0.00 \\
1 & **0.75** & 0.26 & 0.00 & 0.00 & 0.25 & 0.09 & 0.00 & 0.00 \\
2 & 0.00 & 0.00 & **1.00** & 0.28 & 0.00 & 0.00 & 0.00 & 0.00 \\
3 & 0.00 & 0.00 & 0.00 & 0.00 & **1.00** & 0.19 & 0.00 & 0.00 \\
4 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & **1.00** & 1.00 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Clustering results using OPTICS algorithm configured with the hyperparameter of minimum number of samples equal to 80, evaluated with precision (prec) and recall (rec) metrics. The last diagnosis tool was designed to facilitate fault diagnosis for domain technicians is based on XAI, given that deep learning models are not explanatory by themselves. A final layer was added to the 2D-CNN-AE model of Figure 4 to calculate the RMSE between reconstructed and input data, using the Equation (1). In the equation, \(n\) is the number of cycles in the stroke, \(i\) indicates a cycle index, \(m\) indicates total number of features of the stroke, and \(j\) indicates feature index. \[ \begin{split} mean\_squared\_loss\_of\_feat_{j}=\frac{\sum_{i=1}^{n}(y_{ ij}-y_{ij})^{2}}{n};\\ loss=\sqrt{\frac{\sum_{j=1}^{m}mean\_squared\_loss\_of\_ feat_{j}}{m}}\end{split}  \tag{1}\]  
SHAP libraries' GradientExplainer class was fitted with samples of correct validation strokes and their losses, so that the explainer learns which is data normality. Then, this explainer was used to diagnostic anomalous strokes categorized by the anomaly detection model. Thus, the explainer propagates each stroke's loss gradient along all layers of the autoencoder until reaching the its input, where SHAP values of each input feature for each evolution variable point are estimated. Afterwards, the absolute value of this SHAP value matrix was calculated, the maximum value of this new matrix was searched, and min-max normalized. Finally, this last matrix is used to plot an indicator of damage with original input data by drawing red rectangles for each evolution variable point, whose transparency is inversely proportional to matrix values. Thus, a matrix value near to 1 has little transparency and will be clear, whereas values near to 0 will be hardly noticeable. As Figure 7 shows, the developed diagnosis algorithm based on XAI can detect which signals are causing the anomaly in a multivariate approach, and without being previously trained for these failure types.