## 2 Materials and Methods
### Machine Learning Prediction and Performance Evaluation
#### 2.5.3 Random Forest Model Optimized by Dung Beetle Optimization Algorithm  
Dung beetle optimizer (DBO) algorithm is utilized to perform iterative searches for finding the optimal solution. This algorithm simulates the interactions among dung beetles  
Figure 8: Flow chart of random forest algorithm. Figure 7: Rules for the division of populations. in the solution space, with the objective of striking a balance between global exploration and local exploitation. The optimization process of the DBO algorithm focuses on optimizing the parameters of the RF algorithm model. More precisely, the DBO algorithm improves the performance and generalization capability of the random forest model by adaptively modifying feature subset selection and the count of decision trees. By utilizing iterative searching and interplays among dung beetle individuals, this algorithm can identify the optimal combination of feature subsets and the number of decision trees, thereby enhancing the accuracy and robustness of the model. The specific optimization steps are as follows. 1. Initialization: The number of dung beetle individuals, maximum iteration count, and relevant parameters (such as perception radius and step size) are set. The positions and directions of each dung beetle individual are randomly initialized. Additionally, the probability of information exchange needs to be determined, which dictates the likelihood of information exchange among dung beetle individuals;
2. Fitness calculation: Using the positions of each dung beetle individual as parameter configurations, the random forest model is trained to predict the porosity of thermal barrier coatings. The fitness value of each individual is calculated by assessing the difference between the predicted results and the actual porosity data. The fitness value is a function of the prediction error, typically measured as the root-mean-square error (RMSE);
3. Iterative update: In each iteration, each dung beetle individual can perceive the positions and directions of neighboring dung beetle individuals. The dung beetle individual's position is adjusted based on the specified movement step size and direction. The hyperparameters of the random forest, such as the number of decision trees and the size of feature subsets, are adapted based on the final positions and directions of the dung beetle individuals;
4. Updating the optimal solution: The fitness value of the new position is compared with the fitness value of the current optimal solution. If the fitness value of the new position is better than the current optimal solution, the current optimal solution is updated to the new position, and the corresponding parameter configuration is recorded. During the optimization process, the dung beetle optimization algorithm progressively updates and iterates the optimal solution to search for an improved RF model;
5. Iterative optimization process: Steps 2 to 4 are repeated until the predefined maximum iteration count is reached or a stopping criterion is met. The stopping criterion can be reaching the maximum iteration count or achieving a small change in fitness value after consecutive iterations, indicating convergence to a stable optimal solution;
6. Outputting the optimal solution: Upon completion of the iterative optimization process in the DBO algorithm, the obtained optimal solution corresponds to the optimized parameter configuration of the RF algorithm. The RF model associated with this optimal solution demonstrates enhanced performance and the ability to accurately predict the TBCs' porosity. In this study, the DBO was employed to adjust and optimize the number of decision trees and the size of feature subsets in a random forest model. More specifically, the internal parameters of the random forest model were treated as adjustable variables, and the DBO algorithm was iteratively applied to determine the optimal combination of these parameters. Afterwards, the RF model was trained using the optimal parameter combination, leading to a significant improvement in performance.