# Towards Optimizing Multi-Level Selective Maintenance via Machine Learning Predictive Models
## 4 Proposed Methodology
### Predictive Model for Multi-Level Selective Maintenance Using ANN and SVR
#### 4.2.4 Predictive Model on the FMS Data  
Recall that the objective of the proposed predictive model is to estimate at each break the degradation factor of a multi-component manufacturing system on maintenance history based on ANN and SVR regression models. In this sub-section, the model built in our experiments is first presented. Then, we will dive into the optimal hyperparameters of the ANN model. Next, a comparative study is presented between ANN and SVR models based on the performance indices. The dataset used in this experimental study is obtained from a Flexible Maintenance System (FMS), which contains, after processing, the history of maintenance interventions that are shown in Table 1. Each station of this FMS is composed of more than 264 electrical and mechanical components where for each component the intervention date is recorded, as well as the type of maintenance action either corrective (CM) or preventive (PM), and the failure type that is defined by a code. Therefore, as explained in Section 4.1, after data processing a second operation is necessary which consists of computing the Mean Time Between Failure (MTBF), Number of Preventive Maintenance (Nb.PM) and Number of Corrective Maintenance (Nb.CM). These values are used to determine the component coefficient degradation by using the k-means clustering algorithm. As the main objective is to build a model able to predict the component coefficient degradation from their real condition after performing some operations, these obtained results are fed into the ANN model for forecasting. For this purpose, this dataset is split into training and evaluation subsets. The model has been developed in Python with the use of the Keras machine learning library on top of the open-source machine learning framework called TensorFlow. The data has been partitioned by an 8020 splitting rule, i.e., 80% of data is used for the training step while 20% is employed to evaluate the model. Then, the info has been scaled to the interval of \((0,\ 1)\), which is understood to assist the neural network in learning underlying patterns, both more accurately and more efficiently. To reach the optimal model hyperparameters, we use the random search method implemented in the Keras tuner library. So, the best configuration of the model found using the random search method is as follows:  
* An input layer of 3 nodes and an activation function Relu (rectified linear unit);
* A first hidden layer of 40 nodes and an activation function Relu;
* A second hidden layer of 20 nodes and an activation function Relu;
* An output layer of one node (regression problem). In addition, the optimal hyperparameters obtained for the SVR model with linear Kernel and with RBF Kernel are \(c=3\), \(\gamma=scale\) and \(\varepsilon=0.03\). \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Time** & **Component\_Name** & **Maintenance\_Type** & **Code\_Error** \\ \hline
2019-01-03 06:41:43 & CO & PM & Rkf \\ \hline
2019-02-24 16:33:06 & PK & CM & Ther \\ \hline
2019-03-07 16:05:40 & BD & PM & Chel \\ \hline \(\ldots\) & \(\ldots\) & \(\ldots\) & \(\ldots\) \\ \hline
2022-04-04 21:49:32 & KZ & PM & Aron \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Example of FMS data. To assess the model's effectiveness in predicting the degradation coefficient of components post operation, the 'evaluate' function is used. This function provides us with both training and evaluation scores based on MSE, MAE, and MAPE loss functions. The simulation results are presented in Table 2 and Figures 2-4. Table 2 displays the performance metrics results for the ANN model on the FMS dataset, juxtaposed with other regression models (Support Vector Regression SVR). Figures 2 and 3 reveal a significant margin between the actual and predicted values, particularly evident in the SVR with linear kernel model and SVR with RBF Kernel. In contrast, Figure 4 illustrates that the ANN model's predicted values are closely aligned with the true value, demonstrating a smaller error when compared to the SVR models.