# Gear Fault Detection Method Based on Convex Hull Clustering of Autoencoder's Latent Space
## 3 Calculation  
### Autoencoder as a Simple Anomaly Detector  
The autoencoder (AE) was designed as a deep neural network with five dense hidden layers (Figure 9). As input, the network takes normalized periodogram \(\mathbf{x}\) (vector of length 129). This periodogram is next coded by the encoder to a vector \(\mathbf{h}\). The encoded vector h is the input layer for the decoder, which reconstructs it to vector \(\mathbf{r}\) (output layer). Figure 8: Reduced dimensionality data with PCA. Figure 9: Autoencoder with deep neural network architecture. For all hidden layers, the rectified linear unit (ReLU) activation function was used. The network was trained with the aid of the randomly selected 70% of periodograms captured for normal operation of the gearbox (gear pair I), which resulted in 616 training samples. The other 30% (264 samples) was used for validation. As the measure of loss, the mean absolute error was applied (Figure 10). To understand whether the observed measurement came from a healthy or damaged gear set, we looked at its reconstruction. We fed our model with different measurements and verified the error of the reconstruction. The threshold value, above which the state of the gearbox will be classified as an anomaly (failure), was calculated with Formula (1):  
\[TH=\frac{1}{n}\sum_{i=1}^{n}MAE_{i}+1.5\sqrt{\frac{1}{n}\sum_{i=1}^{n}\left( MAE_{i}-\frac{1}{n}\sum_{i=0}^{n}MAE_{i}\right)^{2}}=0.0408, \tag{1}\]  
where \(MAE_{i}\) is the \(i\)-th mean absolute error for training, and \(n=616\) is the number of training data. In other words, the gear pair will be classified as faulty if the reconstruction error is at least one and a half standard deviations above the mean training error. Figure 11 presents the classification results for the testing data (gear pair I without failure). Figure 11: Results of validation: (**a**) example of input \(x\), reconstruction \(r\) and error; (**b**) distribution of reconstruction error for testing the data of gear pair I.  
Figure 10: Training and validation loss. It can be seen that the reconstruction matched the input (Figure 11a), however, 10.2% of the test data were incorrectly classified as an anomaly, while in most cases (89.8%), the normal state of operation was predicted correctly (Figure 11b). The main goal of the designed approach is the ability of the neural network to detect a failure--even the smallest initial pitting (Figure 2, second load stage). To check this ability, the periodograms of gear pair II were used as inputs. Figure 12 shows the results of the state prediction in the case of damaged teeth. It can be seen that the reconstruction error was large (Figure 12a). The greatest differences occurred within the frequency range between 2000 and 4000 Hz. Such results (Figure 12b) suggest that signs of pitting might be observed as the increase in the amplitude of the third- and fourth-order harmonics of transmission error (meshing frequency is 1250 Hz). This increase, however, was too subtle to predict a failure with just simple analysis in the frequency domain (Figure 7b). The neural network correctly predicted the state of failure in all cases (Figure 12). Figure 13 shows the confusion matrix that summarizes the results of the state prediction experiment (Figures 11b and 12b). Figure 12: Results of failure detection: (**a**) example of input \(\mathbf{x}\), reconstruction \(\mathbf{r}\), and error; (**b**) distribution of reconstruction error for the testing data of gear pair II. Figure 13: Confusion matrix for basic anomaly detection. Neural networks are very effective (100%) in failure detection in the case of true positive classification. This type of classification is crucial for any accountable mechanical system, since every failure should be detected quickly to prevent further damage. The method was able to properly predict 89.8% of normal states in true negative classification. The network misclassified only 10.2% (false positive) of states where the gearbox was actually without damage.