## 3 Results
### Optimal Combination of Algorithms and Models  
The average values of the two evaluation metrics for predicting all five lithology classes using different balanced datasets were recorded over 10 test runs for each model, and corresponding box plots were drawn (Figure 10). Based on the results of all models on the five training datasets, the following important findings were observed: (1) Models performed poorly on the original dataset and the ENN under-sampled dataset, showing a large range and low average scores. This is because the original dataset has very few samples corresponding to the S and CS labels, and the ENN under-sampling algorithm further exacerbates the imbalance issue by removing samples. Therefore, accuracy did not significantly improve compared to the original dataset and, in some cases, even fell below the results of the models on the original dataset; (2) ADASYN and SMOTE are over-sampling algorithms for classes with fewer samples. They generally have a positive impact on the lithology recognition model, primarily reflected in the improvement of the median accuracy, and the results after improvement are relatively consistent across models; (3) The comprehensive balancing method of ADASYN+ENN has significant advantages over all previous results, with the highest average scores and the smallest range. The overall results are relatively stable. These findings are consistent with the performance of the three models, indicating that data balancing algorithms have a certain degree of universality in their impact on models. The random forest model demonstrated the best overall performance, and it exhibited the most stable performance on the dataset processed using the ADASYN+ENN method. Therefore, ADASYN+ENN+RF is the best method combination in this study. According to the test scores of the two metrics for predicting all five lithology classes on the test set using random forest (Table 4), on the original imbalanced dataset, the model's prediction performance is relatively poor for the S and CS lithology classes, while higher scores are achieved when predicting the more abundant M and FS classes. Random forest, when trained on the balanced dataset obtained through the ADASYN+ENN method, learned from the added synthetic samples, leading to a significant improvement in prediction accuracy for the originally under-represented S and CS classes. Additionally, the prediction performance for the PS class also benefited from the ADASYN+ENN method, with scores showing some improvement. For the M and FS classes, the sampling method has almost no negative impact, and the model's prediction scores remain at a high level. \begin{table}
\begin{tabular}{c c c c c c c} \hline
**Score** & **Dataset** & **M** & **S** & **FS** & **CS** & **PS** \\ \hline Jaccard & Raw & 0.910 & 0.802 & 0.841 & 0.820 & 0.906 \\ Index & ADASYN+ENN & 0.910 & **0.847** & **0.884** & **0.861** & **0.913** \\ \hline F1 Score & Raw & 0.955 & 0.785 & 0.893 & 0.823 & 0.942 \\ ADASYN+ENN & 0.955 & **0.901** & **0.942** & **0.939** & **0.949** \\ \hline \end{tabular}
\end{table} 
Table 4: Comparison of lithology discrimination scores for random forest model: original training set vs. ADASYN+ENN balanced dataset. Visualizing the lithology discrimination performance of the random forest model on the test data (Figure 11), the figure includes seven well log curves and three bar charts: lithology labels from mud logging core, predictions from the random forest model trained on the original dataset, and predictions from the random forest model trained on the dataset balanced using the ADASYN+ENN method. From a global perspective, the results shown in \"No Balancing\" exhibit more noise, while the results shown in \"ADASYN+ENN\" demonstrate a noticeable noise reduction. This reflects the significant role of sample balancing methods in improving the model's lithology discrimination result. Further observation reveals that in the \"No Balancing\" results, noise is mainly concentrated in the sandstone (S) and coarse sandstone (CS) reservoirs.