## 2 Force Modeling for Machining Stability Analysis
### Bayesian Optimization for Hyperparameter Tuning  
To enhance the predictive accuracy of the XGBoost model, Bayesian optimization is employed for hyperparameter tuning. Unlike traditional grid search or random search methods, Bayesian optimization utilizes a probabilistic model to efficiently explore the hyperparameter space and identify the best combination with fewer iterations [17]. The optimization process focuses on maximizing the model's coefficient of determination (R\({}^{2}\) score):  
\[\text{R}^{2}=1-\frac{\sum(y_{i}-\hat{y}_{i})^{2}}{\sum(y_{i}-\overline{y})^{2}} \tag{14}\]  
where \(y_{i}\) represents the actual (ground truth) values, \(\hat{y}_{i}\) represents the predicted values, and \(\overline{y}\) is the means of the actual values. The numerator is the Residual Sum of Squares (RSS), quantifying the error between actual and predicted values, while the denominator is the Total Sum of Squares (TSS), reflecting overall variance in the data. A higher R\({}^{2}\) indicates better model performance and prediction accuracy. Bayesian optimization is a sequential model-based optimization (SMBO) technique that efficiently optimizes expensive-to-evaluate functions. Unlike brute-force approaches, it builds a probabilistic surrogate model of the objective function and selects new sample points based on an acquisition function, balancing exploration (searching new areas) and exploitation (refining known good areas). Mathematically, the black-box function \(f(x)\), where \(x\) represents hyperparameters, is modeled using a Gaussian Process (GP):  
\[f(x)\ \sim GP\big{(}m(x),\ k\big{(}x,\ x^{\prime}\big{)}\big{)} \tag{15}\]  
where \(m(x)\) is the mean function, representing the excepted value of \(f(x)\) and \(k(x,\ x^{\prime})\) is the covariance function, defining the relationship between points \(x\) and \(x\prime\). The next sample point is determined using an acquisition function \(a(x)\), which quantifies the utility of sampling at \(x\). In this study, we employed the Upper Confidence Bound (UCB) strategy, which balances exploration and exploitation by considering both the predicted mean and uncertainty from the surrogate model. The UCB is defined as:  
\[UCB(x)=\mu(x)-\kappa\sigma(x) \tag{16}\]  
where \(\mu(x)\) is the predicted mean from the Gaussian Process, \(\sigma(x)\) is the standard deviation (uncertainty) and \(\kappa\) is a trade-off factor that controls the balance between exploration and exploitation. Figure 7: Feature importance scores from the trained XGBoost model. By iteratively updating the GP model and selecting new points via the acquisition function, Bayesian optimization efficiently finds the best hyperparameters with minimal function evaluations. Bayesian optimization exhibits a progressive increase in R\({}^{2}\) scores over iterations, as shown in Figure 8a. This improvement trend is clearly highlighted by a moving average curve with a window size of 100. The optimization process reaches a peak R\({}^{2}\) score of 0.7887 at iteration 568, demonstrating successful convergence toward high-performing hyperparameter configurations. In contrast, Figure 8b presents the convergence behavior of Random Search under the same evaluation budget (800 iterations). The R\({}^{2}\) scores in this case remain largely concentrated around 0.1, with no apparent upward trend or convergence pattern, indicating the inefficiency of random sampling in navigating the hyperparameter space. These results confirm the superior efficiency and effectiveness of Bayesian optimization in identifying optimal model parameters with fewer evaluations. To achieve optimal predictive performance, Bayesian optimization fine-tunes the following key hyperparameters in XGBoost:  
1. Tree-based Parameters: * Number of estimators: Controls the number of boosting rounds, which is set to 201. * Tree depth: Determines the complexity of individual trees, which is set to 13. * Learning rate: Regulates the step size of updates to avoid overfitting, which is set to 0.2055.