Shale lithology intelligent identification method and system based on machine learning and data enhancement

By combining machine learning and data augmentation methods with preprocessing, feature optimization, and mixed data sampling, a KNN-weighted random forest model is constructed. This solves the problems of data imbalance and model optimization in lithology identification under complex geological conditions, and achieves efficient and automated lithology identification.

CN122087381APending Publication Date: 2026-05-26CHONGQING HUADI RESOURCES ENVIRONMENT TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610044864.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-14
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing technologies lack automated lithology identification methods that systematically address data imbalance, optimize feature representation, and efficiently optimize models under complex geological conditions, resulting in subjective and inefficient lithology identification results.

Method used

We employ a machine learning and data augmentation-based approach, using preprocessing, multi-stage feature optimization, mixed data sampling with denoising, augmentation, and equalization, and training a KNN-weighted random forest model to achieve lithology identification.

Benefits of technology

It significantly improves the identification performance of a few types of lithology, achieves high efficiency and accuracy in automated lithology identification, overcomes the class imbalance problem, and improves the optimization efficiency and identification accuracy of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122087381A_ABST
    Figure CN122087381A_ABST
Patent Text Reader

Abstract

This invention provides an intelligent shale lithology identification method based on machine learning and data augmentation. The method includes: S1, acquiring raw well logging data and preprocessing it to output a test set and a training set; S2, defining a multi-stage feature optimization strategy to perform feature optimization on the training set; S3, employing a denoising-augmentation-equilibrium hybrid data sampling strategy to perform hybrid data sampling on the training set; S4, constructing a random forest model based on KNN weighting and Optuna optimization, and training the random forest model; S5, inputting the test set into the random forest model for evaluation. By combining the hybrid data sampling strategy with the sample weighting mechanism, the model's identification performance for all lithologies, especially a few lithology types, is significantly improved. It can systematically address data imbalance and achieve efficient automated lithology identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0002] This invention relates to the technical field of intelligent identification of shale lithology, and specifically to a method and system for intelligent identification of shale lithology based on machine learning and data augmentation. Background Technology

[0004] Current lithology identification techniques still face some practical difficulties and challenges when dealing with complex geological problems like those in the Da'anzhai section. While direct analysis based on core samples is a reliable basis for lithology calibration, its high cost, long analysis cycle, and discontinuous sampling limit its application in constructing continuous, high-density lithology profiles across the entire well section.

[0005] Traditional well logging interpretation methods primarily rely on the expertise and practical experience of well logging interpretation engineers, using methods such as constructing well logging curve intersection charts or applying empirical formulas to determine lithology. These methods depend to some extent on the interpreter's personal experience, potentially leading to subjective results. Furthermore, their processing efficiency for massive amounts of well logging data needs improvement. More importantly, traditional methods are often based on simplified linear or low-order nonlinear models, limiting their ability to capture and express the truly existing high-dimensional, strongly nonlinear mapping relationship between well logging responses and complex lithology.

[0006] In recent years, machine learning algorithms, such as Support Vector Machines (SVM) and Artificial Neural Networks (ANN), have been introduced into the field of lithology identification, improving the level of automation. However, when solving practical problems in the Da'anzhai section, there are still some aspects that need further improvement. First, there is the problem of class imbalance. The natural heterogeneity of geological sedimentation results in a sample size of shale and other main lithologies far exceeding that of specific lithofacies such as siltstone and mudstone. During training, the optimization objective function of standard machine learning models (such as minimizing the overall error) tends to fit the majority class, which may lead to poor performance in identifying the minority lithologies that are geologically important but few in number. Second, there is the optimization of feature representation capabilities. The original well logging curves directly reflect the comprehensive physical properties of rocks. To more effectively distinguish lithologies, it is necessary to systematically mine and construct derived features from the original curves that can better represent the essential differences in lithology. This is a direction worth exploring in depth. Third, there is the efficiency of model construction and optimization. The performance of machine learning models is closely related to the setting of their internal hyperparameters. Traditional manual parameter tuning or grid search methods are time-consuming and may not find the global optimum in high-dimensional parameter spaces.

[0007] In summary, current methods for lithological identification in complex strata lack an automated approach that can systematically address data imbalance, optimize feature representation, and achieve efficient model optimization. Summary of the Invention

