Oil-water well casing early warning method, device and equipment and readable storage medium
By integrating and pre-processing the historical data of the oil and water well system, combining machine learning models and interpretability methods, an oil and water well sleeve loss warning model is constructed, which solves the limitations of the health status evaluation of oil and water well casings in the existing technology, and achieves a more accurate and reliable early warning effect.
Patent Information
- Application Number
- CN202311355007.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-18
- Publication Date
- 2025-04-18
AI Technical Summary
The prior art has limitations in predicting and evaluating the healthy state of casing damage in oil and water wells, especially due to the nonlinearity, uncertainty and time-varying between factors affecting casing damage, resulting in insufficient prediction accuracy and reliability.
Through data processing tools, the historical data of the oil and water well system is integrated, and the correlation analysis is performed. Combined with linear dimensionality reduction algorithm, random forest algorithm and interpretable machine learning method, an oil and water well sheath loss warning model is constructed, the health value of each well is obtained and the health status of the oil field is evaluated.
It improves the accuracy and reliability of oil-water well sheath loss warning, can more accurately evaluate the health status of the wells in service in the oil field, enhances the stability and interpretability of the model, and improves users' trust in the predicted results.
Smart Images

Figure CN119848447A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of petroleum and natural gas engineering, and in particular to an oil and water well casing early warning method, device, equipment and a readable storage medium. Background Art
[0002] As the development time of oil fields increases, the long-term combined effects of geological, engineering, and development factors have led to gradual changes in the structure of oil, gas, and water wells. The casing condition will become worse and worse, and casing deformation and damage (referred to as casing damage) will occur. Casing damage directly affects the normal production of oil fields. The factors that induce casing damage in oil and water wells include geological factors, engineering factors, and development factors.
[0003] There are several methods in the prior art. The first is to monitor the radial strain and formation stress of the casing to obtain the casing stress load and the ultimate strength under the corresponding load, and to judge the possibility of casing damage by comparing the casing stress load (or formation stress) with the ultimate strength of the casing. The second is to determine the early warning indicators of casing damage for oil and water wells from a single technology and a single factor, and to determine the risk level of the oil and water wells based on the comprehensive risk of casing damage. However, due to the nonlinearity, uncertainty and time-varying nature of the various factors that affect casing damage, the above two methods have certain limitations and independence. The third is to establish an intelligent prediction model for oil well casing damage to predict the depth of casing damage. [3] , this method uses a single technology and lacks quantitative indicators and models to accurately predict the casing damage status. The fourth is to determine the key control factors of casing damage, extract the critical strain that characterizes casing damage, and obtain the prediction equation of casing critical strain and true strain, that is, predict the damage condition of casing based on the optimized prediction equation, but this method relies on sufficient and high-quality data and may not be able to fully explore the key factors affecting casing damage. Due to the nonlinearity, uncertainty and time-varying characteristics among the various factors affecting casing damage, the traditional method has certain limitations and independence. Therefore, facing the problems of how to reflect the casing damage health status of oil wells and how to construct a health index, it is crucial. Summary of the invention
[0004] The purpose of the present invention is to provide an oil and water well casing early warning method, device, equipment and readable storage medium to improve the above problems. In order to achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0005] In a first aspect, the present application provides an oil and water well casing early warning method, comprising:
[0006] Integrate historical data in the oil and water well system through a data processing tool to obtain oilfield data information, wherein the data processing tool is used to extract, convert, store and interact with the historical data;
[0007] Preprocessing the oilfield data information, wherein the preprocessing includes removing outliers in the oilfield data information, screening outliers based on a box plot method, filling missing values, processing data imbalance, and normalizing to obtain the processed oilfield data information;
[0008] Performing correlation analysis on the oilfield data information using the Pearson correlation coefficient method, including excluding features with high correlation and retaining features with low correlation, to obtain first feature information;
[0009] Combining the linear dimensionality reduction algorithm, the random forest algorithm and the interpretable machine learning method, the first feature information is weighted averaged to obtain a comprehensive feature importance score, which includes the contribution of each sample and its importance ratio in the whole, and the features whose importance weight exceeds the threshold are selected as the main control factors;
[0010] Based on the main controlling factors and combined with the machine learning model, the thresholds of the health value of each well in the oil and water well system from high risk to medium risk and then to low risk are obtained, and the obtained thresholds are used as early warning indicators for casing damage of oil and water wells, thereby obtaining the health status of the oil field.
[0011] Preferably, the oilfield data information is preprocessed, including:
[0012] Identify outliers by calculating the upper and lower quartiles, median and IQR in the oilfield data information, and remove the outliers to obtain first data, wherein the outliers in the first data can be deleted or replaced with appropriate values;
[0013] Using the KNN filling method to fill missing values in the first data to obtain filled second data;
[0014] Using the SMOTE method to perform imbalance processing on the second data to obtain third data;
[0015] The third data is processed according to the normalization method to obtain processed oilfield data information, wherein the result value is mapped to [0, 1] or a self-defined interval during the processing, and the calculation formula is as follows:
[0016]
[0017] Among them, max is the maximum value of the sample data, and min is the minimum value of the sample data.
[0018] Preferably, the Pearson correlation coefficient method is used to perform correlation analysis on the oilfield data information, which includes excluding features with high correlation and retaining features with low correlation to obtain first feature information, which includes:
[0019] The Pearson correlation coefficient method is used to perform correlation analysis on the oilfield data information to obtain the relationship value between the Pearson correlation coefficient and the degree of correlation, wherein the calculation formula of the Pearson correlation coefficient method is as follows:
[0020]
[0021] In the formula, r represents the correlation coefficient, X i , Y i Represents the values of two variables, Respectively represent the average values of two variables;
[0022] The size of the correlation coefficient is determined according to the relationship value, and a correlation coefficient greater than 0.7 is recorded as an extremely strong correlation, and a correlation coefficient less than 0.7 or equal to 0.7 is recorded as an extremely weak correlation. One of the variables with the extremely strong correlation is deleted, and the extremely weak correlation is retained to obtain the first feature information.
[0023] Preferably, based on the main control factors, combined with the machine learning model, the thresholds of the health value of each well in the oil and water well system from high risk to medium risk and then to low risk are obtained, and the obtained thresholds are used as the casing damage warning indicators of the oil and water wells, so as to obtain the health status of the oil field, including:
[0024] Based on the random forest model, XGBoost model and LightGBM model, the main control factors were used as input to build an oil and water well casing damage early warning model;
[0025] Determine the optimal hyperparameters of each model through grid search to ensure the optimal performance of the oil and water well casing damage early warning model, select the XGBoost model based on the evaluation results, and calculate the SHAP value of each feature and the contribution value of the feature to the oil and water well casing damage;
[0026] The casing failure probability of the XGBoost model and the SHAP contribution value are weighted and summed to obtain a comprehensive health index;
[0027] The comprehensive health index is mapped to a range of 0-1, and this range is used as the health index of oil and water wells. The contribution degree value and the predicted probability are considered comprehensively to evaluate the health status of the oil field.
[0028] In a second aspect, the present application also provides an oil and water well casing early warning device, including an acquisition module, a preprocessing module, an analysis module, a calculation module and an early warning module, wherein:
[0029] Acquisition module: used to integrate historical data in the oil and water well system through data processing tools to obtain oil field data information, wherein the data processing tools are used to extract, convert, store and interact with the historical data;
[0030] Preprocessing module: used for preprocessing the oilfield data information, wherein the preprocessing includes removing outliers in the oilfield data information, screening outliers based on the box plot method, filling missing values, processing data imbalance and normalization, so as to obtain the processed oilfield data information;
[0031] Analysis module: used for performing correlation analysis on the oilfield data information using the Pearson correlation coefficient method, including excluding features with high correlation and retaining features with low correlation to obtain first feature information;
[0032] Calculation module: used to combine the linear dimensionality reduction algorithm, the random forest algorithm and the interpretable machine learning method to perform weighted averaging on the first feature information to obtain a comprehensive feature importance score, which includes the contribution of each sample and its importance ratio in the whole, and selects the features whose importance weight exceeds the threshold as the main control factors;
[0033] Early warning module: used to derive the threshold value of the health value of each well in the oil and water well system from high risk to medium risk and then to low risk based on the main control factors and combined with the machine learning model, and use the obtained threshold value as the casing damage early warning indicator of the oil and water wells, so as to obtain the health status of the oil field.
[0034] In a third aspect, the present application also provides an oil and water well casing early warning device, including:
[0035] Memory for storing computer programs;
[0036] A processor is used to implement the steps of the oil and water well casing early warning method when executing the computer program.
[0037] In a fourth aspect, the present application further provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned oil and water well casing-based early warning method are implemented.
[0038] The beneficial effects of the present invention are:
[0039] 1. The present invention analyzes the impact on oil and water well casing from the perspectives of geology, engineering and development. Based on production data, the present invention uses statistical classification methods such as correlation test and machine learning to statistically analyze the correlation between each characteristic parameter and casing damage, analyze the degree of influence of each characteristic parameter on casing damage, and divide the health of oilfield casing damage into three stages: high risk, medium risk and low risk. By constructing appropriate indicators and models, the health status of in-service wells in the oilfield can be more accurately evaluated. After continuous training and optimization, the optimal model is stored in the system for later prediction and call.
[0040] 2. The present invention avoids the accuracy of casing damage prediction due to data quality problems by establishing a data warehouse of casing damage influencing factors and performing comprehensive data extraction, cleaning and conversion. The data integrity can be improved to 99.8%, and the key features related to casing damage can be better captured.
[0041] 3. The present invention utilizes correlation analysis, principal component analysis and other methods to select key control parameters for numerous parameters in the oilfield casing damage problem, which helps to reduce the impact of irrelevant features on the prediction model. Compared with other patents, the stability of the model is improved by 98.5%. By using machine learning models and explanatory methods (such as SHAP values), the prediction model can better explain the impact of features and increase the interpretability of the model.
[0042] 4. The present invention combines the model interpretability with the original data by calculating the health index and using an explanatory method, thereby obtaining a probability measurement based on weights and explanatory information, which makes the prediction results more credible. This not only focuses on the predicted output, but also enables understanding of how the prediction is based on features and explanatory information, which helps to increase users' trust in the prediction results.
[0043] 5. The present invention uses its own data information, machine learning and SHAP value to explain the impact of features on casing damage probability, and weights these impacts to construct a health index. This health index can provide a more intuitive and transparent way to understand the relative degree of casing damage risk, and can also help decision makers better understand the health status of the oil field.
[0044] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by implementing the embodiments of the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0046] Figure 1 It is a schematic diagram of the process of the oil and water well casing early warning method described in an embodiment of the present invention;
[0047] Figure 2 This is a structural schematic diagram of an oil and water well casing early warning device according to an embodiment of the present invention;
[0048] Figure 3 It is a box plot of the oil and water well casing early warning method described in an embodiment of the present invention;
[0049] Figure 4 It is a Pearson correlation heat map of the oil and water well casing early warning method described in an embodiment of the present invention;
[0050] Figure 5 It is a schematic diagram of the importance ranking of the main control factors of the oil and water well casing early warning method described in an embodiment of the present invention;
[0051] Figure 6 It is a schematic diagram of the contribution data value of some main control factors of each well to the oil well casing damage in the oil and water well casing early warning method described in the embodiment of the present invention;
[0052] Figure 7 It is a scatter diagram of the contribution of each main control factor to the casing damage of the oil well in the oil and water well casing early warning method described in the embodiment of the present invention;
[0053] Figure 8 Schematic diagram of the health value HN value interval described in an embodiment of the present invention.
[0054] In the figure: 701, acquisition module; 702, pre-processing module; 7021, elimination unit; 7022, filling unit; 7023, first processing unit; 7024, second processing unit; 703, analysis module; 7031, analysis unit; 7032, judgment unit; 704, calculation module; 705, early warning module; 7051, construction unit; 7052, determination unit; 7053, calculation unit; 7054, integration unit; 800, oil and water well casing early warning equipment; 801, processor; 802, memory; 803, multimedia component; 804, I / O interface; 805, communication component. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0056] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0057] Embodiment 1:
[0058] This embodiment provides an oil and water well casing early warning method.
[0059] See also Figure 1 , the figure shows that the method includes step S100, step S200, step S300, step S400 and step S500.
[0060] S100. Integrate historical data in the oil and water well system through a data processing tool to obtain oilfield data information, wherein the data processing tool is used to extract, convert, store and interact with the historical data.
[0061] It is understandable that in this step, the data is connected to the existing development database of the Zhongdagang Oilfield system through the ETL tool to realize data extraction and synchronization functions. By formulating rules related to data extraction, conversion, storage, and interaction between source data and analysis model data, business data extraction and conversion are completed, and one-time overall loading or regular incremental loading of related business data is realized.
[0062] Specifically, the following is a detailed implementation method:
[0063] 1. Determine business requirements: clarify what data needs to be extracted from the Zhongdagang Oilfield system to support business analysis and decision-making.
[0064] 2. Define data sources and targets: Confirm which data sources to extract data from and which target database or data warehouse to load the data into.
[0065] 3. Determine the extraction frequency: Decide whether to perform a one-time overall load or regular incremental loads.
[0066] 4. Download and install Talend Studio to build Talend's integrated development environment for creating ETL tasks.
[0067] 5. Create a new Job in Talend Studio, which will contain the steps of data extraction, transformation and loading
[0068] 6. Connect to the data source: Use the connector provided by Talend to establish a connection to the Zhongdagang Oilfield System Development Database.
[0069] 7. Query data: Configure SQL queries in Talend Studio or use the graphical interface to retrieve the required data.
[0070] 8. Use the conversion components provided by Talend to clean, convert and process data to meet business needs.
[0071] 9. Create a target table in the target database to prepare to receive the converted data.
[0072] 10. Use Talend’s data loading component to load the transformed data into the target table.
[0073] 11. Add data validation logic in Talend to ensure that data is not lost or corrupted during the loading process.
[0074] 12. Use Talend's data quality component to perform data quality control.
[0075] 13. Using the datasets generated by Talend, you can use reporting tools, analysis tools, or custom applications to interact and analyze data.
[0076] 14. Regular maintenance and monitoring.
[0077] 15. Configure the Talend Job schedule to ensure that the ETL task runs as planned. You can set alerts to notify you of abnormal situations.
[0078] 16. By choosing Talend as the ETL tool, use its visual interface and powerful transformation components to simplify and accelerate the entire data processing process.
[0079] Specifically, in this embodiment, the casing damage and casing change dataset is processed by step 1 to obtain a new dataset containing 63 attribute values such as perforation top depth, perforation bottom depth, perforation thickness, perforation density, perforation phase angle, casing wall thickness, casing steel grade, small layer top depth, and porosity.
[0080] S200, preprocessing the oilfield data information, wherein the preprocessing includes removing outliers in the oilfield data information, screening outliers based on a box plot method, filling missing values, processing data imbalance, and normalizing to obtain the processed oilfield data information.
[0081] It can be understood that step S200 includes S201, S202, S203 and S204, wherein:
[0082] S201, identifying outliers by calculating the upper and lower quartiles, median and IQR in the oil field data information, and removing the outliers to obtain first data, wherein the outliers in the first data can be deleted or replaced with appropriate values;
[0083] S202, using a KNN filling method to fill missing values in the first data to obtain filled second data;
[0084] S203, using the SMOTE method to perform imbalance processing on the second data to obtain third data;
[0085] S204, the third data is processed according to the normalization method to obtain processed oilfield data information, wherein the result value is mapped to [0, 1] or a self-defined interval during the processing, and the calculation formula is as follows:
[0086]
[0087] Among them, max is the maximum value of the sample data, and min is the minimum value of the sample data. The disadvantage of this method is that when there is some dirty data, such as an attribute value that is too large or too small, it may cause changes in max and min, thereby affecting the processing of the entire data. At this time, we can only redefine the extreme value of the maximum value normalization to eliminate the influence of dirty data.
[0088] It should be noted that this step includes operations such as outlier removal, missing value filling, data imbalance processing, and normalization. Among them, outlier removal: outliers are identified by calculating the upper and lower quartiles, median, and IQR. Figure 3 As shown in the figure, according to the box plot method, data outside Q3+1.5 (IQR) and Q1-1.5 (IQR) are considered outliers. Outliers can be deleted or replaced with appropriate values to ensure data quality and accuracy; Missing value filling: Processing missing values is the key. KNN missing value filling, mean filling, median filling and other methods can be used to reasonably fill missing values according to data characteristics and missingness to ensure data integrity; Data imbalance processing: Use the SMOTE method to handle data imbalance problems. By generating synthetic samples to increase the number of minority class samples, the balance of the data set is improved, which helps to build a more accurate model. This helps to improve the effect of data processing and make the indicators comparable.
[0089] It should be noted that the above steps are all aimed at ensuring data quality and improving the accuracy of analysis and models, so as to better obtain useful information from oilfield data and make reasonable decisions.
[0090] S300, performing correlation analysis on the oilfield data information using a Pearson correlation coefficient method, including excluding features with high correlation and retaining features with low correlation, to obtain first feature information.
[0091] It can be understood that step S300 includes step S301 and step S302, wherein:
[0092] S301, using the Pearson correlation coefficient method to perform correlation analysis on the oilfield data information, and obtain the relationship value between the Pearson correlation coefficient and the correlation degree, wherein the calculation formula of the Pearson correlation coefficient method is as follows:
[0093]
[0094] In the formula, r represents the correlation coefficient, X i , Y i Represents the values of two variables, Respectively represent the average values of two variables;
[0095] S302. Determine the size of the correlation coefficient according to the relationship value, record the correlation coefficient greater than 0.7 as an extremely strong correlation, record the correlation coefficient less than 0.7 or equal to 0.7 as an extremely weak correlation, delete one of the variables with the extremely strong correlation, retain the extremely weak correlation, and obtain the first feature information.
[0096] It should be noted that the Pearson correlation coefficient measures the linear correlation between variables. The calculation method first calculates the mean and standard deviation of each variable, and then calculates the covariance of each variable with another variable. Finally, the covariance is divided by the product of the standard deviations of the two variables to obtain the correlation coefficient r. The heat map of the Pearson correlation coefficient and the degree of correlation is as follows Figure 4 shown.
[0097] Table 1 Correlation strength table
[0098] Pearson correlation coefficient Relevance 0.7—1.0 Very strong correlation 0.6—0.8 Strong correlation 0.4—0.6 Moderately related 0.2—0.4 Weak correlation 0.0—0.2 Very weak or no correlation
[0099] As shown in Table 1, the correlation coefficient between the parameters affecting casing loss is specified, and a correlation greater than 0.7 is considered extremely strong. Highly correlated features contain similar information to some extent, which may lead to overfitting problems and reduce the generalization ability of the model. When an extremely strong correlation occurs, one of the strongly correlated feature variables is deleted. By excluding highly correlated features, fewer and more representative features are retained, thereby improving the interpretability and predictive performance of the model. Doing so can also reduce data dimensions, improve the computational efficiency of the model, and reduce the complexity of the model. If there is a nonlinear relationship between two variables, the Pearson correlation coefficient may not be able to accurately capture this relationship. In this embodiment, the Pearson correlation coefficient is only used as a preliminary method for screening the correlation of features.
[0100] Specifically, in this embodiment, the correlation is calculated by using the Pearson correlation coefficient (value between -1 and 1) to measure the linear correlation between two variables. The larger the absolute value of the coefficient, the stronger the correlation. The correlation is determined by determining the strength of the relationship between the variables based on the size of the correlation coefficient and the definition in Table 1. Generally, a correlation coefficient greater than 0.7 is considered to be extremely strong. The feature selection is to delete one of the variables with extremely strong correlation to reduce duplicate information and overfitting risks. This can improve the interpretability and predictive performance of the model while reducing data dimensions and model complexity.
[0101] S400, combining the linear dimensionality reduction algorithm, the random forest algorithm and the interpretable machine learning method, performing weighted averaging on the first feature information to obtain a comprehensive feature importance score, which includes the contribution of each sample and its importance ratio in the whole, and selecting features whose importance weight exceeds the threshold as the main control factors.
[0102] It can be understood that in this step, PCA, MDI and SHAP are combined, and the SHAP value and MDI importance value of PCA and each feature are weighted averaged to obtain a comprehensive feature importance score. In this way, the contribution of each feature to each sample and their importance in the overall model can be considered at the same time. The specific process is as follows: The oilfield well casing damage problem involves many parameters. Using a large number of factors as model input parameters will undoubtedly increase the difficulty and complexity of analyzing the problem. Therefore, the correlation between the various factors is used, and the PCA method is used to replace the original more influencing factors with the principal components after dimensionality reduction.
[0103] 1. The PCA method uses variance to measure the amount of information, and the sample set is X = [x 1j ,x 2j ,…x nj ], n is the number of main control parameters, m is the mth well, X nj =[x n1 ,x n2 ,…x nj ]
[0104] 2. Let the covariance matrix be A, then:
[0105]
[0106] Where: x nj is the sample attribute value corresponding to the nth master control parameter in the data set at t=j; The average value of all attribute values of the main control parameter n
[0107] 3. Let a set of eigenvectors of matrix A be u, and the eigenvalue corresponding to the eigenvector u be λ i=(1,2,3,…n), so we can conclude that the relationship between matrix, eigenvalue and eigenvector is: Av = λ i v
[0108] Construct the eigenvalue formula for solving the characteristic matrix: |λ i EA|=0Where: E is the unit matrix;
[0109] Assume the input master parameter value is X t =[x 1t ,x 2t ,…x nt ], then the comprehensive index (CI t ) is calculated as: CI t =λX T t
[0110] Where λ is the eigenvalue vector composed of the eigenvalues of matrix A, λ=(λ 1 ,λ 2 ,…λ n ).
[0111] 4. Set the threshold of the main control parameter to 95%: add the weights of each parameter from large to small. When the sum of the weights is greater than 95%, it is considered that these parameters can characterize all features. The performance of PCA on classification tasks may be affected because its goal is to retain the variance of the data to the greatest extent, which may result in the retention of some information that is not directly helpful for classification.
[0112] 5. Using data mechanism observation and similarity calculation between the eigenvalue vector of matrix A and the original feature column, we can get the original feature corresponding to the λ weight, λ=(λ 1 ,λ 2 ,…λ n ) is the feature importance weight that can characterize all features.
[0113] Since PCA is a linear dimensionality reduction method, it assumes that the data is linearly separable in a low-dimensional space. However, the data in many practical problems may contain complex nonlinear relationships. The MDI method of this patent is derived from the random forest algorithm, which can better handle nonlinear relationships by using a method based on Gini impurity. In addition, SHAP provides a more comprehensive and detailed feature interpretation method. It is based on the concept of Shapley value, which is a concept in game theory used to measure the contribution of each participant in a cooperative game to the victory of the game. In machine learning, Shapley value is applied to feature interpretation to measure the relative contribution of each feature in the prediction results. That is, the role and importance of each feature in the prediction results. In this way, SHAP can provide both global and local interpretability, which can explain the relative importance of features on the entire data set and the reasons for the prediction of a single sample.
[0114] 6. Therefore, PCA, MDI and SHAP are combined, and the SHAP value and MDI importance value of PCA and each feature are weighted averaged to obtain a comprehensive feature importance score. This can simultaneously consider the contribution of each feature to each sample and their importance in the overall model: λ'=αλ+βshap+εmdi
[0115] It should be noted that MDI is derived from the random forest algorithm. For each decision tree, random sampling with replacement is performed from the original data to generate different training data sets. This randomness helps to improve the diversity of the model and better capture the characteristics of the data. In the MDI method, for each node of the decision tree, the sample is divided into two sub-nodes according to a certain threshold of a certain feature. The decision tree in the random forest will select the best features and thresholds to minimize impurities, such as Gini impurity or information gain.
[0116] 7. The new weight is obtained from the above formula, which can represent the comprehensive feature importance weight of all features. Comprehensive feature importance weight λ'=(λ' 1 ,λ' 2 ,…λ' n ), where α, β, and ε are specific weights.
[0117] 8. shap=(shap 1 ,shap 2 ,…shap n ) is the overall feature importance weight calculated by SHAP combined with random forest.
[0118] Specifically, MDI is derived from the random forest algorithm. For each decision tree, random sampling with replacement is performed from the original data to generate different training data sets. This randomness helps to improve the diversity of the model and better capture the characteristics of the data.
[0119] 9.mdi=(mdi 1 ,mdi 2 ,…mdi n ) is a random forest decision tree to estimate the importance of features, thereby obtaining the weight of each feature and obtaining the 20 most important main control factors of cover loss as follows: Figure 5 As shown, it helps to analyze problems more accurately and make decisions.
[0120] The above method calculates the comprehensive index of each well as follows: CI = λ' = (λ' 1 ,λ' 2 …λ' n )CI=(CI 0 ,CI 1 ,…CI n )
[0121] The obtained comprehensive index is normalized to obtain the data information index (HI), which represents the degree of information content of each well. The obtained comprehensive index is normalized to obtain the data information index, which is used to measure the information content of the well.
[0122] It should be noted that by using the prediction results of the machine learning model combined with the calculation of the Shapley value, the original contribution value of each feature can be obtained; based on the random forest algorithm, the MDI importance value of each feature is calculated, and the SHAP value is used to measure the contribution of each feature to the prediction of each sample, providing global and local explanations; the principal components obtained by PCA are weighted averaged with the SHAP value and MDI importance value of each feature to obtain a comprehensive feature importance score, which comprehensively considers the contribution of the feature to each sample and its importance in the overall model; based on the comprehensive feature importance weights, the comprehensive index of each well is calculated, which represents the degree of information each well has.
[0123] S500. Based on the main control factors and in combination with the machine learning model, the threshold values of the health value of each well in the oil and water well system are obtained from high risk to medium risk and then to low risk, and the obtained threshold values are used as early warning indicators for casing damage of oil and water wells, thereby obtaining the health status of the oil field.
[0124] It can be understood that step S500 includes S501, S502, S503 and S504, wherein:
[0125] S501, based on the random forest model, XGBoost model and LightGBM model, the main control factors were used as input to build an oil and water well casing damage early warning model;
[0126] It should be noted that first, whether the oil well is labeled or not is used as the label data, and the filtered feature data of the main controlling factors are input into the model to establish the casing damage training and prediction of the pumping well based on random forest, XGBoost and LightGBM.
[0127] S502, determining the optimal hyperparameters of each model through grid search to ensure the optimal performance of the oil and water well casing damage early warning model, and based on the evaluation results, selecting the XGBoost model and calculating the SHAP value of each feature and the contribution value of the feature to the oil and water well casing damage;
[0128] It should be noted that the values of the hyperparameters of the three regression models are shown in Tables 2, 3, and 4. Each hyperparameter is based on the result of grid search, by setting the value range of different parameters and using the GridSearchCV method of the sklearn module in the Python library to search to obtain the optimal model parameters.
[0129] Table 2 Random forest model hyperparameters
[0130] n_estimators max_depth min_samples_split min_samples_leaf 150 7 3 2
[0131] Table 3 XGBoost model hyperparameters
[0132] booster eta learning_rate max_depth subsample colsample_bytree base_score gbtree 0.06 0.02 3 0.7 0.9 0.6
[0133] Table 4 LightGBM model hyperparameters
[0134]
[0135] The training and test sets of the three models are divided in a ratio of 7:3 and the system divides the training and test sets by itself to ensure the effectiveness and fairness of the result comparison. At the same time, before training, all data are normalized to reduce the impact of different parameter magnitudes on the model results. The final optimal training parameters and prediction evaluation results are shown in Table 5.
[0136] Table 5 Index evaluation results of the three models
[0137]
[0138] According to the training and evaluation results, the XGBoost model is selected, and then SHAP is combined with the XGB model to explain the impact of each feature on the prediction. The model method is understood by explaining the impact of each feature on the prediction; the SHAP value of each feature is calculated for a specific sample, thereby showing the contribution of each feature to the casing loss of the oil well. The physical significance of this method is that it combines the explanatory power of the model with the original data, and explains and quantifies the prediction of the model. The contribution value SHAP_XGB of each feature of each well to the casing loss is calculated through XGBboost and SHAP.
[0139] It should be noted that if Figure 6 and 7 As shown, the influence of each feature on sample classification is obtained, so as to better understand the prediction results of the model and show the contribution of each feature to oil well casing loss.
[0140] S503, performing weighted summation on the casing failure probability of the XGBoost model and the SHAP contribution value to obtain a comprehensive health index;
[0141] It should be noted that the loss probability of the XGBoost model and the SHAP contribution of each feature combined with the above sample data information HI n , and weighted sum them to obtain a comprehensive health index, which can more comprehensively reflect the casing damage of each oil well and the impact of various characteristics on casing damage.
[0142] S504, mapping the comprehensive health index to a range of 0-1, using this range as the health index of the oil and water wells, and taking the contribution degree value and the predicted probability into consideration to further evaluate the health status of the oil field.
[0143] It should be noted that this probability is finally mapped to the range of 0-1 as the health index of the oil well. This method can effectively combine the feature contribution and the predicted probability to form a comprehensive health index to evaluate the health status of the oil well. Classification according to the health level HN value: With the different severity of the casing damage well, the health index will show different trends. After predicting the health status using the above method, the health status should be divided into different levels according to the HN value of the health index, namely high risk, medium risk and low risk. As shown in Table 6.
[0144] Table 6 Health Index HN Range
[0145] Health status HN Health Value High risk HN>0.5 Moderate 0.3<HN<=0.5 Low risk 0<HN<=0.3
[0146] According to the existing data and the statistical scope, Figure 8As shown in the figure, the thresholds of HN health values from high risk to medium risk and low risk are obtained as the basis for casing loss warning.
[0147] In summary, by establishing a data warehouse of casing loss influencing factors and conducting comprehensive data extraction, cleaning and conversion, the accuracy of casing loss prediction can be avoided due to data quality issues; by using machine learning models and explanatory methods, the prediction model can better explain the impact of features, increasing the interpretability of the model; making the prediction results more credible, because it not only focuses on the output of the prediction, but also understands how the prediction is based on features and explanatory information. This helps to increase users' trust in the prediction results.
[0148] Embodiment 2:
[0149] This embodiment provides an oil and water well casing early warning device, which includes an acquisition module 701, a preprocessing module 702, an analysis module 703, a calculation module 704 and an early warning module 705, wherein:
[0150] Acquisition module 701: used to integrate historical data in the oil and water well system through a data processing tool to obtain oilfield data information, wherein the data processing tool is used to extract, convert, store and interact with the historical data;
[0151] Preprocessing module 702: used to preprocess the oilfield data information, wherein the preprocessing includes removing abnormal values in the oilfield data information, screening abnormal values based on the box plot method, filling missing values, processing data imbalance and normalization, to obtain the processed oilfield data information;
[0152] Analysis module 703: used to perform correlation analysis on the oilfield data information using the Pearson correlation coefficient method, including excluding features with high correlation and retaining features with low correlation to obtain first feature information;
[0153] Calculation module 704: used to combine the linear dimensionality reduction algorithm, the random forest algorithm and the interpretable machine learning method to perform weighted averaging on the first feature information to obtain a comprehensive feature importance score, which includes the contribution of each sample and its importance ratio in the whole, and select the feature whose importance weight exceeds the threshold as the main control factor;
[0154] Early warning module 705: used to derive the threshold value of the health value of each well in the oil and water well system from high risk to medium risk and then to low risk based on the main control factors and in combination with the machine learning model, and use the obtained threshold value as the casing damage early warning indicator of the oil and water wells, so as to obtain the health status of the oil field.
[0155] Specifically, the pre-processing module 702 includes a removal unit 7021, a filling unit 7022, a first processing unit 7023, and a second processing unit 7024, wherein:
[0156] Elimination unit 7021: used to identify abnormal values by calculating the upper and lower quartiles, median and IQR in the oil field data information, and eliminate the abnormal values to obtain first data, and the abnormal values in the first data can be deleted or replaced with appropriate values;
[0157] Filling unit 7022: used to fill missing values in the first data by using KNN filling method to obtain filled second data;
[0158] The first processing unit 7023 is used to perform imbalance processing on the second data by using the SMOTE method to obtain third data;
[0159] The second processing unit 7024 is used to process the third data according to the normalization method to obtain processed oilfield data information, wherein the result value is mapped to [0, 1] or a self-defined interval during the processing, and the calculation formula is as follows:
[0160]
[0161] Among them, max is the maximum value of the sample data, and min is the minimum value of the sample data.
[0162] Specifically, the analysis module includes an analysis unit and a judgment unit, wherein:
[0163] The analysis unit 7031 is used to perform correlation analysis on the oilfield data information using the Pearson correlation coefficient method to obtain a relationship value between the Pearson correlation coefficient and the degree of correlation, wherein the calculation formula of the Pearson correlation coefficient method is as follows:
[0164]
[0165] In the formula, r represents the correlation coefficient, X i , Y i Represents the values of two variables, Respectively represent the average values of two variables;
[0166] The judgment unit 7032 is used to judge the size of the correlation coefficient according to the relationship value, record the correlation coefficient greater than 0.7 as an extremely strong correlation, record the correlation coefficient less than 0.7 or equal to 0.7 as an extremely weak correlation, delete one of the variables with the extremely strong correlation, retain the extremely weak correlation, and obtain the first feature information.
[0167] Specifically, the early warning module 705 includes a construction unit 7051, a determination unit 7052, a calculation unit 7053 and a synthesis unit 7054, wherein:
[0168] Construction unit 7051: used to construct an oil and water well casing damage early warning model based on a random forest model, an XGBoost model and a LightGBM model, taking the main control factors as input;
[0169] Determining unit 7052: used to determine the best hyperparameters of each model through grid search to ensure the best performance of the oil and water well casing damage early warning model, select the XGBoost model based on the evaluation results and calculate the SHAP value of each feature and the contribution value of the feature to the oil and water well casing damage;
[0170] Calculation unit 7053: used for performing weighted summation of the casing failure probability of the XGBoost model and the SHAP contribution value to obtain a comprehensive health index;
[0171] Comprehensive unit 7054: used to map the comprehensive health index into a range of 0-1, use this range as the health index of oil and water wells, and consider the comprehensive contribution value and predicted probability to evaluate the health status of the oil field.
[0172] It should be noted that, regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0173] Embodiment 3:
[0174] Corresponding to the above method embodiment, this embodiment also provides an oil and water well casing early warning device. The oil and water well casing early warning device described below and the oil and water well casing early warning method described above can refer to each other.
[0175] Figure 2 FIG. 8 is a block diagram of an oil and water well casing early warning device 800 according to an exemplary embodiment. Figure 2 As shown, the oil and water well casing early warning device 800 includes: a processor 801 and a memory 802. The oil and water well casing early warning device 800 also includes one or more of a multimedia component 803, an I / O interface 804, and a communication component 805.
[0176] The processor 801 is used to control the overall operation of the oil and water well casing early warning device 800 to complete all or part of the steps in the above-mentioned oil and water well casing early warning method. The memory 802 is used to store various types of data to support the operation of the oil and water well casing early warning device 800, and these data may include, for example, instructions for any application or method operated on the oil and water well casing early warning device 800, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, disk or optical disk. The multimedia component 803 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 802 or sent via the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above-mentioned other interface modules can be a keyboard, a mouse or a button, etc. These buttons can be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the oil and water well casing early warning device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 805 can include: a Wi-Fi module, a Bluetooth module or an NFC module.
[0177] In an exemplary embodiment, the oil and water well casing early warning device 800 can be implemented by one or more application specific integrated circuits (Application Specific Integrated Circuit, referred to as ASIC), digital signal processors (Digital Signal Processor, referred to as DSP), digital signal processing devices (Digital Signal Processing Device, referred to as DSPD), programmable logic devices (Programmable Logic Device, referred to as PLD), field programmable gate arrays (Field Programmable Gate Array, referred to as FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned oil and water well casing early warning method.
[0178] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned oil and water well casing early warning method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 802 including program instructions, and the above-mentioned program instructions can be executed by the processor 801 of the oil and water well casing early warning device 800 to complete the above-mentioned oil and water well casing early warning method.
[0179] Embodiment 4:
[0180] Corresponding to the above method embodiment, a readable storage medium is also provided in this embodiment. The readable storage medium described below and the oil and water well casing early warning method described above can refer to each other.
[0181] A computer program is stored on the readable storage medium, and when the computer program is executed by the processor, the steps of the oil and water well casing early warning method of the above method embodiment are implemented.
[0182] The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.
[0183] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
[0184] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. An oil and water well casing early warning method, characterized in that: include: Integrate historical data in the oil and water well system through a data processing tool to obtain oilfield data information, wherein the data processing tool is used to extract, convert, store and interact with the historical data; Preprocessing the oilfield data information, wherein the preprocessing includes removing outliers in the oilfield data information, screening outliers based on a box plot method, filling missing values, processing data imbalance, and normalizing to obtain the processed oilfield data information; Performing correlation analysis on the oilfield data information using the Pearson correlation coefficient method, including excluding features with high correlation and retaining features with low correlation, to obtain first feature information; Combining the linear dimensionality reduction algorithm, the random forest algorithm and the interpretable machine learning method, the first feature information is weighted averaged to obtain a comprehensive feature importance score, which includes the contribution of each sample and its importance ratio in the whole, and the features whose importance weight exceeds the threshold are selected as the main control factors; Based on the main controlling factors and combined with the machine learning model, the threshold values of the health value of each well in the oil and water well system are obtained from high risk to medium risk and then to low risk. The obtained threshold values are used as early warning indicators for casing damage of oil and water wells, thereby obtaining the health status of the oil field.
2. The oil and water well casing early warning method according to claim 1 is characterized in that: The oilfield data information is preprocessed, including: Identify outliers by calculating the upper and lower quartiles, median and IQR in the oilfield data information, and remove the outliers to obtain first data, wherein the outliers in the first data can be deleted or replaced with appropriate values; Using the KNN filling method to fill missing values in the first data to obtain filled second data; Using the SMOTE method to perform imbalance processing on the second data to obtain third data; The third data is processed according to the normalization method to obtain processed oilfield data information, wherein the result value is mapped to [0, 1] or a self-defined interval during the processing, and the calculation formula is as follows: Among them, max is the maximum value of the sample data, and min is the minimum value of the sample data.
3. The oil and water well casing early warning method according to claim 1 is characterized in that: The Pearson correlation coefficient method is used to perform correlation analysis on the oilfield data information, which includes excluding features with high correlation and retaining features with low correlation to obtain first feature information, which includes: The Pearson correlation coefficient method is used to perform correlation analysis on the oilfield data information to obtain the relationship value between the Pearson correlation coefficient and the degree of correlation, wherein the calculation formula of the Pearson correlation coefficient method is as follows: In the formula, r represents the correlation coefficient, X i , Y i Represents the values of two variables, Respectively represent the average values of two variables; The size of the correlation coefficient is determined according to the relationship value, and a correlation coefficient greater than 0.7 is recorded as an extremely strong correlation, and a correlation coefficient less than 0.7 or equal to 0.7 is recorded as an extremely weak correlation. One of the variables with the extremely strong correlation is deleted, and the extremely weak correlation is retained to obtain the first feature information.
4. The oil and water well casing early warning method according to claim 1 is characterized in that: Based on the main control factors, combined with the machine learning model, the thresholds of the health value of each well in the oil and water well system from high risk to medium risk and then to low risk are obtained, and the obtained thresholds are used as the casing damage warning indicators of the oil and water wells, so as to obtain the health status of the oil field, including: Based on the random forest model, XGBoost model and LightGBM model, the main control factors were used as input to build an oil and water well casing damage early warning model; Determine the optimal hyperparameters of each model through grid search to ensure the optimal performance of the oil and water well casing damage early warning model, select the XGBoost model based on the evaluation results, and calculate the SHAP value of each feature and the contribution value of the feature to the oil and water well casing damage; The casing failure probability of the XGBoost model and the SHAP contribution value are weighted and summed to obtain a comprehensive health index; The comprehensive health index is mapped to a range of 0-1, and this range is used as the health index of oil and water wells. The contribution degree value and the predicted probability are considered comprehensively to evaluate the health status of the oil field.
5. An oil and water well casing early warning device, characterized in that: include: Acquisition module: used to integrate historical data in the oil and water well system through data processing tools to obtain oil field data information, wherein the data processing tools are used to extract, convert, store and interact with the historical data; Preprocessing module: used for preprocessing the oilfield data information, wherein the preprocessing includes removing outliers in the oilfield data information, screening outliers based on the box plot method, filling missing values, processing data imbalance and normalization, so as to obtain the processed oilfield data information; Analysis module: used for performing correlation analysis on the oilfield data information using the Pearson correlation coefficient method, including excluding features with high correlation and retaining features with low correlation to obtain first feature information; Calculation module: used to combine the linear dimensionality reduction algorithm, the random forest algorithm and the interpretable machine learning method to perform weighted averaging on the first feature information to obtain a comprehensive feature importance score, which includes the contribution of each sample and its importance ratio in the whole, and selects the features whose importance weight exceeds the threshold as the main control factors; Early warning module: used to derive the threshold value of the health value of each well in the oil and water well system from high risk to medium risk and then to low risk based on the main control factors and combined with the machine learning model, and use the obtained threshold value as the casing damage early warning indicator of the oil and water wells, so as to obtain the health status of the oil field.
6. The oil and water well casing early warning device according to claim 5, characterized in that: The pre-processing module includes: Elimination unit: used for identifying outliers by calculating the upper and lower quartiles, median and IQR in the oilfield data information, and eliminating the outliers to obtain first data, wherein the outliers in the first data can be deleted or replaced with appropriate values; Filling unit: used for filling missing values of the first data by using KNN filling method to obtain filled second data; A first processing unit: configured to perform imbalance processing on the second data by using a SMOTE method to obtain third data; The second processing unit is used to process the third data according to the normalization method to obtain processed oilfield data information, wherein the result value is mapped to [0,1] or a self-defined interval during the processing, and the calculation formula is as follows: Among them, max is the maximum value of the sample data, and min is the minimum value of the sample data.
7. The oil and water well casing early warning device according to claim 5, characterized in that: The analysis module includes: Analysis unit: used to perform correlation analysis on the oilfield data information using the Pearson correlation coefficient method to obtain the relationship value between the Pearson correlation coefficient and the degree of correlation, wherein the calculation formula of the Pearson correlation coefficient method is as follows: In the formula, r represents the correlation coefficient, X i , Y i Represents the values of two variables, X and Y represent the average values of the two variables respectively; A judgment unit is used to judge the size of the correlation coefficient according to the relationship value, record the correlation coefficient greater than 0.7 as an extremely strong correlation, record the correlation coefficient less than 0.7 or equal to 0.7 as an extremely weak correlation, delete one of the variables with the extremely strong correlation, retain the extremely weak correlation, and obtain the first feature information.
8. The oil and water well casing early warning device according to claim 5, characterized in that: The early warning module includes: Construction unit: used to construct an oil and water well casing damage early warning model based on the random forest model, XGBoost model and LightGBM model, taking the main control factors as input; Determination unit: used to determine the best hyperparameters of each model through grid search to ensure the best performance of the oil and water well casing damage early warning model, select the XGBoost model based on the evaluation results and calculate the SHAP value of each feature and the contribution value of the feature to the oil and water well casing damage; Calculation unit: used for performing weighted summation of the casing failure probability of the XGBoost model and the SHAP contribution value to obtain a comprehensive health index; Comprehensive unit: used to map the comprehensive health index into the range of 0-1, use this range as the health index of oil and water wells, and consider the comprehensive contribution value and predicted probability to evaluate the health status of the oil field.
9. An oil and water well casing early warning device, characterized in that: include: Memory for storing computer programs; A processor is used to implement the oil and water well casing early warning method as claimed in any one of claims 1 to 4 when executing the computer program.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the oil and water well casing early warning method according to any one of claims 1 to 4 is implemented.