# A Real-Time Novelty Recognition Framework Based on Machine Learning for Fault Detection
## 3 Proposed Predictive Maintenance Architecture
### AI Unit  
The AI Unit is shown in Figure 3, the framework's \"brain\". As a standard ML approach, the parts that compose the process flow are represented in Figure 4:  
As mentioned before, the idea of this paper is to give a different use of ML compared to a normal flow. A common approach follows the standard way that a dataset is divided into Training Set, Testing Set, and Validation Set; in this case, the framework continuously works in testing mode to compute the prediction error for every dataset that arrives in the database. Monitoring this error makes it possible to understand if a deviation occurs in the collected dataset. Every time that data collected are similar to the ones used for Training, the error obtained is low. In contrast, if an issue happens in the machine, the error tends to increase due to different behavior in the data pattern collected. This type of detection does not predict only problems; it can also understand when a novelty related to a change appears in the dataset (typical in a real situation, an example can be environmental changes). For this reason, the trained dataset must represent the whole machine's behavior. The number of datasets chosen for the training depends on the framework's application: by increasing the number of training datasets, the prediction's accuracy increases too (the risk of a false positive due to a change is low); however, training the framework with a small number of datasets allows using it earlier, but the maintainer may work more during the first days by updating it (the risk of detecting a change is higher). A trade-off concerning the duration of the training process has to be defined. Generally, companies  
Figure 4: Machine Learning process flow. Figure 3: PdM Artificial Intelligence Unit. that design machines/components always have a period in which the machine/component is calibrated and tested; this period can last from a few days to an entire month, and it could be useful for the training process. An entire environmental changes cycle (such as the morning, the afternoon, and the night) can be useful for gathering all the possible components' changes. Sometimes the data collected can change over the day: during the morning, when the temperature is low, the machine has a certain accuracy that changes during the afternoon due to the higher temperature reached. There is no general rule explaining how many datasets are gathered; a possible hint is to collect one week's worth of data to record a consistent dataset. The best situation in which this framework can be trained is at the beginning of the machine's life (e.g., after the assembly process). Nevertheless, the framework can also be trained after years of machine work; in this case, the framework performs the training at that moment and cannot recognize preexisting faults due to the absence of healthy datasets. However, the nature of failures leads to a machine's worsening over time, detecting them also if training is performed with a partially faulty system; hence, thanks to the system's adaptability, the absence of a healthy dataset is not a problem, but it may afflict the framework's accuracy. The first stage of the ML process flow is preprocessing, which consists in taking every single dataset from the database and recognizing which kind of features are stored (such as Acceleration, Sound, or Temperature). Then the AI manager applies a windowing function for each type of feature recognized: the windowing approach divides the large dataset's features into a parametrized small number of windows (for example, acceleration is divided into \(k_{1}\) windows, sound into \(k_{2}\) windows) depending on the resolution wanted in the framework recognition: a higher number of windows corresponds to a higher prediction's resolution; on the other hand, the system works more complexly due to the higher number of windows to predict. Each window is associated with a predictor (AIUP), which uses \(i_{th}\) window as a label and the others as features (Figure 5).