[0009] To address the problems existing in the prior art, this invention provides a method and system for intelligent identification of shale lithology based on machine learning and data augmentation, in order to solve the technical problem that the prior art lacks an automated lithology identification method that can systematically address data imbalance, optimize feature representation, and achieve efficient model optimization.

[0010] This invention provides a method for intelligent identification of shale lithology based on machine learning and data augmentation, comprising:

[0011] S1. Collect raw logging data, preprocess it, and output test and training sets;

[0012] S2. Define a multi-stage feature optimization strategy to perform feature optimization on the training set;

[0013] S3. A mixed data sampling strategy of denoising-amplification-equalization is used to sample the training set.

[0014] S4. Construct a random forest model based on KNN weighting and Optuna optimization, and train the random forest model.

[0015] S5. Input the test set into the random forest model for evaluation.

[0016] Optionally, the process of acquiring raw well logging data, preprocessing it, and outputting test and training sets includes:

[0017] The original logging data includes at least a standard logging curve combination of information on rock skeleton, pore fluid, and clay content, and the original logging data is cleaned using a combination of linear interpolation, forward filling, and backward filling methods.

[0018] Optionally, the definition of a multi-stage feature optimization strategy for feature optimization of the training set includes:

[0019] The categorical lithological labels in the training set are converted into numerical form using one-hot encoding, and a comprehensive correlation matrix is ​​constructed. The linear correlation strength between the numerical features in the matrix is ​​expressed as:

[0020]

[0021] in, , These are sample values ​​for two features. , It is its mean;

[0022] The correlation between the numerical features in the training set and the binary lithology labels is then quantified using a point bicolumn correlation coefficient, expressed as:

[0023]

[0024] Where M1 and M0 represent the mean values ​​of a logging feature under the two conditions of presence and absence of any lithology, respectively. The binary label for the presence of a lithology is 1, and the binary label for absence is 0; sn is the standard deviation of the logging feature over all data; p and q are the sample proportions of the two conditions of presence and absence, respectively.

[0025] Furthermore, by setting a correlation threshold, features that are significantly correlated with shale lithology categories are selected.

[0026] Optionally, the step of employing a denoising-amplification-equalization hybrid data sampling strategy to perform hybrid data sampling on the training set includes:

[0027] S301. Denoise the training set by using an isolation forest to remove outlier samples from the training set, where the outlier score s(x,n) of data point x is represented as:

[0028]

[0029] Where h(x) is the path length of sample x from the root node to the leaf node of the tree, c(n) is the average path length of the binary search tree given the sample size n, and E(h(x)) is the average path length of all trees in the forest. Samples with scores close to 1 are considered outliers and are removed.

[0030] S302. Perform data augmentation on the training set. First, for each minority class sample xi, calculate the proportion of majority class samples among its k nearest neighbors. Then, calculate a density distribution based on ri. Where m is the total number of minority class samples, and the total number of samples to be generated. , where N maj N min Here, β is the number of majority and minority class samples, β is the balance level parameter, and finally, β is generated for each minority class sample xi. Each new sample is created by linear interpolation between xi and one of its randomly selected minority class neighbors xzi:

[0031]

[0032] Where λ is a random number;

[0033] S303, and augment the lithology of a minority of shale samples in the training set.

[0034] Optionally, the construction of a random forest model based on KNN weighting and Optuna optimization, and the training of the random forest model, includes:

[0035] S401. The Optuna automated hyperparameter optimization framework is used to obtain the globally optimal hyperparameter configuration.

[0036] S402. Use KNN weighting to obtain the training weights of the samples in the training set;

[0037] S403. Train the random forest model based on the globally optimal hyperparameter configuration and the training weights of the samples.

[0038] This invention also provides a shale lithology intelligent identification system based on machine learning and data augmentation, comprising:

[0039] The preprocessing module is used to collect raw logging data, preprocess it, and output test and training sets.

[0040] The feature optimization module is used to define a multi-stage feature optimization strategy and perform feature optimization on the training set.

[0041] A hybrid sampling module is used to perform hybrid data sampling on the training set using a hybrid data sampling strategy of denoising, augmentation, and equalization.

[0042] The model training module is used to construct a random forest model based on KNN weighting and Optuna optimization, and to train the random forest model.

[0043] The model evaluation module is used to input the test set into the random forest model for evaluation.

[0044] Compared with the prior art, the present invention:

