# Prediction of Carbonate Reservoir Porosity Based on CNN-BiLSTM-Transformer
## 2 Methods
### Method Process  
Well logging curves have high vertical resolution, allowing for the continuous and quantitative characterization of sedimentary processes and providing geological information at different depths. To establish a nonlinear relationship between well logging curves and core analysis porosity while improving the accuracy of carbonate reservoir porosity prediction, this study proposes a deep learning model based on a convolutional neural network (CNN), bidirectional long short-term memory Network (BiLSTM), and Transformer (CNN-BiLSTM-Transformer). This model is applied to predict the porosity of the Jialingjiang Formation in the study area. To comprehensively evaluate the model's effectiveness, ablation experiments are conducted to compare the prediction performance of different model structures, verifying the role of the CNN, BiLSTM, and Transformer layers in the prediction task. The methodological workflow of this study is illustrated in Figure 2, comprising data preprocessing, feature engineering, deep learning model construction, performance evaluation, and ablation experiments. The specific process is as follows:  
1. Data Preprocessing: Before training the model, data preprocessing steps such as data cleaning, normalization, and data augmentation are performed to improve data quality and ensure model stability.
2. Model Construction: (1) Feature and Label Extraction: Feature variables suitable for machine learning methods are selected from raw data to construct the dataset. (2) Selection of Sensitive Parameters: A Pearson correlation coefficient heatmap is generated  
Figure 1: Work area of Moxi block: (**a**) tectonic divisions of Sichuan Basin (adapted from Shi, 2023) [(20)]. (**b**) Location map of the studied wells in the Moxi area. Red dots are wells used to train machine learning models. (**c**) Stratigraphic characteristics of the Jia 2 member in the study area.  
to analyze and select porosity-sensitive parameters, providing better feature representation for the model. (3) Dataset Partitioning: The dataset is split into 80% training data and 20% testing data. To maintain the continuity of deep sequential data, training and testing sets are divided as continuous segments. (4) Deep Learning Model Development: The CNN layer first extracts local features, followed by the BiLSTM layer capturing long-term dependencies in deep sequential data. Finally, the Transformer layer applies a self-attention mechanism to focus on sequential neighborhood information and logging curve features, capturing global dependencies. This results in the CNN-BiLSTM-Transformer porosity prediction model. (5) Model Evaluation: The model's performance is assessed using the RMSE, MAE, and R2 metrics.
3. Ablation Experiment: To validate the model's effectiveness, a comparative analysis is conducted by removing different network layers while keeping all other factors constant, examining their impact on model performance.
4. Model Finalization: Based on steps (2) and (3), a comprehensive comparison is conducted to determine the most suitable porosity prediction model for the study area.
5. Model Application: The optimized CNN-BiLSTM-Transformer model is applied to predict porosity in the Jialingjiang Formation. The predictions are compared with actual well logging data to validate the model's practical applicability.