# Prediction of Carbonate Reservoir Porosity Based on CNN-BiLSTM-Transformer
## 3 Results
### Model Evaluation  
To verify the accuracy and reliability of the proposed model, this study constructs four porosity prediction models--XGBoost, LSTM, BiLSTM, and CNN-BiLSTM-Transformer--based on preprocessed well logging data. Comprehensive comparison and analysis of these models are conducted. To quantitatively evaluate the predictive performance and generalization ability of each model, root mean square error (RMSE), mean absolute error (MAE), and the coefficient of determination (R\({}^{2}\)) are used as evaluation metrics. Prediction error analysis is performed on the test set. The model comparison results are shown in Table 3. As indicated in Table 3, the XGBoost model performs the worst, with RMSE, MAE, and R\({}^{2}\) values of 0.029, 0.018, and 0.49, respectively. The improved deep learning models significantly outperform traditional machine learning models. The LSTM model achieves an R\({}^{2}\) of 0.52, while BiLSTM further improves it to 0.75, demonstrating that incorporating bidirectional temporal features enhances predictive capability. The proposed CNN-BiLSTM-Transformer model achieves the best performance, with an R\({}^{2}\) of 0.98 and the lowest RMSE and MAE values. This indicates that the model has a superior ability to learn the complex nonlinear relationships within well logging data. Furthermore, error analysis reveals that XGBoost and LSTM exhibit lower prediction accuracy in regions with strong reservoir heterogeneity. In contrast, the CNN-BiLSTM-Transformer model integrates CNN for local feature extraction, BiLSTM for deep sequential information processing, and Transformer for global dependency modeling. This comprehensive approach enables the model to better capture the complex relationships between well logging curves and porosity, making it more effective for predicting porosity in highly heterogeneous carbonate reservoirs.  
Based on the same processing workflow and dataset, the regression performance of each model for porosity prediction in the training and test s  
Figure 8: Prediction effect comparison histogram.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Algorithm** & **RMSE of Training Set** & **RMSE of Test Set** & \begin{tabular}{c} **MAE of** \\ **Training Set** \\ \end{tabular} & \
\begin{tabular}{c} **MAE of** \\ **Test Set** \\ \end{tabular} &
\begin{tabular}{c} **R\({}^{2}\) of** \\ **Training Set** \\ \end{tabular} & \(R^{2}\) **of Test Set** \\ \hline XGBoost & 0.01 & 0.029 & 0.006 & 0.018 & 0.82 & 0.49 \\ LSTM & 0.026 & 0.028 & 0.018 & 0.018 & 0.54 & 0.52 \\ BiLSTM & 0.008 & 0.02 & 0.002 & 0.017 & 0.81 & 0.75 \\ CNN-BiLSTM-Transformer & 0.005 & 0.004 & 0.003 & 0.003 & 0.98 & 0.98 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Comparison of experimental results.  
As shown in Figure 9, the traditional machine learning model XGBoost demonstrates a certain degree of regression prediction capability. However, the data points in the test set are widely scattered, indicating limited generalization ability and a tendency toward overfitting. In contrast, LSTM and BiLSTM significantly reduce prediction errors by capturing sequential neighborhood features. However, due to the relatively small dataset and the discontinuity in core sampling, LSTM struggles to fully capture deep sequential features, leading to suboptimal predictions for certain data points. Comprehensive comparative analysis shows that the CNN-BiLSTM-Transformer model, by integrating CNN for local feature extraction, BiLSTM for deep sequential modeling, and Transformer for global dependency capture, produces predictions that closely match actual porosity values. The R\({}^{2}\) values for the training and test sets reach 0.99 and 0.98, respectively, indicating the highest prediction accuracy and generalization ability. Compared with the traditional XGBoost model and single deep learning networks, CNN-BiLSTM-Transformer demonstrates significant improvements, proving to be a practical and effective approach for deep-sequence reservoir porosity prediction.