## 3 Methods
### Improved RF Models
#### 3.5.2 Improved Weights Based on Three Metaheuristic Algorithms  
In this section, we consider the weights of decision trees in a forest as an unknown space of high dimensionality to be solved. After determining the number of trees in a forest, the dimension of the space to be solved is equal to the number of trees. Then, the GWO, WOA, and TSA algorithms are used to capture the optimal weights in the unknown space. To achieve this goal, it is assumed that the independent variables to be solved  
Figure 4: Flowchart of the design of the RF and improved RF models.  
are set to \(\{x_{1},\ x_{2},\ x_{3},\ \cdots,\ x_{t}\}\), where \(t\) is the number of trees and the range of \(x\) is in the interval [0, 1], and then the standardized weights are computed as follows:  
\[\text{weight\_optmization}_{i}=\frac{x_{i}}{\sum_{i=1}^{t}x_{i}} \tag{32}\]  
where \(\text{weight\_optmization}_{i}\) represents the weights of decision trees optimized by the metaheuristic algorithms, and it is clear that \(\sum_{i=1}^{t}\text{weight\_optimization}_{i}=1\).  
After that, the RMSE is considered the criteria used to evaluate each result's performance. In other words, the fitness function that needs to be solved by the metaheuristic algorithms is the RMSE function. Moreover, the L2 regularization (also named penalty terms) is also incorporated in the RMSE function, which avoids overfitting. Therefore, the fitness function consists of two parts: the RMSE function and the L2 regularization, which is presented by Equation (34):  
\[y_{pre}=\sum_{i=1}^{t}\text{weight\_optmization}_{i}\times Tree_{i}(x) \tag{33}\]  
\[\text{Fitness function}=\sqrt{\frac{1}{m}\sum_{i=1}^{m}\bigl{(}y_{i}-y_{pre} \bigr{)}^{2}}+\gamma\times\sqrt{\sum_{i=1}^{t}\text{weight\_optmization}_{i} ^{2}} \tag{34}\]  
where \(y_{pre}\) denotes the predicted PPV computed by the improved RF model based on optimization algorithms, \(m\) is the number of training samples, and \(\gamma\) is the coefficient of the L2 regularization, whose value is set to 0.08 in this paper according to the trial-and-error method.  
For the GWO, WOA, and TSA, the parameters that need to be set are the swarm sizes and the number of iterations. The appropriate selection of these parameters can effectively and quickly lead to optimal results. Therefore, after constructing the model several times, the swarm sizes set to each optimization algorithm are 50, 100, 150, and 200, respectively, and the number of iterations is set at 1000.  
The GWO, WOA, and TSA optimization techniques can be used to improve the RF model in the following way:  
1. Data preparation: randomly divide the raw data into a training set (80% of raw data) and a testing set (20% of raw data);
2. Initialization: Initialize the swarm size, iterations, as well as some necessary parameters of the three optimization algorithms;
3. Fitness evaluation: Calculate the fitness value of the population, evaluate its fitness, and then save the best fitness value before starting the next iteration;
4. Update parameters: Update the fitness value based on the outcome of each iteration, which aims to capture the ideal solutions;
5. Suspension conditions check: When the optimal fitness value no longer changes, or the maximum number of iterations is reached, the optimal solutions of the weights of decision trees are obtained.