## 3 Proposed Solution
### RUL Prediction  
RUL prediction is performed by forecasting the HI curve. Recurrent neural networks (RNNs) are very effective at sequence modeling. In this work, a bidirectional long short-term memory (BiLSTM) model was developed to predict RUL. BiLSTM is a form of artificial RNN, which is typically used to extract the long-term dependencies of input sample data. It is composed of two LSTM layers, one used for forward propagation and the other used for backward propagation, enabling the flow in both directions [25].  
LSTM cells have three gates, which manage the flow of information throughout the network: the input, forget, and output gates. The input gate is open when the inward information flow is activated and closed when it is deactivated. The output gate works similarly; outward information flow is disabled if the gate is closed. The forget gate decides which information is to be retained and which can be forgotten. A BiLSTM connects two LSTM layers to the output layer, making the model performance better than with LSTM. The output \(\overrightarrow{h}\) from the forward LSTM layer is obtained as with a regular LSTM, while the output \(\overleftarrow{h}\) obtained from the backward layer is computed using the reversed  
Figure 3: Health stage division.  
Figure 2: SAE structure.  
inputs from time \(t-1\) to \(t-n\). Both outputs are then combined using the sigmoid function into an output vector \(y_{t}\)[65]. The structure of a BiLSTM layer is shown in Figure 4.  
The network structure and hyperparameters of the BiLSTM network are listed in Table 2. The 60-node layer corresponds to the BiLSTM layer, which is composed of 2 LSTM layers of 30 nodes each. To perform RUL prediction, the HI curve is used as the input feature. The sequence feature and the sliding step sizes used are 10 and 1, respectively. This means that if the input sequence feature is \([X_{1},X_{2},X_{3},\ldots,X_{10}]\), the prediction function can be expressed as \(F([X_{1},X_{2},X_{3},\ldots,X_{10}])=Y_{11}\). This process can be used to forecast the HI curve by computing \(F([X_{2},X_{3},\ldots,X_{10},Y_{11}])=Y_{12}\), \(F([X_{3},X_{4},\ldots,X_{10},Y_{11},Y_{12}])=Y_{13}\), and so on, obtaining the output sequence \([X_{1},X_{2},X_{3},\ldots,X_{10},Y_{11},Y_{12},\ldots,Y_{z}]\) where \(z\) corresponds to the number of predictions.  
Once the HI curve is predicted, the point \(n\) that determines the moment of failure is selected. This corresponds to the first predicted value that satisfies the following condition: \(|Y_{n}-Y_{n+100}|\leq 0.001\). This value is selected empirically once the training phase is up and does not change after training, proving its robustness while predicting RUL with different datasets. In order to compare the results obtained by the proposed solution with other works, the error in RUL prediction is used. The error is computed following Equation (4), where \(R_{A}\) corresponds to the actual RUL, \(R_{P}\) corresponds to the predicted RUL, and \(P_{t}\) corresponds to the time when the prediction is made. Negative errors mean that the predicted RUL is longer than the actual RUL (underestimate), while positive errors mean that the predicted RUL is shorter than the actual RUL (overestimate). Overestimates  
\begin{table}
\begin{tabular}{l l} \hline
**BiLSTM Structure** & **1-5-60-5-1** \\ \hline Activation function & ReLu \\ Optimizer & Adam \\ Learning rate & 0.001 \\ Epochs & 1000 \\ \hline \end{tabular}
\end{table}
Table 2: BiLSTM hyperparameters.  
Figure 4: Bidirectional LSTM (BiLSTM) structure.  
are preferable because they lead to early predictions, allowing maintenance work or part replacements to be planned before motor failure occurs.  
\[error=\frac{(R_{A}-P_{t})-(R_{P}-P_{t})}{R_{A}-P_{t}}\times 100 \tag{4}\]