## 5 Modelling
### AI Model Selection  
As traditional tools like Six Sigma and statistical process control reach their limitations, AI-based methods are becoming essential for enabling sustainable and efficient manufacturing practices [67; 68]. Artificial Intelligence methods, such as machine learning algorithms (e.g., Random Forest, support vector machines), artificial neural networks (ANNs), deep learning models, and natural language processing (NLP), can be effectively utilized in Six Sigma (\(6\sigma\)) projects for optimization, predictive analysis, and process automation [69]. The Random Forest model is suitable for predictive control in non-linear production processes due to its ability to accurately incorporate control process knowledge, providing more reliable future state predictions and enhancing overall control performance [70]. The Random Forest formed by decision trees is a mainstream bagging algorithm that performs better than single algorithms. The Random Forest model's function depends on using classification and regression trees (CARTs) for establishing base estimators [71]. Random Forest is one of the most popular machine learning algorithms used for solving regression and classification problems. It is based on the idea of aggregating multiple decisions through an ensemble of decision trees, where each tree contributes to the final prediction. This approach not only improves the model's accuracy but also reduces variability and overfitting, which often occur with simpler models like individual decision trees [72; 73]. The Random Forest model was chosen for its interpretability, ability to handle large datasets, robustness, feature importance assessment, and reduction in overfitting due to its use of the 'bagging' (bootstrap aggregating) technique. It is well-suited for this non-linear model because it can efficiently identify and model complex non-linear relationships between the input variables (\(W_{1}\), \(W_{2}\), \(W_{3}\)) and the output variable \(Y\), while also mitigating overfitting, which further enhances the model's accuracy in predicting outcomes. Random Forest relies on the structure of decision trees, which use various mathematical techniques to make decisions. Each tree is trained on different subsets of data, and the final prediction is obtained by averaging the predictions of all trees (in the case of regression) or by majority voting (in the case of classification). This approach improves prediction accuracy and reduces the risk of overfitting. Random Forest is an ensemble method composed of multiple decision trees. Each tree makes its own estimate (prediction), and the final prediction of the Random Forest model is the average of all individual tree estimates (for regression) or the majority of votes (for classification). For each model trained, a random sample of data are taken from the original dataset through a process called 'bootstrap sampling'. At each node of the tree, instead of considering all features for the split, Random Forest randomly selects only a subset of features. This technique helps reduce correlation among the trees and makes the model more robust. Once the Random Forest model is trained, predictions for new data are made by aggregating the averages of the individual trees. Given that Random Forest uses a set of multiple trees (\(N\)) to calculate the final prediction as the average of all individual predictions (\(f_{i}(x)\)) obtained from each tree in the forest, it can be mathematically expressed as:  
\[\hat{y}=\frac{1}{N}{\sum_{i=1}^{N}{f_{i}(x)}} \tag{26}\]  
where: \(\hat{y}\) is the final prediction of the model, \(N\) is the number of trees in the forest, and \(f_{i}(x)\) is the prediction of the \(i\)-th tree for input \(x\). The flowchart (Figure 5) illustrates the process of the Random Forest algorithm for regression, including bootstrap sampling to create multiple training subsets, building decision trees for each subset, and aggregating their predictions to derive a final output.