## 2 Methodology
### Data Preprocessing  
Data preprocessing plays a vital role in data analysis and model development. Raw data often contain missing values, outliers, and various inconsistencies which, if not properly addressed, can significantly degrade model performance and prediction accuracy. In this study, the original well-logging dataset contained both outliers and missing values. To ensure data quality and integrity, a comprehensive preprocessing pipeline was implemented. First, outlier detection was performed using the K-means clustering algorithm. K-means effectively groups similar data points into clusters, while abnormal data points tend to fall on the periphery of clusters or form small, isolated groups--making them easier to identify. During clustering, the data were partitioned into K clusters, and potential outliers were identified based on their distance from the cluster centroids. If a data point's distance exceeded the predefined cluster radius, it was flagged as an outlier. The absolute distance was calculated using the following method:  
\[\mathrm{d}\left(\stackrel{{\rightarrow}}{{x}}_{i},\stackrel{{ \rightarrow}}{{x}}_{j}\right)=\sum_{k=1}^{p}\left|x_{ik}-x_{jk}\right| \tag{1}\]  
where \(\stackrel{{\rightarrow}}{{x}}_{i}=\left(x_{i1},x_{i2},\ldots,x_{ip }\right)^{\prime}\), \(\stackrel{{\rightarrow}}{{x}}_{j}=\left(x_{j1},x_{j2},\ldots,x_{ ip}\right)^{\prime}\), \(\stackrel{{\rightarrow}}{{x}}\) is a feature vector. For missing values, appropriate interpolation methods were applied based on the nature of each variable. These methods ensured data completeness and preserved the statistical characteristics of the dataset, thereby improving the robustness of the model during training. To predict cement bond quality, a 1 m interval was chosen as the minimum unit for analysis. All input data for the models were interpolated at 1 m intervals and aligned along the depth domain to ensure consistency and accuracy in the model inputs. The azimuthal angle, being cyclical (ranging from 0\({}^{\circ}\) to 360\({}^{\circ}\) or equivalently in radians), poses challenges for linear interpolation, as it may introduce discontinuities (e.g., interpolating between 350\({}^{\circ}\) and 10\({}^{\circ}\) incorrectly spans the full range). A cylindrical helix interpolation method was used to address this issue, ensuring smooth and consistent interpolated values. Other data were processed using the linear interpolation method. Casing centralizers were not installed on every casing section. For this study, the positions where centralizers were installed were encoded as \"1\", while positions without centralizers were encoded as \"0\". The supervised learning model developed in this study predicts the cement bond quality of both the interface between the casing and the cement sheath, and the interface between the cement sheath and the formation. Based on the interpretation results of acoustic amplitude and variable-density logging results, the quality of these two interfaces \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Category** & **Feature** & **Variable** & **Category** & **Feature** & **Variable** \\ \hline \multirow{4}{*}{Drilling} & Well depth & \(x_{1}\) & & Casing size & \(x_{11}\) \\ \cline{2-5}  & Borehole diameter & \(x_{2}\) & & Centralizer position & \(x_{12}\) \\ \cline{2-5}  & Drill bit size & \(x_{3}\) & & Drilling fluid density & \(x_{13}\) \\ \cline{2-5}  & Deviation angle & \(x_{4}\) & & Preflush density & \(x_{14}\) \\ \cline{2-5}  & Azimuth angle & \(x_{5}\) & & Cement slurry density & \(x_{15}\) \\ \hline \multirow{4}{*}{Geological} & Formation fluid density & \(x_{6}\) & & Cement slurry flow rate & \(x_{16}\) \\ \cline{2-5}  & Acoustic travel time & \(x_{7}\) & & Preflush flow rate & \(x_{17}\) \\ \cline{2-5}  & Wellbore temperature & \(x_{8}\) & & Rheological Properties & \(x_{18}\) \\ \cline{2-5}  & Gamma ray & \(x_{9}\) & & Annular clearance & \(x_{19}\) \\ \cline{2-5}  & Wellbore pressure & \(x_{10}\) & & Water-cement ratio & \(x_{20}\) \\ \hline \hline \end{tabular}
\end{table}