[0045] This patent combines a hybrid data sampling strategy with a sample weighting mechanism, which significantly improves the model's ability to identify all lithologies, especially a few types of lithologies. It can systematically address data imbalance and achieve efficient automated lithology identification. Attached Figure Description

[0047] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0048] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0049] Figure 1 This is a schematic diagram of the method flow of the present invention;

[0050] Figure 2 This is a schematic diagram comparing the distribution of lithological sample quantities in the training set and the test set in an embodiment of the present invention;

[0051] Figure 3 This is a thermodynamic diagram illustrating the correlation between well logging curves and lithological mixing constructed in an embodiment of the present invention;

[0052] Figure 4 This is a histogram of the F1 score of the model's prediction performance for each type of lithology on the test set in an embodiment of the present invention;

[0053] Figure 5 This is a box plot of data distribution for some key logging features under different lithology categories in an embodiment of the present invention;

[0054] Figure 6 This is a schematic diagram of the confusion matrix of the model's classification results on the test set in an embodiment of the present invention;

[0055] Figure 7 This is a schematic diagram of the feature importance ranking output by the random forest model trained in this embodiment of the invention.

[0056] Figure 8 This is a schematic diagram of the learning curve of the model during the training process in an embodiment of the present invention;

[0057] Figure 9 This is a schematic diagram showing the comparison of the actual lithology and predicted lithology of all samples on the test set in an embodiment of the present invention.

[0058] Figure 10 This is a schematic diagram of the receiver operating characteristic (ROC) curves and area under the curve (AUC) values ​​of the model for five lithological categories in this embodiment of the invention;

[0059] Figure 11 This is a visualization diagram of the class distribution of the training set samples in two-dimensional space after equalization processing, using the t-SNE dimensionality reduction technique of this invention. Detailed Implementation

[0061] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other implementation cases obtained by those skilled in the art without creative effort are within the scope of protection of this application. Functional units with the same reference numerals in the examples of this invention have the same and similar structures and functions.

[0062] See Figure 1 This invention provides a method for intelligent identification of shale lithology based on machine learning and data augmentation, comprising:

[0063] S1. Collect raw logging data, preprocess it, and output test and training sets;

[0064] S2. Define a multi-stage feature optimization strategy to perform feature optimization on the training set;

[0065] S3. A mixed data sampling strategy of denoising-amplification-equalization is used to sample the training set.

[0066] S4. Construct a random forest model based on KNN weighting and Optuna optimization, and train the random forest model.

[0067] S5. Input the test set into the random forest model for evaluation.

[0068] In this embodiment, S1, raw logging data is collected, preprocessed, and output test and training sets.

[0069] The first step is to prepare and process the raw logging data. First, a logging dataset of wells drilled within the study area is collected. This dataset must contain at least one set of standard logging curves reflecting information such as rock skeleton, pore fluid, and clay content, including, for example: acoustic transit time (AC), borehole diameter (CAL), compensated neutron (CNL), azimuth (DAZ), density (DEN), well inclination (DEV), natural gamma (GR), potassium (K), thorium (KTH), and deep lateral resistivity (RT). Subsequently, the data is cleaned using a combination of methods, including linear interpolation, forward filling, and backward filling, to process missing values ​​in the logging curves. Based on this, the present invention implements systematic feature engineering to derive a series of new composite features from the raw logging curves. These features include: logarithmic transformation features, such as RT_log; ratio and product features, such as GR_RT_ratio, GR*DEN, AC*RT, GR*RT_log, DEN*AC; difference features, such as DEN_CNL_diff; and features such as GR_window_mean and DEN_window_mean obtained through sliding window smoothing.

[0070] S2. Define a multi-stage feature optimization strategy to optimize features on the training set.

[0071] This step first converts categorical lithology tags into numerical form using unique thermal encoding, and then constructs a comprehensive correlation matrix. Let the training set contain p numerical logging features, forming the feature set. And k mutually exclusive lithology categories. After one-heat encoding, the lithology category labels are converted into k binary features, forming a label set. Therefore, the comprehensive correlation matrix C constructed in this embodiment is a matrix with dimension 1. It is a real symmetric square matrix. This matrix can be precisely represented in the following block matrix form:

[0072]

