# Application of Predictive Maintenance Concepts Using Artificial Intelligence Tools
## 3 Application Example
### Feature Engineering  
A feature is a predictive attribute for the model. The purpose of feature engineering is to seek to increase the predictive power of Machine Learning algorithms, creating new features from the available data. As a rule, feature engineering is carried out in the first place and then the selection of features occurs, eliminating irrelevant, redundant or highly correlated features. Starting from the different sources of information presented in the previous paragraphs, a single dataset will be created, which will be used for the application of predictive models. The historical data that models have access to are individual moments in the past. In particular, for telemetry data, disturbances resulting from measurements, such as noise, are possible, thus making the predictive task more difficult. In this way, the data can be aggregated in time windows, thus allowing to \"smooth\" the values, minimizing the effects of noise on the features used by the models. Bearing in mind how far in the future the model should be able to predict, according to the requirements of the project, it is important to define how far it should \"look\" to make these predictions. This interval of time passed to where the model should \"look back\" is called lag. Several features can be extracted from these time intervals--lag features. The data set used to generate lag features usually has a date/time associated with it. For each record, a time window of dimension N is created and the lag features are calculated for the period N before the date/time of that record. Figure 7 shows an example of this application for a t! measurement with N = 3. The value of N is typically in minutes or hours, depending on the nature of the data. Figure 6: Histogram representing the number of machines and service time, by model. Thus, two temporal windows were created. The first, of 3 h, in order to allow us to portray the behavior of telemetry data in the short term (Table 7) and the second, of 24 h, in order to represent the long-term evolution (Table 8). In each of these time intervals, two new parameters were calculated every 3 h for each of the features: the moving average and the standard deviation. Note that, in the case of N = 24 h (Table 8), naturally the two new parameters are not available for the initial moments (first 24 h). As with telemetry data, the error log also has a date/time associated with it. However, these data are categorical and not numerical. In this case, the number of errors of each type is added, every 3 h, for the time window N = 24 (Table 9). Each line in the table represents the sum of the number of errors of each type in the 24 h prior to the indicated _datetime_. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **machineID** & **Datetime** & **Voltmean\_3h** & **Rotatemean\_3h** & **Pressuremean\_3h** & **Vibrationmean\_3h** \\ \hline
0 & 1 & 2015-01-01 09:00:00 & 170.028993 & 449.533798 & 94.592122 & 40.893502 \\
1 & 1 & 2015-01-01 12:00:00 & 164.192565 & 403.949857 & 105.687417 & 34.255891 \\
2 & 1 & 2015-01-01 15:00:00 & 168.134445 & 435.781707 & 107.793709 & 41.239405 \\
3 & 1 & 2015-01-01 18:00:00 & 165.514453 & 430.472823 & 101.703289 & 40.373739 \\
4 & 1 & 2015-01-01 21:00:00 & 168.809347 & 437.111120 & 90.911060 & 41.738542 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Example of _Lag Features_ for telemetry data in real time, with N = 3. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & **machineID** & **Datetime** & **Voltmean\_24h** & **Rotatemean\_24h** & **Pressuremean\_24h** & **Vibrationmean\_24h** \\ \hline
7 & 1 & 2015-01-02 06:00:00 & 169.733809 & 445.179865 & 96.797113 & 40.385160 \\
8 & 1 & 2015-01-02 09:00:00 & 170.614862 & 446.364859 & 96.849785 & 39.736826 \\
9 & 1 & 2015-01-02 12:00:00 & 169.89365 & 447.009407 & 97.715600 & 39.498374 \\
10 & 1 & 2015-01-02 15:00:00 & 171.243444 & 444.233563 & 96.666060 & 40.229370 \\
11 & 1 & 2015-01-02 18:00:00 & 170.792486 & 448.440437 & 95.766838 & 40.055214 \\ \hline \hline \end{tabular}
\end{table}