# Prediction of Carbonate Reservoir Porosity Based on CNN-BiLSTM-Transformer
## 2 Methods
### Data Description  
The experimental data in this study were obtained from actual logging data of 14 cored wells in the Movic Gas Field, Sichuan, China. The logging depth ranges from 1600 to 3300 m, comprising a total of 2409 sets of logging data samples. The study involves eight types of logging data: caliper logging (CAL), natural gamma ray logging (GR), acoustic logging (AC), compensated neutron logging (CNL), density logging (DEN), flushed zone resistivity  
Figure 2: Flow chart of the CNN-BiLSTM-Transformer prediction model for porosity. (RXO), true formation resistivity (RT), and core analysis porosity (POR). The statistical analysis of the logging curve data is presented in Table 2.  
The lithology of this block mainly consists of dolomite, limestone, and gypsum rocks. Dolomite and limestone serve as the primary reservoir rocks, while gypsum, with extremely poor physical properties, mostly acts as interlayers or cap rocks. Due to the strong heterogeneity of carbonate reservoirs, there are significant differences among the logging curves. These curves exhibit wide distribution ranges, inconsistent units of measurement, and diverse distribution characteristics. For example, the data show large variations in magnitude, necessitating logarithmic transformation to better represent data features. Therefore, further analysis and processing of the raw data are required. Data quality has a significant impact on the predictive performance of machine learning models, making preprocessing a critical step in data mining and machine learning. The preprocessing methods employed in this study include handling outliers and missing values, resampling, and normalization. First, the data integrity was assessed, and missing data were addressed through interpolation or curve reconstruction. Outliers were removed, and logarithmic transformation was applied to mitigate the issue of large data range disparities, thereby improving data quality. Insufficient data samples and the randomness involved in splitting the training and testing sets can lead to model underfitting. This issue was addressed by applying data resampling techniques and adopting continuous sampling to preserve the neighborhood feature information in the depth sequence. In data prediction tasks, inconsistent data scales can heavily influence model performance. To eliminate the impact of inconsistent data dimensions--where large numerical differences among individual indicators can distort weight ratios--and to accelerate gradient descent, this study employed min-max normalization. This technique standardizes data into a consistent measurement scale, enhancing prediction accuracy and reducing training time. The specific normalization formula is as follows:  
\[x_{i}^{*}=\frac{x_{i}-x_{min}}{x_{max}-x_{min}} \tag{1}\]  
where  
\(x_{i}\) is the input feature variable data;  
\(x_{i}^{*}\) is the normalized feature variable;  
\(x_{max}\) is the maximum value of feature variable data;  
\(x_{min}\) is the minimum value of feature variable data. This process ensures that all data are scaled within the range [0, 1], enabling the model to learn more effectively. Based on geological data, depositional background, and geophysical logging knowledge of the study area, a correlation heatmap of logging curves was constructed using Pearson correlation coefficients, and the logging data were analyzed for correlation. Log \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Logging Curves** & **Mean** & **Std Deviation** & **Min** & **Max** \\ \hline GR (API) & 26.71 & 16.37 & 1.1 & 142.36 \\ CAL (cm) & 6.69 & 2.55 & 5.35 & 15.85 \\ DEN (g/cm\({}^{3}\)) & 2.77 & 0.1 & 2.33 & 2.99 \\ CNL (\%) & 5.22 & 4.41 & \(-\)3.17 & 23.94 \\ AC (us/ft) & 52.99 & 6.72 & 43.76 & 92.39 \\ Rt (f\(\Omega\)m) & 580.34 & 2455.68 & 2.06 & 40,000 \\ Rxo (\(\Omega\)m) & 568.62 & 2157.62 & 1.93 & 33,347.28 \\ POR (\%) & 3.69 & 3.84 & 0.01 & 26.75 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Statistic of logging curves for experimental data points.