[0073] in, It is a dimension The submatrix represents the correlation within the numerical features, and any element of it... The value is obtained by calculating numerical characteristics. and Pearson correlation coefficient between Obtained; It is a dimension The submatrix represents the correlation between numerical characteristics and lithological categories, where any element... The value is obtained by calculating numerical characteristics. and binary lithological labels bicollinear correlation coefficient between points Obtained; yes The transpose of the matrix, i.e. Its dimensions are ; It is a dimension The submatrix, since lithology categories are mutually exclusive, is ideally an identity matrix. Its internal correlations are not instructive for screening logging features and are therefore not considered in the feature screening process of this invention. See also... Figure 3 By constructing this matrix, this embodiment can comprehensively quantify and compare the correlation strength between variables of different properties within a unified mathematical framework, providing a solid quantitative basis for subsequent feature selection.

[0074] In this matrix, the strength of the linear correlation between numerical features is measured by the Pearson correlation coefficient, which is calculated as follows:

[0075]

[0076] in, , These are sample values ​​for two features. , This is its mean. The correlation between numerical characteristics and binary lithological labels is quantified using the point-biserial correlation coefficient, calculated as follows:

[0077]

[0078] In this formula, M1 and M0 represent the mean values ​​of a certain logging characteristic under two conditions: the presence of a certain lithology (binary label 1) and its absence (binary label 0); s n is the standard deviation of the logging feature across all samples; p and q are the sample proportions for the two cases, respectively. By setting a correlation threshold, features significantly correlated with lithology are first screened out, and then redundant features with excessive internal collinearity are removed from these.

[0079] S3. A mixed data sampling strategy of denoising, augmentation, and equalization is used to perform mixed data sampling on the training set.

[0080] To address the class imbalance problem, this invention employs a hybrid data sampling strategy of "denoising-augmentation-balancing". The first step is data denoising, which utilizes an unsupervised isolated forest algorithm to identify and remove outlier samples from the training set. This algorithm recursively partitions the data using a random hyperplane, and the outlier score s(x,n) of a data point x is determined by its average path length E(h(x)) across all trees in the forest.

[0081]

[0082] Where h(x) is the path length of sample x from the root node to a leaf node of the tree, and c(n) is the average path length of the binary search tree for a given sample size n, used for standardization. Samples with scores close to 1 are considered outliers and are removed.

[0083] The second step is data augmentation, which involves applying the Adaptive Synthetic Oversampling (ADASYN) algorithm to minority class lithological samples. For each minority class sample x i First, calculate the proportion of majority class samples among its k-nearest neighbors. Then, based on r i Calculate a density distribution , where m is the total number of minority class samples. The total number of samples to be generated. , where N maj N min is the number of samples in the majority and minority classes, and β is the balance level parameter. Finally, generate for each minority class sample xi. A new sample, each new sample is obtained through x i Compared to a randomly selected minority class neighbor x zi To create: Linear interpolation is used between them.

[0084]

[0085] Where λ is a random number.

[0086] The third step is data balancing. After augmenting all minority classes using the ADASYN algorithm, to achieve a balanced training set across all classes, random undersampling must be performed on the majority lithology ("shale" in this example), whose sample size still far exceeds that of other classes. The target undersampling number is not a fuzzy range but is guided by a deterministic numerical standard. That is, the sample size of the majority lithology is precisely reduced to be equal to the maximum value of the sample sizes of all four minority lithology classes augmented by the ADASYN algorithm. In this example, after augmentation, the largest minority class (shell shale) has 644 samples. Therefore, the specific operation of random undersampling is to randomly select 600 samples without replacement from the "shale" class samples (to ensure the stability of integer batch partitioning and calculation in subsequent processing, a fixed integer target value close to this maximum value is set), while discarding the remaining "shale" samples from the training set. See also... Figure 2 Through this precisely controlled undersampling operation, the number of samples in the final training set across all five lithological categories was strictly controlled to be at an approximately equal level (between 597 and 644), thereby eliminating class imbalance in a statistical sense.

[0087] S4. Construct a random forest model based on KNN weighting and Optuna optimization, and train the random forest model.

[0088] One of the core steps in this embodiment is to build a deeply optimized random forest classification model. This process is a systematic and automated model building and optimization workflow, and its specific implementation steps are described below:

[0089] 1. Automated hyperparameter optimization based on the Optuna framework

