## 4 Modeling
### Model Training  
Optimizing the XGBoost model is crucial for enhancing its predictive performance and generalization capability. As an ensemble learning algorithm, XGBoost excels in handling complex data. However, an unoptimized model can consume excessive computational resources and time and is prone to overfitting. Therefore, this study employed ZOA and BO to optimize XGBoost, improving the model's efficiency and scalability. ZOA simulates the collective behavior of zebra groups to achieve global search and optimization in a multidimensional parameter space, demonstrating good convergence and global search capabilities. BO uses Bayesian inference to establish a probabilistic model of the objective function, quickly finding the optimal solution within a limited number of iterations and showing strong robustness to noise. The application of ZOA and BO makes XGBoost more efficient in handling complex data. The model construction process is detailed below. Given the numerous hyperparameters in XGBoost, this study focused on optimizing those that significantly impact model training [26]. Hyperparameters related to the base learner (decision trees) and the gradient boosting framework are key components affecting model performance. Parameters such as \"n_estimators\", \"max_depth\", \"learning_rate\", and \"gamma\" influence the construction and optimization of each tree. \"reg_alpha\" and \"reg_lambda\", which control the complexity and stability of the overall model through regularization, help prevent overfitting. Therefore, \"n_estimators\", \"max_depth\", \"learning_rate\", \"gamma\", \"reg_alpha\", and \"reg_lambda\" were selected for optimization. The optimization ranges for these hyperparameters are shown in Table 2. Considering that some hyperparameters are integers while ZOA generates candidate solutions as continuous values, rounding was applied to convert these values into integers, thereby ensuring that the hyperparameters met their discrete constraints. This approach maintains the effectiveness of the search and addresses non-convex issues arising from discretization, ensuring stable convergence to the optimal solution. For BO, the method evaluated the objective function at discrete points to maintain integer constraints, enhancing optimization efficiency and performance within a limited number of iterations. In the process of optimizing the model hyperparameters using ZOA, population size and the number of iterations are critical parameters. Population size determines the \begin{table}
\begin{tabular}{c c c} \hline \hline
**Hyperparameters** & **Minimum Value** & **Maximum Value** \\ \hline n\_estimators & 1 & 500 \\ max\_depth & 1 & 25 \\ learning\_rate & 0.001 & 1 \\ gamma & 0 & 5 \\ reg\_alpha & 1 & 15 \\ reg\_lambda & 1 & 15 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Optimization ranges for XGBoost hyperparameters. Figure 3: Calculation of evaluation indicators. number of zebra individuals in each generation, while the number of iterations represents the total generations executed by the algorithm. A larger population size can enhance the global search capability but also increase computational cost; conversely, a smaller population size may lead the algorithm to fall into local optima. Thus, a balance between global exploration and computational cost is essential. The choice of iteration number depends on the problem's complexity and computational resource constraints. Generally, more iterations allow the algorithm to find better solutions, but excessive iterations may increase computation time and degrade convergence performance. After multiple tests, six population sizes (30, 50, 70, 90, 110, and 130) were finally set, and XGBoost was trained through 100 iterations. It is worth noting that the selection of the number of iterations considered the variations in the accuracy of the model. Initially, the iteration count was set to 50 and it was incrementally increased to assess its impact on model accuracy. As the iteration count increased, the accuracy improved and eventually stabilized.