# Downscaling of Remote Sensing Soil Moisture Products That Integrate Microwave and Optical Data
## 2 Materials and Methods
### Methods
#### 2.3.2 Xg  
XGB is an efficient gradient boosting algorithm that gradually reduces the prediction error of the model by combining multiple weak learners (usually decision trees) into a strong learner. It uses an additive model, that is, it predicts by adding a series of tree models and trains the model by minimizing the objective function.  
The objective function includes the loss function and the regularization term:  
\[L(\theta)=\sum_{i=1}^{n}l(y_{i},\dot{\hat{y}}_{i})+\sum_{k=1}^{K}\Omega(f_{k}) \tag{3}\]  
\[l(y_{i},\dot{\hat{y}}_{i})=\textit{loss}(\dot{y}_{i},y_{i}) \tag{4}\]  
\[\Omega(f)=\gamma T+\frac{1}{2}\lambda\sum_{j=1}^{T}\omega_{j}^{2} \tag{5}\]  
Among them, \(l\) is the loss function. \(\Omega(f)\) is the regularization term; \(T\) is the number of leaf nodes in the tree; \(\omega_{j}\) is the weight of the j leaf node; \(\gamma\) and \(\lambda\) are hyperparameters; and \(\Omega(f)\) is used to control the complexity of the model to prevent overfitting.  
XGB performs first-order and second-order [PERSON] expansion on the loss function to approximate the gradient and Hessian matrix of each step, thereby optimizing the model more efficiently. Assume \(g_{i}=\frac{\partial l}{\partial\dot{y}_{i}}\) and \(h_{i}=\frac{\partial^{2}l}{\partial\dot{y}_{i}^{2}}\), and the update rule is as follows:  
\[Gain=\frac{1}{2}\cdot\frac{\left(G\right)^{2}}{H+\lambda} \tag{6}\]  
Among them, G is the gradient sum of the current node (that is, the sum of the first-order derivatives), and H is the Hessian matrix of the current node (that is, the sum of the second-order derivatives).  
XGB builds trees in an iterative manner, adding one tree at a time to reduce the residual error of the previous model. For each tree \(f_{k}\), the update is as follows:  
\[\dot{\hat{y}}_{new}=\dot{\hat{y}}_{old}+\eta f_{k}(x) \tag{7}\]  
where \(\eta\) is the learning rate, and \(f_{k}\) is the number of newly added trees.  
Final prediction results:  
\[\dot{\hat{y}}=\sum_{k=1}^{K}f_{k}(x)=\dot{\hat{y}}_{0}+\sum_{k=1}^{K}\eta f_{k} (x) \tag{8}\]  
In this study, RF and XGB modeling were implemented through machine learning libraries (scikit-learn, XGB), and the GridSearchCV strategy was used to automatically adjust the optimal fitting parameters. The specific parameter settings are shown in Table 2, and the experimental process is shown in Figure 2.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**RF** & & **XGB** & \\
**Parameter Name** & **Parameter Range** & **Parameter Name** & **Parameter Range** \\ \hline n\_estimators & [5, 20, 30, 60, 80, 100] & learning\_rate & [0.2, 0.3] \\ max\_features & [’auto’, ’sqrt’] & n\_estimators & [20, 50, 60] \\ max\_depth & [10, 20, 30,..., 120] & reg\_lambda & [0.1, 10, 20] \\ min\_samples\_split & [2, 6, 12] & max\_depth & [2, 3] \\ min\_samples\_leaf & [1, 3, 4] & min\_child\_weight & [1, 2, 4, 6] \\ bootstrap & [True, False] & seed & [17, 27] \\ \hline \hline \end{tabular}
\end{table}
Table 2: The model parameter setting details of random forest (RF) and extreme gradient boosting (XGB).