[0090] To determine the globally optimal performance configuration of the random forest model, this embodiment employs the Optuna automated hyperparameter optimization framework. The key to implementing this framework lies in the precise definition of the objective function. This objective function aims to quantify the model's performance under any set of hyperparameter configurations. Its input is a set of hyperparameter combinations generated by the Optuna framework in each trial, and its output is a single evaluation metric for the model's performance under that set of hyperparameters. In this embodiment, this evaluation metric is determined to be the model's macro-average F1 score under 5-fold hierarchical cross-validation. The internal execution logic of the objective function is as follows: the function receives a set of hyperparameters generated by the `trial.suggest_` method, specifically including the number of decision trees `n_estimators` (search range: integer 200 to 500), the maximum depth `max_depth` (search range: integer 10 to 20), the minimum number of sample splits `min_samples_split` (search range: integer 2 to 5), the minimum number of leaf node samples `min_samples_leaf` (search range: integer 2 to 4), and the maximum feature selection strategy `max_features` (search range: discrete categories ['sqrt', 'log2']). A temporary random forest model was instantiated using this set of hyperparameters, and 5-fold hierarchical cross-validation was performed on a balanced training set of 3057 samples after step S3. This cross-validation process randomly divided the training set into five mutually exclusive subsets, alternately using four subsets as training data and one subset as validation data, for a total of five rounds of training and validation. The arithmetic mean of the macro-average F1 scores obtained from the five rounds of validation was calculated, and this mean was used as the final return value for this experiment.

[0091] Subsequently, a built-in Optuna `Study` object is created, with its optimization direction set to "maximize". The automated search process is initiated by calling the `optimize` method of this `Study` object and setting the total number of trials to 100. Internally, the Optuna framework applies a tree-structured Parzen estimator (TPE) Bayesian optimization algorithm. Based on the historical results of completed trials (i.e., the pairing of hyperparameter combinations with performance scores), a probabilistic model is dynamically constructed to infer the parameter regions in the hyperparameter space most likely to produce high performance, guiding subsequent sampling and thus achieving efficient global optimization. After completing all 100 trials, the hyperparameter combination that yielded the highest historical macro-average F1 score is extracted from the `Study` object; this combination is then determined as the globally optimal hyperparameter configuration in this embodiment.

[0092] 2. Sample weight calculation based on K-nearest neighbors

[0093] To enable the model to pay more attention to samples located at class boundaries or with richer information during training, this embodiment calculates unique training weights for each sample in the training set. This process uses a K-Nearest Neighbors (KNN) based algorithm, and the specific calculation steps are as follows:

[0094] For each sample point in the balanced training set after step S3 First, in the N-dimensional feature space consisting of 14 features, its relationship with all other sample points is calculated. The Euclidean distance. Based on ascending order of distance, find the distance... The K nearest neighbors constitute the local neighborhood set. In this embodiment, the number of neighbors K is set to 5. Then, the distances from these K nearest neighbors to the nearest neighbors are calculated. arithmetic mean of Euclidean distance .sample initial weights Set to this average distance value, i.e. The principle is that sample points located in sparse data regions (usually corresponding to class boundaries) have relatively large average distances to their neighbors, thus being assigned higher initial weights. Finally, to ensure the numerical stability of the weights and adapt to the requirements of model training, the initial weights of all samples are normalized to their maximum values, resulting in the final weight vector. The final weight of each sample. It can be calculated using the following formula:

[0095]

[0096] in, It is the set of initial weights for all samples. .

[0097] 3. Final model instantiation and weighted training

[0098] This step integrates the outputs of the first two steps to build and train the final classification model. First, using the optimal hyperparameter combination determined in the first step (Table 2), a final random forest classifier object is instantiated. Then, the object's `fit` method is called. The input to this method includes the feature data matrix of all 3057 balanced training set samples after processing in step S3. and its corresponding lithological tag vector Simultaneously, the final sample weight vector W, calculated in the second step and corresponding one-to-one with the training samples, is passed as the sample_weight parameter. During training, the random forest model typically uses Gini impurity as the splitting criterion when searching for the optimal split point for each node of each decision tree. Gini impurity is defined as:

[0099]

[0100] Here, p k is the proportion of samples of class k in a node, where K is the total number of classes. Specifically, in calculating the proportion p of each class in a node... k In this process, the sum of the weights of each type of sample is used, rather than the sum of the sample sizes. This means that samples with higher weights will have a greater influence on the construction of the decision tree, guiding the model to focus more on those samples considered more "important." After this weighted training process, a fully optimized and trained high-performance random forest model is constructed.

