## 3 Materials and Methods
### Stage 2: Project Contingency Prediction Models  
This stage focused on developing and evaluating ML models for cost contingency prediction. Seven models were considered: linear regression, SVM, decision trees, random forests, gradient boost, XGBoost, and ANNs. These models were selected for (i) their widespread use in cost and contingency prediction and (ii) their broad capacity to handle different predictive tasks (see Table 2) [9]. Linear regression functioned as a baseline model due to its straightforward approach to cost prediction. SVM was chosen for its ability to capture complex relationships between input features and cost outcomes [28; 36]. Decision trees, which model non-linear relationships, were supported by random forests through ensemble learning to improve prediction accuracy [30]. Gradient boosting and XGBoost were included for their focus on iterative error correction and performance optimization [32]. ANNs were utilized for their strength in capturing intricate, non-linear interactions between features [33; 35]. Together, these models facilitated a robust comparison analysis to identify the best-performing algorithm for contingency prediction. Each model was systematically fine-tuned to enhance its predictive accuracy and reliability. A grid search was employed to identify the optimal hyperparameters by systematically exploring predefined parameter ranges and evaluating all possible combinations [54]. Cross-validation was then used to assess model performance and prevent overfitting [55]. The final selection of hyperparameters was based on minimizing prediction error metrics. The optimal hyperparameters derived through this process are presented in Table 3. Thistuning approach allowed for systematically evaluating various parameter combinations and enabled the selection of the most appropriate settings for each algorithm [56]. Then, the performance of each model was evaluated and compared through key metrics, including \(R^{2}\), mean absolute error (MAE), mean square error (MSE), and root mean square error (RMSE) [28]. These metrics were employed to assess the models' accuracy and robustness in predicting outcomes. \(R^{2}\) measures the proportion of variance in the dependent variable that can be explained by the independent variables. It ranges in value from 0 to 1, with values closer to 1 indicating a better model fit [9]. The calculation of \(R^{2}\) is expressed by Equation (3). \[R^{2}=1-\frac{\sum\limits_{i=1}^{n}{{{(y_{i}-\hat{y}_{i})}^{2}}}}{\sum\limits_{ i=1}^{n}{{{(y_{i}-\overline{y}_{i})}^{2}}}} \tag{3}\]  
where \(y_{i}\) is the actual value, \(\hat{y}_{i}\) is the predicted value, \(\overline{y}\) is the mean of actual values, and \(n\) is the number of project cases. MAE measures the average of the absolute errors between predicted and actual values [36]. It is a straightforward measure of prediction accuracy calculated as shown in Equation (4):  
\[MAE=\frac{1}{n}{\sum\limits_{i=1}^{n}{{{|y_{i}-\hat{y}_{i}|}}}} \tag{4}\]  
RMSE is the square root of MSE, which offers a metric by squaring the residuals (the differences between the predicted and actual values). Compared to MAE, it weights larger errors more, which can be useful when larger errors are more impactful. Equations (5) and (6) were used to calculate MSE and RMSE, respectively:  
\[MSE=\frac{1}{n}{\sum\limits_{i=1}^{n}{{{(y_{i}-\hat{y}_{i})}^{2}}}} \tag{5}\]  
\[RMSE=\sqrt{\frac{1}{n}{\sum\limits_{i=1}^{n}{{{(y_{i}-\hat{y}_{i})}^{2}}}}} \tag{6}\]