## 2 Materials and Methods
### Hybrid Model LSTM-MA-AE
Figure 7:6

where \(\theta_{\text{EWMA}}\) is the standard deviation of the EWMA values and \(\lambda\) is a constant that defines the position of the threshold. When training with normal data, \(\lambda\) can be adjusted to set an appropriate threshold. ### Fault Prediction System

Initially, the model reconstructs all input variables to capture deviations in each one. As depicted in Figure 8, the fault prediction system calculates the reconstruction score for each data point for each variable. A smoothing vector is then used to distinguish between anomalies possibly caused by degradation or situations where the WT is operating at its power limits. Next, this new score is passed through a threshold with EWMA. If the score exceeds this threshold, a label vector is created, where 1 indicates that the threshold has been exceeded and 0 indicates that it has not. Figure 7:7 Flowchart of the failure prediction system. The symbol * represents the multiplication for the the threshold of the smoothing vector. Dotted lines are used to highlight the sliding window anomaly process. This label vector is processed through a sliding window anomaly detector to improve anomaly labeling. This detector takes a binary vector as input and identifies if there are more than \(N_{\text{anomalies1}}\) anomalies within a time window \(N_{\text{window1}}\), then it labels the entire window between the first and last anomaly within the window as anomalous (1). This method assumes that nearby anomalies within a maximum window size of \(N_{\text{window1}}\) can represent the same fault. Once each variable's final label vector is obtained, all vectors are concatenated and added. This time, the number of variables with anomalies that would indicate a failure warning is determined using a fixed threshold. For each variable \(v_{i}\) in the data set, we perform the following:

1. Calculation of the reconstruction score for each variable \(v_{i}\): Figure 7:8 (30) where \(L_{v}(t)\) is the reconstruction score over time \(t\), \(y_{i}\) represents the actual values, and \(\hat{y}_{i}\) the predicted values. 2. Calculation of the smoothed reconstruction vector \(L_{s}(t)\): Consider \(P(t)\) the nominal power at instant \(t\) and \(P_{90}\) the 90 th percentile value of the maximum power. We define the smoothing vector \(V_{s}(t)\) as follows: \[V_{s}(t)= \begin{cases}0.85&\text{if }P(t)>P_{90}\\ 1&\text{otherwise}\end{cases} \] (31) \[L_{s}(t)=V_{s}(t)\cdot L_{v}(t)\] (32)
3. Calculation of EWMA: \[S_{i}(t)=\alpha\cdot L_{s}(t)+(1-\alpha)\cdot L_{s}(t-1)\] (33) where \(S_{i}(t)\) is the EWMA-smoothed score. 4. Comparison with the threshold: \[R_{i}(t)= \begin{cases}1&\text{if }L_{s}(t)>\text{threshold}_{EWMA}\\ 0&\text{otherwise}\end{cases} \] (34) where \(R_{i}(t)\) is the vector of labels indicating an anomaly. 5. Improvement of detection with the sliding window anomaly: For a window size maximum of \(N_{\text{window1}}\): \[R_{i}(t)= \begin{cases}1&\text{for }t\in[t_{1},t_{n}]\text{ if }N_{\text{anomalies1}}\leq\sum_{t_{1}}^{t_{n}}R_{i}(t)\text{ within }N_{\text{window1}}\\ 0&\text{otherwise}\end{cases} \] (35) where \(t_{1}\) and \(t_{n}\) are the temporal positions of the start and end of the anomalies within the size window \(N_{\text{window1}}\). If two anomalies are found within this window, all data points between \(t_{1}\) and \(t_{n}\) are labeled as anomalous. 6. Adding and fix the threshold: \[T_{\text{add}}(t)=\sum_{i=1}^{v}R_{i}(t)\] (36) where \(v\) is the number of variables. \[\text{Fault Warning}= \begin{cases}Warning&\text{if }T_{\text{add}}(t)>\text{ threshold}_{\text{fault}}\\ normal&\text{otherwise}\end{cases} \] (37)where threshold\({}_{fault}\) represents the final fixed threshold of failure. ### Model Hyperparameters

In this study, the early stopping technique is adopted during the training process to avoid overfitting the model. Overfitting can prevent the model from adequately understanding the temporal and spatial relationships between variables, as it fits too closely to the true values and loses generalization ability.