## 2 Basic Principles
### Extreme Gradient Boosting  
Extreme Gradient Boosting (XGBoost) is an ensemble learning algorithm particularly suited for classification and regression tasks in supervised learning. It outperforms most traditional machine learning algorithms and is a significant tool in machine learning [38; 39; 40; 41; 42].  
The XGBoost prediction model can be expressed as the sum of multiple trees:\[\hat{y}_{i}=\sum_{t=1}^{T}f_{t}(x_{i}) \tag{21}\]  
where \(x_{i}\) represents the sample features, \(f_{t}\) denotes the \(t\)-th tree, and \(\hat{y}_{i}\) is the predicted value for the target variable \(y_{i}\).  
The overall objective function of XGBoost is given by  
\[L^{(t)}=\sum_{i=1}^{n}l(y_{i},\hat{y}_{i}^{(t-1)}+f_{t}(x_{i}))+\Omega(f_{t}) \tag{22}\]  
where \(L^{(t)}\) is the expression in the linear space, \(l(\cdot)\) is the model's loss function used to measure the difference between the true value \(y_{i}\) and the predicted value \(\hat{y}_{i}\), \(n\) is the number of samples, \(t\) is the maximum number of iterations, \(\hat{y}_{i}^{(t-1)}\) is the sum of predictions from the first \(t-1\) trees for the \(i\)th sample, \(f_{t}(x_{i})\) is the model of the \(t\)-th tree corresponding to the \(i\)th sample, and \(\Omega(f_{t})\) is the regularization term used to control model complexity.  
During the optimization process of XGBoost, the loss function for constructing decision trees is often approximated using a second-order Taylor expansion. This approximation simplifies computations, particularly when calculating gradients and second-order derivatives. The loss function \(l(\cdot)\) in Equation (23) can be approximated at \(y_{i},\hat{y}_{i}^{(t-1)}+f_{t}(x_{i})\) using the Taylor expansion as follows:  
\[L^{(t)}\approx\sum_{i=1}^{n}\left[l(y_{i},\hat{y}_{i}^{(t-1)})+g_{i}f_{t}(x_{ i})+\frac{1}{2}h_{i}f_{t}^{2}(x_{i})\right]+\Omega(f_{t}) \tag{23}\]  
where \(g_{i}\) and \(h_{i}\) are the first- and second-order derivatives of the loss function with respect to \(f_{t}(x_{i})\), respectively.  
Through this expansion, the model can be iteratively optimized, allowing each newly added tree to effectively reduce the loss. This study addresses a typical regression prediction problem for earthquake fatalities, employing Gradient Boosted Decision Trees (GBDT) as the foundational learning framework. This method iteratively constructs new trees to fit the residuals from the previous step, gradually approaching the optimal solution. The weakest learner (CART tree) in each round is used to correct residuals in the gradient direction based on the previous round's predictions, thereby enhancing the overall fitting capability. This stepwise optimization approach effectively captures nonlinear relationships between variables, demonstrating superior performance in multi-factor earthquake prediction. Although the XGBoost model is powerful, it does carry a risk of overfitting if hyperparameters are improperly selected. To effectively address this issue and improve the model's prediction accuracy and stability, we did not adopt the traditional fixed early-stopping strategy. Instead, we opted for a more intelligent and adaptive approach--using the Improved Whale Optimization Algorithm (IWOA) to intelligently optimize the key hyperparameters of the XGBoost model. Through the WOA algorithm, we can optimize critical hyperparameters such as tree depth, number of iterations, and learning rate to find the optimal parameter combination, effectively controlling overfitting during training and ultimately enhancing the model's overall performance.