## 5 Proposed Approach
### Prediction Module  
The predictive models that will be presented below are all fed with the same input data and the prediction phase always follows a similar process. Therefore, in this section, we will describe how the data are fed to the predictive models with the goal of obtaining a forecast of the next fault for each component. First, for each component \(cm\) we extract the fault dates of all the notices about \(c\) and put them in a vector in chronological order. Let us call such a vector \"y\". Subsequently, an \"X\" vector will be generated containing integer values from 1 up to the length of the vector \"y\". To work with integer values, the dates have been transformed into an integer representing the number of days elapsed from the oldest date in the \"Notice\" data; that is 31/12/1999. Some examples of conversion are shown in Table 10:  
The vectors \"X\" and \"y\" are further split into training and test sets:  
* X_train and y_train: learning vectors;
* X_test and y_test: model validation vectors. The process carried out is iterative, and for each prediction, the vectors are divided to use 80% of the total data for training and the remaining 20% for testing. We are in presence of a regression problem, and the forecasting process involves the following cyclical steps whose number corresponds to the number of elements in the test set:  
* Model training using training data (X_train and y_train); \begin{table}
\begin{tabular}{l l} \hline \hline
**Date** & **Converted Date (Elapsed Days)** \\ \hline
01/01/2000 & 1 \\ \hline
14/09/2007 & 2814 \\ \hline
15/05/2012 & 4519 \\ \hline
06/07/2020 & 7493 \\ \hline \hline \end{tabular}
\end{table} 
Table 10: Examples of conversion from dates to days with respect to 31/12/1999. \begin{table}
\begin{tabular}{l l l l l} \hline \hline
**Component** & **Notice** & **Description** & **Date** & **Cost [€]** & **Fault Category** \\ \hline RT2 MP5B-P & 10,046,792 & PUMP COOLING H2O LINE OFF & 27/12/2001 & 203.84 & CLEANING \\ \hline RT2 MP5B-P & 10,111,379 & RT2 MP5B CLEAR CIRCH20 COOL & 09/03/2004 & 203.84 & CLEANING \\ \hline RT2 MP5B-P & 10,124,210 & RT2 MP5B mechanics control (LOSS) & 30/08/2004 & 6882.88 & CONTROLL \\ \hline RT2 MP5B-P & 10,303,874 & RT2 MP5B RESTORE COOLING H2O & 10/05/2010 & 549.8 & MAINTENANCE \\ \hline RT2 MP5B-P & 10,321,419 & RT2 MP5B RESTORE COOLING H2O & 25/10/2010 & 200.32 & MAINTENANCE \\ \hline RT2 MP5B-P & 10,403,663 & RT2 MP5B SEAL REVIEW & 10/12/2012 & 2605.54 & REVISION \\ \hline RT2 MP5B-P & 10,494,752 & RT2 MP5B H2O COOL DESCENDING & 06/07/2015 & 855.54 & CLEANING \\ \hline RT2 MP5B-P & 10,525,298 & RT2 MP5B H2O COOLING Clogged & 13/06/2016 & 597.68 & CLEANING \\ \hline RT2 MP5B-P & 10,528,736 & RT2 MP5 BLIND DISCS REMOVAL & 20/09/2016 & 11,650.99 & CLEANING \\ \hline RT2 MP5B-P & 10,640,333 & RT2 MP5B NO WATER CIRULATION TXT & 29/11/2019 & 2005.73 & _none_ \\ \hline RT2 MP5B-P & 10,648,669 & RT2 MP5B H2O COOLING Clogged & 03/03/2020 & 672.48 & CLEANING \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Example of standard structure obtained for the pump RT2 MP5B-P.  
* Predicting the first element in the test data (y_test[0]);
* Evaluating the error as the deviation between the predicted value and the real value;
* Augmenting the training vectors with the real data sample of the sample just predicted (the first value of X_test and y_test are, respectively, added to X_train and y_train). Therefore, for each forecast, the training vectors are augmented with the real data of the previous forecast. This means that after each prediction, the training set grows by one element (represented by the real value of the predicted element). Furthermore, the process is sustainable. As soon as a new sample is inserted into the data structure, a new prediction will be automatically forecasted. The process is illustrated in Figure 3. At step 0, we need to forecast the first element in the test. After we perform the forecast (step 1), we augment the training set with the real value of the predicted element.