## 3 AI-Based Early Fault Detection
### Recurrent Neural Network: Long Short-Term Memory (DL)  
Another approach to implementing a predictive maintenance method using artificial intelligence is to use deep learning (DL). The use of artificial neural networks (ANNs) is significantly more complex in structure than the ML approach. Artificial neural networks consist of individual neurons organized in layers. These include an input layer, hidden layers, and an output layer. An input signal thus passes through each neuron, is weighted, and is output as a result. The result is generated by activation functions. The extent to which DL can work is demonstrated by the Universal Approximation Theorem [35]. This states that a feed-forward network with only one hidden layer and a sufficient number of neurons is able to approximate any continuous function with arbitrary accuracy. However, this capability is inherently linked to the complexity of the data. It should also be noted that the No Free Lunch Theorem (NFLT) [36] states that no algorithm is good for all optimization problems. Any algorithm developed for one problem may therefore be poorly suited to other tasks. Recurrent neural networks (RNNs) are a type of neural network (NN) that are used specifically for processing sequential data. They possess a feedback loop that enables them to retain information from previous sample points. From a mathematical perspective, an RNN can be represented by  
\[h_{\mathrm{t}}=f(W_{\mathrm{hx}}x_{\mathrm{t}}+W_{\mathrm{hh}}h_{\mathrm{t-1} }+b_{\mathrm{h}}) \tag{9}\]  
with the output vector  
\[y_{\mathrm{t}}=W_{\mathrm{hy}}h_{\mathrm{t}}+b_{\mathrm{y}} \tag{10}\]  
and the state \(h_{\mathrm{t}}\) at time \(t\), the input vector \(x_{t}\), the weighting matrix \(W\), and the bias \(b\)[37]. Figure 4: Confusion matrix of anomaly detection by the OSVM applied to run 30 of the first test, which represents the normal state of the differential, and run 460 of the first test, which shows abnormal behavior in the measurement data. A specific type of recurrent neural network (RNN) is the long short-term memory (LSTM) network. This was created with the objective of more effectively learning long-term dependencies in time signals. In comparison to standard RNNs, it possesses a form of memory function. Specialized gates within the network's structure store pertinent information over extended periods of time and delete irrelevant information, which is essential for effective learning from intricate time signals. The gates are constructed differently and utilize the sigmoid function \(\sigma\) or the hyperbolic function \(tanh\) as an activation term. The input gate \(i_{t}\), the forget gate \(f_{t}\), and the output gate \(o_{t}\) determine which information from the previous state is passed on to the next. The change of state through the gates can be described mathematically, as in [38]:  
\[i_{t}=\sigma(W_{i}\cdot[h_{t-1},x_{t}]+b_{t}) \tag{11}\]  
\[f_{t}=\sigma(W_{f}\cdot[h_{t-1},x_{t}]+b_{f}) \tag{12}\]  
\[o_{t}=\sigma(W_{o}\cdot[h_{t-1},x_{t}]+b_{o}) \tag{13}\]  
\[\widetilde{C}_{t}=tanh(W_{C}\cdot[h_{t-1},x_{t}]+b_{C}) \tag{14}\]  
\[C_{t}=f_{t}*C_{t-1}+i_{t}*\widetilde{C}_{t} \tag{15}\]  
\[h_{t}=o_{t}*\tanh(C_{t}) \tag{16}\]  
The NN can be assembled with individual layers in the MATLAB app Deep Network Designer. In this work, an RNN with six sequentially connected layers is used. It consists chronologically of the input layer, lstmLayer, dropoutLayer, fullyconnectedLayer, softmaxLayer, and classificationLayer. The function of the individual layers can be found in the MATLAB documentation. Some of these layers can also be parameterized. Various options can also be selected for the subsequent training process of the LSTM network. Table 3 shows the parameters of the layers used here, and Table 4 shows the settings for training the LSTM network. In comparison to the OSVM, the torque sequences must be reduced from 2000 to 100 data points. No result could be achieved with 2000 data points. Therefore, more but shorter sequences are used as input.