# Using Intelligent Edge Devices for Predictive Maintenance on Injection Molds +
## 5 GFTs and Anomaly Detection for PdM
### Cost-Based GFT Training  
The output of a GFT is the probability \(p\) of the TE, and the training process consists of finding the GFT structure that minimizes the costs of maintenance. The maintenance approach considering the GFT output consists of proactively performing maintenance interventions when the failure probability \(p\) reaches a given threshold \(p_{t}\). At this time, the cost of the next corrective maintenance action is replaced by the cost of a proactive intervention. During the training phase, each tree is evaluated considering the percentage of the mold's unavailable time achieved with each tree. This metric is defined by Equation (1), where \(N_{i}\) is the number of interventions performed during the considered period, \(ut_{i}\) is the unavailable time caused by each intervention, and \(wt_{i}\) is the working time of the machine from the mold's last maintenance intervention \(i-1\) until intervention \(i\). Note that the optimal \(p_{t}\) for each tree is determined iteratively by varying this parameter from 0.50 to 1.00 in intervals of 0.01. A low value of \(p_{t}\) may avoid more failures; however, this means that fewer working cycles are performed, which may increase the cost due to the molds' lifetime under exploitation. \[Cost=\sum_{i=0}^{N_{i}}\frac{ut_{i}}{wt_{i}+ut_{i}}. \tag{1}\]  
Because the training dataset contains only corrective maintenance interventions, the time during which the mold is unavailable can be determined for each failure using the contextual data of the enterprise's MES. However, these data lack information concerning the different mechanical failures that may occur, making it hard to estimate the reduction in unavailable time achieved by changing a corrective action to a proactive one in a given case. Because the time spent on corrective interventions has a wide range of possible values, as discussed in the next section, it is reasonable to assume that the benefit of performing a proactive action instead of a corrective one is irrelevant when the latter takes  
Figure 5: Calculation of BE distribution. Figure 6: Degradation of the same mold on different IMMs. only a short time to perform, or that it may even increase unavailability of the mold due to proactive revisions and maintenance actions taking longer than a simple and short corrective measure. Considering these aspects, we consider that \(ut_{i}\) for a proactive action assumes a constant value, which is the median of \(ut\) for all corrective actions. Note that in the future this training rule may be customized according to different scenarios and the respective interests of different enterprises. The model training process is an iterative one in which trees are generated, starting with less complex ones with fewer BEs before proceeding to more complex ones. As shown in Figure 7, the process starts by calculating all possible trees containing two BEs. From there, the process continues by using the output of simpler trees to build more complex ones. For example, a tree with four BEs can be calculated using a gate/operator that has a tree with three BEs and a single BE as inputs, or using two trees with two BEs each. These trees are saved during the process in order to speed up calculation. The training process stops when the best solution containing \(K\) BEs does not represent an improvement of more than 3% compared to the best solution containing \(K-1\) BEs. The time complexity of the GFT training process is \(O(n^{2}\lg(m)\,N)\), where \(m\) is the number of BEs in the tree, \(n\) is the number of columns, i.e., the total number of BEs that may be used during the training process, and \(N\) is the number of instances in the training set. The failure probability estimated by the GFT is obtained by an algebraic expression; thus, its prediction complexity is \(O\) (1), making prediction very lightweight and suitable for running on edge devices.