## 3 Results and Discussion
### Machine Learning Prediction of Porosity
By performing statistical analysis and examination of the iteration counts and prediction results for each fold, a more comprehensive, accurate, and reliable predictive model was obtained. Within the five-fold cross-validation, this approach demonstrated high accuracy and robustness, providing strong support for practical applications. Additionally, the analysis of evaluation indicators indicated the superiority of the DBO-RF model for porosity prediction in TBCs. These analytical findings will serve as important references for further model optimization and predictive applications. Figure 17: Prediction of porosity by DBO-RF model. Based on the analysis of terahertz signals, it was observed that the TBCs' porosity was influenced by multiple feature parameters to varying extents. In the model construction phase, multi-feature fusion parameters were adopted as the input, and the random forest model was trained and optimized using the DBO algorithm. Compared to the predictive models relying on single feature parameters, the predictive model incorporating the multi-feature feature parameters allowed for a more comprehensive exploration of the relationship between porosity and several other parameters, leading to enhanced prediction accuracy and stability. Through the application of terahertz spectroscopy, terahertz multi-feature parameters were obtained and utilized as inputs to construct a DBO-RF prediction model for accurately predicting the TBCs' porosity. Experimental validation was conducted, yielding reliable and precise prediction results. The five-fold cross-validation methodology was employed to evaluate the model, and performance evaluation metrics such as RMSE, MAE, MAPE, and R\({}^{2}\) were utilized. The results demonstrated that the constructed DBO-RF prediction model exhibited high accuracy and robustness during the five-fold cross-validation, as indicated by the attainment of favorable levels of average RMSE, MAE, and MAPE. Furthermore, the regression coefficients provided evidence of the model's excellent fitting performance. Our study incorporates multiple terahertz feature parameters to enable precise evaluation of porosity in TBCs. Furthermore, when combined with machine learning models, this approach facilitates accurate porosity prediction. Unlike some researchers who rely solely on single feature parameters to characterize porosity, our approach provides a more \begin{table}
\begin{tabular}{c c c c c} \hline
**K-Fold** & **RMSE** & **MAE** & **MAPE** & **R\({}^{2}\)** \\ \hline K1 & 1.077 & 0.962 & 6.108 & 0.942 \\ \hline K2 & 3.329 & 3.219 & 10.261 & 0.872 \\ \hline K3 & 1.211 & 0.982 & 7.052 & 0.928 \\ \hline K4 & 1.764 & 1.375 & 9.725 & 0.906 \\ \hline K5 & 1.629 & 1.205 & 8.665 & 0.911 \\ \hline Average & 1.802 & 1.549 & 8.362 & 0.912 \\ \hline \end{tabular}
\end{table} 
Table 1: DBO-RF-Crossválind model performance evaluation. Figure 18: Five-fold iteration results: (**a**) first fold; (**b**) second fold; (**c**) third fold; (**d**) fourth fold; (**e**) fifth fold. comprehensive representation. Additionally, machine learning models offer broader applicability compared to the limitations of linear fitting and regression for porosity calculations. They have consistently demonstrated outstanding performance and robustness, providing valuable insights for enhancing the performance and quality control of TBCs. Furthermore, our research contributes to the interdisciplinary field by integrating THz-TDS technology with machine learning algorithms from materials science and information science. This comprehensive approach paves the way for future studies in nondestructive testing and porosity evaluation across various materials, offering a promising avenue for research.