[0101] S5. Input the test set into the random forest model for evaluation.

[0102] After training, the model's performance was comprehensively evaluated on an independent test set, including calculating overall metrics such as overall accuracy and weighted F1 score, as well as classification metrics such as precision, recall, and F1 score for each lithology. Simultaneously, a series of visualization charts were plotted and analyzed, including the confusion matrix, ROC curves and AUC values ​​for each category, learning curves, and overlay plots of true and predicted values. Finally, the trained model was applied to new well logging data for lithology prediction, and the feature importance ranking of the model was output.

[0103] In another embodiment, the dataset of the original well logging data first contains 1551 sample points, each with a set of standard well logging curves and precise lithology labels determined through core analysis. Following conventional practice in the art, this dataset is divided into two parts: one part contains 1240 samples, serving as a training set for model building, training, and optimization; the other part contains 311 samples, serving as a separate test set specifically for objectively and impartially evaluating the performance of the finally trained model.

[0104] See Figure 2 Initial statistical analysis of the training set revealed a significant imbalance in the distribution of data across categories. The specific sample size distribution has been quantified, with "shale" comprising 604 samples, constituting the majority class; while "argillaceous shell limestone," "shell limestone," "shell shale," and "argillaceous siltstone" are minority classes, with 129, 181, 300, and 25 samples respectively. "Argyleous siltstone," being the least represented category, has only about 4.1% of the sample size of "shale," and this significant disparity constitutes the primary technical challenge that this embodiment needs to address.

[0105] To enhance the representational capabilities of the input data, this embodiment employs systematic feature engineering on the original well logging curves. While retaining the original well logging curves, 14 new derived features are constructed through mathematical operations such as logarithmic transformation, ratio calculation, product combination, and sliding window smoothing. The construction of these features aims to capture subtle changes in rock physical properties from different dimensions, thereby providing richer and more sensitive discriminative information for subsequent lithological classification.

[0106] After completing feature construction, this embodiment employs a two-stage feature optimization strategy. First, a hybrid correlation matrix is ​​constructed, containing all numerical features and lithological tags after unique thermal coding. This matrix integrates the calculation results of Pearson correlation coefficient and point bicolumn correlation coefficient; see [link to relevant documentation]. Figure 3 This matrix comprehensively demonstrates the correlations between all candidate features and between features and lithology categories, providing a quantitative basis for feature selection. Based on this matrix, this embodiment first selects features with high correlation to lithology labels, then eliminates redundant features with excessive internal collinearity, and finally determines an optimal feature subset of 14 features for model input. See also Figure 5 The effectiveness of the selected features was preliminarily verified through statistical analysis. The positions of the boxes for different lithological categories on the numerical axis showed significant differences, indicating that the statistical distribution of these features was strongly correlated with the lithological category, and therefore had potential discriminative value for lithological classification.

[0107] For data equalization, a hybrid data sampling strategy comprising three steps—denoising, augmentation, and equalization—was employed. This strategy proved highly effective, expanding the total number of samples in the training set from 1240 to 3057. (See [link to relevant documentation]). Figure 2 Furthermore, the sample size for all five lithological categories was adjusted to approximately equal levels (around 600 samples), thereby eliminating the numerical differences between categories.

[0108] See Figure 11 To evaluate the effectiveness of data balancing from the perspective of the geometric distribution of the feature space, this embodiment employs t-SNE nonlinear dimensionality reduction technology to map the high-dimensional feature space onto a two-dimensional plane. After data balancing, categories that might have overlapped and had blurred boundaries form relatively independent clusters with clearer boundaries in the dimensionality-reduced two-dimensional space. Different colored points represent samples of different lithologies. It can be observed that the brown point cloud representing "shell limestone" and the green point cloud representing "shell shale" show a clear spatial separation trend. This result indicates that data balancing not only solves the problem of uneven sample quantity but also enhances the separability between different categories in the feature space, creating favorable conditions for the efficient learning of the subsequent classifier.

[0109] This embodiment uses the Random Forest algorithm as the core classifier, combined with the KNN sample weighting mechanism. To determine the optimal performance configuration of the model, the Optuna automated hyperparameter optimization framework was used to train and search for the model. The optimal hyperparameter combination obtained by the search includes a decision tree number (n_estimators) of 387 and a maximum depth (max_depth) of 20, aiming to balance the model's complexity and generalization ability (Table 2).

