## 4 Algorithm Analysis
### Experimental Results and Comparisons  
#### 4.3.1 Experimental Results  
The hyperparameters of the XGBoost model are initialized, with the number of iterations (n_estimators), learning rate (learning_rate), maximum tree depth (max_depth), and minimum sample weight of child nodes (min_child_weight) selected as the hyperparameter optimization targets for XGBoost. The range of n_estimators is set between 50 and 500 to achieve a balance between training time and model performance. The learning_rate is defined within the range of 0.01 to 0.3, as smaller values are beneficial for enhancing the model's generalization capability. The max_depth parameter is constrained to a range of 3 to 10, where smaller values mitigate the risk of overfitting, while larger values enable the model to capture more intricate nonlinear relationships. The range of min_child_weight is set between 1 and 10, with larger values effectively mitigating overfitting and promoting a more simplified tree structure. By optimizing the hyperparameters within these ranges, the objective is to determine the most appropriate XGBoost model configuration for the specific problem under investigation. The introduction of the WOA mainly focuses on solving the global optimal solution problem. Compared to traditional optimization algorithms, WOA effectively improves the ability to find the global optimal solution in complex high-dimensional spaces through three different search mechanisms. Although WOA performs excellently in these classical test scenarios, its performance in practical applications still needs further validation. In this paper, the SSA, PSO, GA, and WOA [53; 54; 55] are used to optimize the hyperparameters of XGBoost. The time taken, the optimal solution of the XGBoost hyperparameters, and the Mean Absolute Error (MAE) of the test set are recorded. The maximum number of iterations for the algorithm is set to 150, with a population size or particle count of 30. Other parameters of the algorithm are shown in Table 4. The results obtained are presented in Table 5.  
As presented in the table, WOA-XGBoost completed the hyperparameter optimization in 3341 seconds, the fastest time, and also achieved a lower MAE. This indicates that WOA can quickly converge to the global optimum during optimization, thereby improving the model's prediction accuracy. Thus, WOA was chosen as the optimization algorithm for XGBoost. To determine the optimal population size for WOA on this dataset, the training set is divided using the same method, and the XGBoost hyperparameters are initialized. The WOA is set to iterate 150 times, with population sizes of 25, 50, 75, 100, and 125 for experimental comparison. As this is a multi-output machine learning model, the mean of the Mean Squared Error (\(MSE\)) corresponding to each output feature is used as the fitness function for the model. The formula for the \(MSE\) is as follows:  
\[MSE\ =\ \frac{1}{k}\sum_{j\ =\ 1}^{k}\left(\hat{y}_{j}-y_{j}\right)^{2} \tag{21}\]  
By evaluating the fitness changes after each iteration, the impact of different population sizes on the model can be assessed, as shown in Figure 6. It is evident that before the 20 th iteration, the fitness decreases rapidly, indicating the significant impact of the WOA optimization algorithm on the hyperparameter selection for XGBoost [56]. After 60 iterations, the model fitness stabilizes for all population sizes, with particularly fast convergence observed when the population size is 25. The smallest fitness value, 0.2229, is obtained with a population size of 100 after 59 iterations. The model's performance was evaluated using three metrics: MAE, RMSE, and R\({}^{2}\). The results are provided in Table 6.  
As shown in the table, the training set's MAE does not exceed 0.05, the RMSE remains below 0.16, and the R\({}^{2}\) exceeds 0.95 in all cases. For the test set, R\({}^{2}\) values consistently exceed 0.92, demonstrating strong predictive accuracy for the sample data.