## 3 Methods
### Random Forest Model Construction and Parameters Optimization
#### 3.3.2 Model Parameter Optimization
We compare two Bayesian optimization algorithms; one is based on Gaussian process (GP) modeling and the other is based on gradient boosting regression trees (GBRT). Gaussian Process is a probabilistic model assuming that the objective function is a continuous and smooth function, estimating the distribution of the objective function across the entire parameter space based on available data points. GBRT is an ensemble learning method that combines multiple decision trees to model the target function. It iteratively fits the model and optimizes the loss function to improve predictive performance. Both methods optimize iteratively, updating models based on feedback from the objective function at each iteration, and find the optimal solution within a limited number of iterations. However, their strategies for selecting the next sampling point differ slightly. We compare these two strategies and ultimately choose the most suitable approach for modeling. Compared to traditional grid search and random search methods, Bayesian optimization is more efficient, especially in high-dimensional parameter spaces, allowing it to find the optimal solution more quickly. Compared with genetic algorithm and simulated annealing, Bayesian optimization can model and infer uncertainties using prior information and posterior probabilities, and have better ability to handle noise and uncertainty cases. Furthermore, this method can quickly find the global optimal solution without manually setting parameters. In the process of parameter optimization, this paper takes into account the complexity of the research and the size of the sample set, and sets the parameters for the above-mentioned parameter optimization methods based on empirical adjustment. Among them, the range of hyperparameters for the random forest is constrained as shown in Table 4.  
Cross-validation is a method for evaluating model performance. It involves repeatedly splitting the dataset into different training and testing sets, training and testing the model multiple times, and obtaining scores for the model on different dataset splits. This approach ensures that all data is thoroughly used for training and testing, helps understand how the model handles different data subsets, effectively prevents overfitting [56], and improves the accuracy and stability of the model. Specifically, parameter selection is performed according to the following steps:  
1. Data Splitting: We partition the training dataset into 5 independent and equally sized subsets, referred to as \"folds,\" and no replacement is made. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Parameter** & **Min** & **Max** \\ \hline n\_estimators & 100 & 500 \\ max\_depth & 3 & 27 \\ max\_features & 1 & 27 \\ min\_samples\_split & 2 & 15 \\ min\_samples\_leaf & 1 & 10 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: The range of random forest hyperparameters. Model Training and Validation: In each training round, we perform 5 iterations, where in each iteration, 4 of the folds are chosen, and we combine them with parameter optimization methods to train the model. The remaining 1 fold is used as the validation set, and we calculate the R2_score to evaluate the model produced during this training session. After 5 iterations, we obtain 5 performance evaluation metrics. 3 Model Evaluation: We compute the average of the performance metrics from all 5 iterations and use it as the performance metric for that round of model training. In the end, we select the optimal parameter set obtained through cross-validation evaluation in each method's training to construct the population spatialization model.