[0110] Finally, the trained model underwent a comprehensive and rigorous performance evaluation on an independent test set containing 311 samples:

[0111] 1. Conduct overall performance and category-specific performance analysis.

[0112] Detailed performance metrics of the model on the test set have been quantified. The model achieved an overall accuracy of 0.9293 and a weighted average F1 score of 0.9306, demonstrating excellent overall performance. More importantly, the model exhibits balanced performance across all classes. Particularly for the "muddy siltstone" class, with its extremely small sample size, the three key metrics—precision, recall, and F1 score—all reached 1.0000. See Table 1. This result strongly demonstrates the effectiveness of the proposed technical solution in overcoming the class imbalance problem. Figure 4 The F1 scores for all categories are all above 0.86, which further demonstrates the model's balanced and excellent recognition ability across all lithological categories.

[0113] Table 1. Detailed performance evaluation metrics of the model on the test set.

[0114] Lithological categories Accuracy Recall rate F1 score Support Muddy shell limestone 0.7805 0.9697 0.8649 33 shell limestone 0.9535 0.9111 0.9318 45 Shell shale 0.8795 0.9605 0.9182 76 silty mudstone 1.0000 1.0000 1.0000 6 shale 0.9928 0.9073 0.9481 151 Macro average 0.9212 0.9497 0.9326 311 weighted average 0.9360 0.9293 0.9306 311 Overall accuracy - - 0.9293 311

[0115] 2. Conduct prediction behavior and error analysis.

[0116] To further analyze the model's specific predictive behavior, this embodiment generates a confusion matrix. This matrix accurately records the true and predicted categories for each sample in the test set. The values ​​on the main diagonal of the matrix represent the number of correctly classified samples, totaling 289, accounting for 92.93% of the total test set. The values ​​off-diagonal reveal specific misclassifications; for example, 9 "shale" samples were incorrectly predicted as "shell shale." See also Figure 6 In the heatmap representation of the confusion matrix, the main diagonal area is dark blue, while the off-diagonal area is extremely light in color. This strong visual contrast further confirms the model's high accuracy and low error rate. From the perspective of individual samples, the true lithology category of each sample in the test set was overlaid with the model's predicted category point by point. See [link to relevant documentation]. Figure 9The vast majority of predicted points in the figure precisely coincide with the true points on the same category level line, providing direct visual evidence for the model's excellent performance.

[0117] 3. Conduct stability and generalization ability assessment.

[0118] To evaluate the model's stability and generalization ability, this embodiment analyzes the model's learning curve. The curve shows how the model's training accuracy and validation accuracy change with increasing training sample size. The two curves in the figure eventually converge smoothly, and the validation accuracy reaches a very high level, without a significant gap compared to the training accuracy. See also... Figure 8 This phenomenon indicates that the model did not suffer from severe overfitting during training and has a good ability to generalize to unknown data.

[0119] 4. Judgment Ability Assessment

[0120] See Figure 10 The model's discriminative ability was further confirmed by the ROC curves. Each lithological category corresponds to an ROC curve and its area under the curve (AUC) value. The ROC curves for all five categories are close to the upper left corner of the graph, indicating that the model maintains a high true positive rate while having an extremely low false positive rate. The AUC values ​​for all categories are above 0.98 (the AUC value for silty mudstone is 1.00), which numerically demonstrates that the model has excellent and stable discriminative ability at any classification threshold.

[0121] 5. Model interpretability analysis

[0122] See Figure 7 Based on Table 2, the contribution scores of all 14 input features to the model's final decision have been quantified and sorted in descending order. The analysis shows that the composite feature GR*Log(RT) has the highest importance score (0.1665), followed by the original features K (0.1478) and GR (0.1144). These three features have significantly higher importance scores than the others, indicating that they are the most critical discriminant factors in lithological classification in this study area. This finding not only makes the model's predictions interpretable but also provides geologists with valuable, data-driven scientific evidence for understanding the well logging response patterns of lithology in this region.

[0123] Table 2 Optimal Hyperparameters and Feature Importance of Random Forest Model

