# AI-Driven Predictive Maintenance for Workforce and Service Optimization in the Automotive Sector
## 4 Methodology
### Model Training
#### 4.2.3 Decision Tree  
Decision Trees (DT) often mimic human-level thinking, so they are understandable and interpretable. The Decision Tree algorithm, a hierarchical model, used to solve regression and classification problems, belongs to the family of supervised learning algorithms. The purpose of using a Decision Tree is to create a training model that can be used to predict the class or value of the target variable by learning the simple decision rules extracted from the training data.  
The predictions will start from the node's root and then compare the values of the root attribute with the other attribute. Impurity measurement is used to determine which attribute will be the root node. A measure of impurity also measures the goodness of subsequent splits [33]. Entropy and the Gini index can be used to measure impurity. The threshold values \(w_{m0}\) must also be known to split the root node into two separate internal  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Threshold** & **Algorithms** & **F1-Score** & **Recall** & **Precision** & **MSOR** & **ECAR** \\ \hline \multirow{4}{*}{0.3} & DT & 0.30 & 0.31 & 0.29 & 0.71 & 0.69 \\  & RF & 0.40 & 0.57 & 0.31 & 0.69 & 0.43 \\  & XGBoost & 0.45 & 0.51 & 0.39 & 0.61 & 0.49 \\  & LGBM & 0.10 & 0.93 & 0.05 & 0.95 & 0.07 \\ \hline \multirow{4}{*}{0.4} & DT & 0.30 & 0.31 & 0.29 & 0.71 & 0.69 \\  & RF & 0.43 & 0.43 & 0.43 & 0.57 & 0.57 \\  & XGBoost & 0.44 & 0.42 & 0.46 & 0.54 & 0.58 \\  & LGBM & 0.10 & 0.91 & 0.05 & 0.95 & 0.09 \\ \hline \multirow{4}{*}{0.5} & DT & 0.30 & 0.31 & 0.29 & 0.71 & 0.69 \\  & RF & 0.39 & 0.32 & 0.51 & 0.49 & 0.68 \\ \cline{1-1}  & XGBoost & 0.41 & 0.34 & 0.53 & 0.47 & 0.66 \\ \cline{1-1}  & LGBM & 0.10 & 0.89 & 0.05 & 0.95 & 0.11 \\ \hline \multirow{4}{*}{0.6} & DT & 0.30 & 0.31 & 0.29 & 0.71 & 0.69 \\ \cline{1-1}  & RF & 0.32 & 0.22 & 0.56 & 0.44 & 0.78 \\ \cline{1-1}  & XGBoost & 0.33 & 0.23 & 0.59 & 0.41 & 0.77 \\ \cline{1-1}  & LGBM & 0.10 & 0.87 & 0.05 & 0.95 & 0.13 \\ \hline \hline \end{tabular}
\end{table}
Table 7: Threshold-specific model performance metrics including business-aware evaluation indicators (MSOR and ECAR).  
nodes. In the case where N is the root nodes, suppose that \(N_{m}\) is the number of training instances reaching in node m. Among the \(N_{m}\) data points, there are \(N_{m-1}\) possible \(w_{m0}\). We do not need to test all points. The best \(w_{m0}\) is always between adjacent points belonging to different classes [33]. The samples are assigned to binary classes with the following function:  
\[f_{(x)}:x_{j}>w_{m0}. \tag{7}\]  
\(C_{i}\) is the i class that will be split after the root node. Given that a sample reaches m nodes, the estimate for the probability of class \(C_{i}\) is [33]  
\[P(C_{i}|x,m)\equiv p_{m}^{i}\equiv\frac{N_{m}^{i}}{N_{m}}. \tag{8}\]  
The Gini index used in this paper to measure impurity is calculated as [33]  
\[\Phi\ (p,\ 1-p)=2\ p(1-p). \tag{9}\]  
The Gini index function to measure node impurity is calculated as [33]  
\[I_{m}=\sum_{i=1}^{K}p_{m}^{i}log_{2}p_{m}^{i}. \tag{10}\]  
If \(p_{m}^{i}\) is 0 or 1 for all i, node m is pure. If the split is pure, we do not need any more splits, and we can add a leaf node labeled with the class where \(p_{m}^{i}\) is 1 [33]. If node m is not pure, then the instances should be split to decrease impurity, and there are multiple possible attributes on which we can split. We look for the split that minimizes impurity after the split because we want to generate the smallest tree. If the impurity in the nodes is equal to 0 or converges to a specified limit, the labeled leaf is created, and tree splitting is stopped.