[0124] hyperparameters optimal value feature importance feature importance feature importance n_estimators 387 GR*Log(RT) 0.1665 AC 0.0526 Logarithmic RT 0.0413 max_depth 20 K 0.1478 GR window moving average 0.0511 DEN 0.0394 min_samples_split 5 GR 0.1144 CAL 0.0497 GR / RT 0.0352 min_samples_leaf 2 DEV 0.1039 CNL 0.0453 DEN window moving average 0.0108 max_features log2 DAZ 0.0995 RT 0.0425 Logarithmic RT 0.0413

[0125] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0126] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for intelligent identification of shale lithology based on machine learning and data augmentation, characterized in that, include: S1. Collect raw logging data, preprocess it, and output test and training sets; S2. Define a multi-stage feature optimization strategy to perform feature optimization on the training set; S3. A mixed data sampling strategy of denoising-amplification-equalization is used to sample the training set. S4. Construct a random forest model based on KNN weighting and Optuna optimization, and train the random forest model. S5. Input the test set into the random forest model for evaluation.

2. The intelligent shale lithology identification method based on machine learning and data augmentation as described in claim 1, characterized in that, The process of acquiring raw well logging data, preprocessing it, and outputting test and training sets includes: The original logging data includes at least a standard logging curve combination of information on rock skeleton, pore fluid, and clay content, and the original logging data is cleaned using a combination of linear interpolation, forward filling, and backward filling methods.

3. The intelligent shale lithology identification method based on machine learning and data augmentation as described in claim 1, characterized in that, The defined multi-stage feature optimization strategy performs feature optimization on the training set, including: The categorical lithological labels in the training set are converted into numerical form using one-hot encoding, and a comprehensive correlation matrix is ​​constructed. The linear correlation strength between the numerical features in the matrix is ​​expressed as: in, , These are sample values ​​for two features. , It is its mean; The correlation between the numerical features in the training set and the binary lithology labels is then quantified using a point bicolumn correlation coefficient, expressed as: Where M1 and M0 represent the mean values ​​of a logging feature under the two conditions of presence and absence of any lithology, respectively. The binary label for the presence of a lithology is 1, and the binary label for absence is 0; sn is the standard deviation of the logging feature over all data; p and q are the sample proportions of the two conditions of presence and absence, respectively. Furthermore, by setting a correlation threshold, features that are significantly correlated with shale lithology categories are selected.

4. The intelligent shale lithology identification method based on machine learning and data augmentation as described in claim 1, characterized in that, The method of employing a hybrid data sampling strategy of denoising, augmentation, and equalization to perform hybrid data sampling on the training set includes: S301. Denoise the training set by using an isolation forest to remove outlier samples from the training set, where the outlier score s(x,n) of data point x is represented as: Where h(x) is the path length of sample x from the root node to the leaf node of the tree, c(n) is the average path length of the binary search tree given the sample size n, and E(h(x)) is the average path length of all trees in the forest. Samples with scores close to 1 are considered outliers and are removed. S302. Perform data augmentation on the training set. First, for each minority class sample xi, calculate the proportion of majority class samples among its k nearest neighbors. Then, a density distribution is calculated based on ri. Where m is the total number of minority class samples, and the total number of samples to be generated. , where N maj N min Here, β is the number of majority and minority class samples, β is the balance level parameter, and finally, β is generated for each minority class sample xi. Each new sample is created by linear interpolation between xi and one of its randomly selected minority class neighbors xzi: Where λ is a random number; S303, and augment the lithology of a minority of shale samples in the training set.

5. The intelligent shale lithology identification method based on machine learning and data augmentation as described in claim 1, characterized in that, The construction of a random forest model based on KNN weighting and Optuna optimization, and the training of the random forest model, include: S401. The Optuna automated hyperparameter optimization framework is used to obtain the globally optimal hyperparameter configuration. S402. Use KNN weighting to obtain the training weights of the samples in the training set; S403. Train the random forest model based on the globally optimal hyperparameter configuration and the training weights of the samples.

6. A shale lithology intelligent identification system based on machine learning and data augmentation, characterized in that, include: The preprocessing module is used to collect raw logging data, preprocess it, and output test and training sets. The feature optimization module is used to define a multi-stage feature optimization strategy and perform feature optimization on the training set. A hybrid sampling module is used to perform hybrid data sampling on the training set using a hybrid data sampling strategy of denoising, augmentation, and equalization. The model training module is used to construct a random forest model based on KNN weighting and Optuna optimization, and to train the random forest model. The model evaluation module is used to input the test set into the random forest model for evaluation.