A well leakage warning method based on the PCA-XGBOOST algorithm
By applying the PCA-XGBOOST algorithm to the well leakage warning method in oil drilling engineering, the problem of inaccurate warning of well leakage risk in the existing technology is solved, and higher prediction accuracy and accident prevention effects are achieved.
Patent Information
- Application Number
- CN202210907177.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-29
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2042-07-29
AI Technical Summary
The prior art is difficult to accurately warn of well leakage risks in oil drilling projects, making it difficult to prevent possible drilling accidents.
The well leakage early warning method based on PCA-XGBOOST algorithm is adopted. By establishing a comprehensive well recording time series matrix, data preprocessing, key feature parameter extraction and model training are carried out, and alarm information is output to prevent well leakage accidents.
It significantly improves the prediction accuracy of well leakage accidents and avoids drilling accidents and resource losses caused by inaccurate early warnings.
Smart Images

Figure CN115345224B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of oil drilling lost circulation prediction, and particularly relates to a lost circulation early warning method based on the PCA-XGBOOST algorithm. Background Art
[0002] Oil is a viscous, dark brown liquid, known as the "blood of industry", and is an important energy source. In recent years, oil and gas exploration activities in petroleum engineering have been developing towards deeper formations. The comprehensive mud logging technology is widely used in drilling engineering because it can characterize underground state information. The comprehensive mud logging technology includes both drilling engineering parameter information and corresponding geological information, and can effectively characterize the parameter change trends of drilling engineering under different working conditions, providing solutions for pre-drilling prediction, during-drilling early warning, and post-drilling evaluation of drilling engineering.
[0003] In the comprehensive mud logging technology, there are characteristic parameters such as well depth, hook load, drilling pressure, riser pressure, and total pit volume. The data is collected at a frequency of once every 3 seconds, and the data volume is large. It is relatively difficult to directly extract the required information from it. Therefore, it is necessary to extract the main characteristic parameters from the comprehensive mud logging time series.
[0004] Complex downhole conditions are a common problem faced during the drilling process. Lost circulation is one of the most common risks in oil drilling engineering. Once lost circulation occurs, it will lead to drilling accidents of varying degrees, resulting in casualties and property resource losses, and even well collapse, thus triggering a series of serious consequences.
[0005] Currently, the comprehensive mud logging technology is usually used to collect the characteristic parameters of drilling engineering, and the lost circulation risk is predicted based on the collected characteristic parameters. Since the data collected by the comprehensive mud logging information has not been processed accordingly, there is a problem of poor data quality and it cannot accurately warn of the lost circulation risk.
[0006] Therefore, in view of the above technical problems, it is necessary to provide a lost circulation early warning method based on the PCA-XGBOOST algorithm. Summary of the Invention
[0007] The purpose of the present invention is to provide a lost circulation early warning method based on the PCA-XGBOOST algorithm to solve the problem that lost circulation cannot be accurately warned in the above-mentioned drilling engineering.
[0008] To achieve the above purpose, the technical solution provided by an embodiment of the present invention is as follows:
[0009] A lost circulation early warning method based on the PCA-XGBOOST algorithm includes the following steps:
[0010] S1. Establish a comprehensive logging time series matrix. According to the status information of drilling operations, mark the comprehensive logging time series data according to different working conditions. Mark the normal working condition as 0 and the data under the well leakage accident as 1;
[0011] S2. Data preprocessing. Eliminate the outliers in the comprehensive logging time series data through the 3σ criterion, and use the Savitzky-Golay filter to smooth the comprehensive logging time series data after elimination;
[0012] S3. Extract key characteristic parameters. For the comprehensive logging time series matrix after preprocessing in S2, use the PCA algorithm to calculate the importance ranking of each characteristic parameter successively, extract the key characteristic parameters according to the set importance threshold, and eliminate the weakly correlated parameters;
[0013] S4. Model training. Input the time series matrix of the key parameters extracted in S4 into the XGBoost regression model, and select the hyperparameters with the smallest loss function, i.e., the root mean square error, through cross-validation;
[0014] S5. Accident probability prediction. Use the best model obtained by retraining after setting the hyperparameters in S4, and input the real-time working condition data into the model to obtain the probability value of well leakage occurrence;
[0015] S6. Output alarm information. Classify according to the result of the well leakage occurrence probability value predicted by the XGBoost regression model. When the well leakage fault occurrence probability is within a certain limit, output the corresponding alarm information to prevent the occurrence of well leakage accidents in advance.
[0016] Further, the 3σ criterion in S2 can be specifically described as follows: Assume that there are measured values x 1 , x 2 , …, x n under a characteristic parameter. Calculate the arithmetic mean x and the residual error vi = xi - x (i = 1, 2, …, n), and calculate the standard deviation σ. If the residual error v i of a certain measured value x i (1 <= i <= n) satisfies the following formula: |v i | = |x i - x| > 3σ, then it is considered that it should be eliminated.
[0017] Further, in S2, the Savitzky-Golay filter is used to smooth the comprehensive logging time series. Select the parameter characteristics in turn. Consider the 2M + 1 data centered on n = 0 under the current parameter characteristics, where M is the set window size, and use the following formula to fit:
[0018] Further, the output value is obtained by solving a k - 1 degree equation for the parameter features after fitting. The weighting of the convolution is given in polynomial form. To reduce the bias introduced by the filter, the residual of its least - squares fit is:
[0019] Further, the general equation of the simplified least - squares convolution for comprehensive mud logging time - series smoothing is as follows:
[0020]
[0021] In the formula, Y is the original data of a certain parameter feature of the comprehensive mud logging information, and Y * is the target value after smoothing filtering of this original data.
[0022] Further, for the requirement that ε N is minimized, the partial derivatives with respect to each parameter should be equal to 0, then there are:
[0023]
[0024] After arranging both sides of the equation, we can get:
[0025]
[0026] Introduce an auxiliary matrix A, let A = {a nk}, a nk = n k , - M ≤ n ≤ M, 0 ≤ i ≤ N. Then set an auxiliary matrix B such that B = A T A, then there are:
[0027]
[0028] Define: Then we can get: Ba = A T Aa = A T x, a = (A T A) -1 A T x = Hx, where the first - row row vector of H is the convolution coefficient to be found.
[0029] Further, the PCA algorithm in S3 can be specifically described as: Based on the pre - processed comprehensive mud logging time - series matrix X, calculate the average value of n sample data under each parameter feature and subtract the average value of each parameter feature from the corresponding value.
[0030] Further, the PCA algorithm conducts a correlation analysis on the parameters and calculates the covariance matrix A using the following formula:
[0031]
[0032] For any matrix, there always exists a singular value decomposition A. The matrix A is decomposed using SVD, and the eigenvalues and eigenvectors of A are calculated through the following formula:
[0033] A = U∑V T
[0034] In the formula, the U matrix and the V matrix are respectively the matrices composed of the orthonormalized eigenvectors of AA T and A T A; the diagonal matrix ∑ is obtained by taking the square root of the eigenvalues of AA T or A T A, and the diagonal elements become the singular values, and the remaining elements except the diagonal are 0.
[0035] Furthermore, the eigenvalues are sorted from large to small. According to the preset K value, the first K corresponding eigenvectors are respectively used as row vectors to form the eigenvector matrix P, and the data is transformed into the new space constructed by the K eigenvectors, that is, Y = PX. The calculation formula for the comprehensive score and ranking is: F = WP, where the F matrix represents the weights of each characteristic parameter factor, W = (w 1 , w 2 , … w k ), and the calculation formula for the weight w i is:
[0036]
[0037] Through the above analysis, the importance of each parameter characteristic can be obtained. After sorting from large to small, those greater than the set threshold are identified as strongly correlated parameters under the well leakage accident, and the rest are weakly correlated parameters.
[0038] Furthermore, the essence of the XGBoost regression algorithm in S6 is to integrate a number of CART regression tree models into a model set based on CART regression trees.
[0039] Compared with the prior art, the present invention has the following advantages:
[0040] First, the present invention combs the outliers of the comprehensive mud logging time series by using the 3σ principle, avoiding the adverse effects of individual values on the accuracy of well leakage risk warning;
[0041] Second, the present invention uses the principal component analysis algorithm to rank the importance of each parameter characteristic of the comprehensive mud logging time series, distinguish the strong and weak correlated parameters related to the occurrence of accident events, and use these extracted strong correlation features for subsequent prediction, which can effectively avoid the occurrence of overfitting and the problems of insufficient memory and slow calculation caused by too large data volume, and improve the operation efficiency;
[0042] III. The present invention uses Extreme Gradient Boosting to perform accident probability regression prediction on the comprehensive mud logging time series, significantly improving the accuracy of accident probability prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments recorded in the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0044] Figure 1 It is a flowchart of a lost circulation warning method based on the PCA-XGBOOST algorithm in an embodiment of the present invention;
[0045] Figure 2 It is a model diagram of the PCA-XGBoost algorithm in an embodiment of the present invention;
[0046] Figure 3 It is a functional diagram of a lost circulation warning method based on the PCA-XGBOOST algorithm in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0047] The present invention will be described in detail below in conjunction with the embodiments shown in the drawings. However, these embodiments do not limit the present invention, and any structural, method, or functional transformation made by those of ordinary skill in the art based on these embodiments is included in the protection scope of the present invention.
[0048] The present invention discloses a lost circulation warning method based on the PCA-XGBOOST algorithm. Referring to Figures 1 - 3 as shown, the method includes the following steps:
[0049] S1. Establish a comprehensive mud logging time series matrix. According to the status information of the drilling operation, the comprehensive mud logging time series data is marked according to different working conditions. The normal working condition is marked as 0, and the data under the lost circulation accident is marked as 1;
[0050] S2. Data preprocessing. Outliers in the comprehensive mud logging time series data are removed by the 3-sigma rule, and the Savitzky-Golay filter is used to smooth the comprehensive mud logging time series data after the outliers are removed;
[0051] S3. Extraction of key characteristic parameters. After the preprocessing of the comprehensive mud logging time series matrix in S2, the PCA algorithm is used to calculate the importance ranking of each characteristic parameter in sequence, and the key characteristic parameters are extracted according to the set importance threshold, and the weakly correlated parameters are removed;
[0052] S4. Model training: Input the time series matrix of the key parameters extracted in S4 into the XGBoost regression model, and select the hyperparameters with the minimum loss function, i.e., the root mean square error, through cross-validation.
[0053] S5. Accident probability prediction: Use the best model obtained by retraining after setting the hyperparameters in S4, and input the real-time working condition data into the model to obtain the probability value of well leakage occurrence.
[0054] S6. Output warning information: Classify according to the well leakage occurrence probability value predicted by the XGBoost regression model. When the well leakage failure probability is within a certain limit, output the corresponding warning information to prevent the occurrence of well leakage accidents in advance.
[0055] Among them, the 3σ criterion in S2 can be specifically described as follows: Assume that there are measurement values x 1 , x 2 , …, x n under a characteristic parameter. Calculate the arithmetic mean x and the residual error vi = xi - x (i = 1, 2, …, n), and calculate the standard deviation σ. If the residual error v i of a certain measurement value x i (1 <= i <= n) satisfies the following formula: |v i | = |x i - x| > 3σ, then it is considered that it should be excluded.
[0056] Meanwhile, in S2, the comprehensive logging time series is smoothed by Savitzky-Golay filtering. Select parameter features in sequence, consider 2M + 1 data centered on n = 0 under the current parameter feature, where M is the set window size, and use the following formula to fit:
[0057] Specifically, the output value of the fitted parameter feature is obtained by solving a k - 1 degree equation The weights of the convolution are given in polynomial form. To reduce the bias introduced by the filter, the residual of its least squares fit is:
[0058]
[0059] Among them, the general equation of the simplified least squares convolution for smoothing the comprehensive logging time series is as follows:
[0060]
[0061] In the formula, Y is the original data of a certain parameter feature of the comprehensive logging information, and Y * is the target value after smoothing filtering of this original data.
[0062] Specifically, the requirement ε N The partial derivatives of the minimum with respect to each parameter should be equal to 0, so we have:
[0063]
[0064] After arranging both sides of the equation, we can get:
[0065]
[0066] Introduce an auxiliary matrix A, let A = {a nk}, a nk = n k , -M ≤ n ≤ M, 0 ≤ i ≤ N. Then set another auxiliary matrix B such that B = A T A, so we have:
[0067]
[0068] Define: Then we can get: Ba = A T Aa = A T x, a = (A T A) -1 A T x = Hx, where the first row vector of H is the required convolution coefficient.
[0069] Among them, the PCA algorithm in S3 can be specifically described as follows: Based on the preprocessed comprehensive logging time series matrix X, calculate the average value of n sample data under each parameter feature And subtract the average value of each parameter feature from the corresponding value.
[0070] At the same time, the PCA algorithm conducts a correlation analysis on the parameters and calculates the covariance matrix A using the following formula:
[0071]
[0072] For any matrix, there always exists a singular value decomposition A. Use SVD to decompose matrix A and calculate the eigenvalues and eigenvectors of A through the following formula:
[0073] A = U∑V T
[0074] In the formula, matrices U and V are respectively composed of the eigenvectors of AA T and A T A that are unitized; the diagonal matrix ∑ is obtained by taking the square root of the eigenvalues of AA T or A T A. The diagonal elements become singular values, and the remaining elements except the diagonal are 0.
[0075] Specifically, the eigenvalues are sorted from largest to smallest. According to the preset value of K, the first K corresponding eigenvectors are respectively used as row vectors to form the eigenvector matrix P, and the data is transformed into the new space constructed by the K eigenvectors, that is, Y = PX. The calculation formula for the comprehensive score and ranking is: F = WP, where the F matrix represents the weight of each characteristic parameter factor, and W = (w 1 , w 2 , … w k ), and the calculation formula for the weight w i is:
[0076]
[0077] Through the above analysis, the importance of each parameter feature can be obtained. After sorting from largest to smallest, those greater than the set threshold are identified as strongly correlated parameters under the lost circulation accident, and the rest are weakly correlated parameters.
[0078] Refer to Figure 2 As shown, the essence of the XGBoost regression algorithm in S6 is to integrate a number of CART regression tree models into a model set based on CART regression trees.
[0079] Refer to Figure 2 As shown, the CART regression tree assumes that the tree is a binary tree. By continuously splitting the features, for example, if the current tree node is split based on the j-th eigenvalue, the samples with the eigenvalue less than s are divided into the left subtree, and the samples greater than s are divided into the right subtree.
[0080] Specifically, for the regression problem with the goal of minimizing the root mean square error (RMSE), each successive tree is trained based on the error left by the early tree set. For the strongly correlated feature parameters of lost circulation accident warning proposed based on the PCA algorithm, XGBoost uses a more regularized model formulation to control the fitting and build the model, which can be expressed by the following formula:
[0081]
[0082] where K is the number of trees, f is a function in the function space F, and F is the set of all possible regression trees, and its definition formula is:
[0083] F = {f(x) = w q(x)}(q:R m →T, w ∈ R T )
[0084] where q represents the structure of the tree, w represents the weight of the leaf, T represents the number of leaves in the tree, and in addition, f(x) corresponds to q and w related to the independent tree.
[0085] Among them, in order to optimize the integrated tree and reduce the error, the optimization objective of XGBoost is as follows:
[0086]
[0087] In the formula is the training loss function, and Ω(f k ) is the regularization term. There is no restriction on the form of the loss function, only requiring second-order differentiability. Here, the root mean square error function can be adopted, while the regularization term Ω(f k ) has a fixed form, otherwise the weight w i of the leaf node cannot be derived. The specific form is as follows:
[0088]
[0089] Adding the regularization term is an improvement of XGBoost compared to the traditional GBDT. The first term is the main innovation point of XGBoost. The traditional GBDT model does not have a regularization term but controls the model complexity through heuristic methods such as pruning. The second term is the L2-norm of the leaf node. As a common method for setting penalty terms, in order to obtain f k , the training method adopted is the step-by-step algorithm. Then, the objective function of the gradient boosting tree in the t-th round can be obtained:
[0090]
[0091] This step greatly simplifies the optimization objective, changing from optimizing K functions at one time to only optimizing one function in each round. Next, perform a second-order Taylor expansion on the loss function l at the predicted value of the previous round, and use the increment f t (.) of the predicted value in the t-th round as the independent variable increment, so as to separate f t from l():
[0092]
[0093] If for each sample i, the first-order and second-order derivative values of the loss function at are respectively denoted as g i , h i , and ignoring the constant first term, we can obtain:
[0094]
[0095] Define the set of sample subscripts I j ={i|q(x i )=j} on the leaf node j, and the objective function can be modified as:
[0096]
[0097] At this time, except for w j are all known terms, and the problem of minimizing the loss function is transformed into finding the w j minimization problem, and we can obtain:
[0098]
[0099] For taking the partial derivative, we can obtain the optimal score for each leaf node j as:
[0100]
[0101] Substituting the above results back into the loss function, we obtain the optimized objective function value:
[0102]
[0103] The above formula can be used to measure the quality of the tree structure q. Generally, it is not possible to enumerate all possible tree structures, but a greedy algorithm that starts from a single leaf and iteratively adds branches to the tree is adopted. Assume I L and I R are the example sets of the left and right nodes after the leaf node is split respectively. Then, the reduction in loss after splitting can be obtained by the following formula:
[0104]
[0105] The above formula is usually used for the evaluation after splitting in practice.
[0106] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above exemplary embodiments, and the present invention can be implemented in other specific forms without departing from the spirit or basic characteristics of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present invention. Any reference signs in the claims should not be regarded as limiting the claimed rights.
[0107] In addition, it should be understood that although this specification is described according to embodiments, not every embodiment only contains an independent technical solution. This narrative manner of the specification is only for clarity. Those skilled in the art should regard the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A well leakage early warning method based on PCA-XGBOOST algorithm, It is characterized in that The following steps are involved: S1. Establish a comprehensive logging time series matrix. According to the state information of the drilling operation, mark the comprehensive logging time series data according to different working conditions. The normal working condition is marked as 0, and the data under the well leakage accident is marked as 1; S2, data preprocessing, using the Laida rule to remove outliers from the comprehensive logging time series data, and using Savitzky-Golay filtering to smooth the comprehensive logging time series data after removal; S3, extraction of key characteristic parameters, using the PCA algorithm to calculate the importance ranking of each characteristic parameter of the comprehensive logging time series matrix after preprocessing in S2, extracting the key characteristic parameters according to the set importance threshold, and eliminating weakly correlated parameters; S4, model training, input the time series matrix of key parameters extracted in S4 into the XGBoost regression model, and select the hyperparameters with the smallest loss function, i.e., root mean square error, through cross-validation; S5, accident probability prediction, after setting the hyperparameters in S4, train again to obtain the best model, input the real-time working condition data into the model to obtain the probability value of well leakage; S6. Output alarm information, and classify it according to the probability value of well leakage predicted by the XGBoost regression model. When the probability of well leakage failure is within a certain limit, output the corresponding alarm information, so as to prevent the occurrence of well leakage accidents in advance.
2. A method for early warning of lost circulation based on PCA-XGBOOST algorithm according to claim 1, It is characterized in that The Laida rule in S2 can be specifically described as: Assume that there are measured values \(x\) under a characteristic parameter 1 , \(x\) 2 , …, \(x\) n . Calculate the arithmetic mean \(\overline{x}\) and the residual error \(v_i = x_i-\overline{x}\) (\(i = 1, 2,\cdots, n\)), and calculate the standard deviation \(\sigma\). If the residual error \(v\) i of a certain measured value \(x\) i (\(1\leq i\leq n\)) satisfies the following formula: \(|v\) i | = |x i -\(\overline{x}\)| > \(3\sigma\), then it is considered that it should be rejected.
3. A method for early warning of lost circulation based on PCA-XGBOOST algorithm according to claim 1, It is characterized in that In S2, the comprehensive logging time series is smoothed by Savitzky-Golay filtering, and parameter features are selected in turn. Considering 2M+1 data centered at n=0 under the current parameter features, M is the set window size, and the following formula is used for fitting:
4. A method for early warning of well leakage based on PCA-XGBOOST algorithm according to claim 3, It is characterized in that The output value is obtained by solving a k-1 degree equation for the parameter features after fitting The weighting of the convolution is given in polynomial form. To reduce the bias introduced by the filter, the residual of its least squares fit is:
5. The method for early warning of lost circulation based on PCA-XGBOOST algorithm according to claim 3, It is characterized in that The general equation of the simplified least squares convolution for the smoothing of the comprehensive logging time series is as follows: Where Y is the original data of a certain parameter feature in the comprehensive mud logging information, Y * is the target value after smoothing filtering of the original data.
6. A method for early warning of lost circulation based on PCA-XGBOOST algorithm according to claim 4, It is characterized in that Requirement ε N The minimum value should be such that the partial derivatives with respect to each parameter are equal to 0, so we have: Arranging both sides of the equation yields: Introduce an auxiliary matrix A, and let A = {a nk}, where a nk = n k , -M ≤ n ≤ M, 0 ≤ i ≤ N. Then set up an auxiliary matrix B such that B = A T A, and we have: Definition: Then we can obtain: Ba = A T Aa = A T x, a = (A T A) -1 A T x = Hx, where the first row vector of H is the desired convolution coefficient.
7. The method for early warning of lost circulation based on PCA-XGBOOST algorithm according to claim 1, It is characterized in that The PCA algorithm in S3 can be specifically described as follows: Based on the preprocessed comprehensive logging time series matrix X, calculate the average value of n sample data under each parameter feature. And subtract the average value of each parameter feature from the corresponding numerical value.
8. A method for early warning of lost circulation based on PCA-XGBOOST algorithm according to claim 7, It is characterized in that The PCA algorithm performs correlation analysis on the parameters and calculates the covariance matrix A using the following formula: For any matrix, there always exists a singular value decomposition A. By using the SVD to decompose matrix A, the eigenvalues and eigenvectors of A can be calculated through the following formula: A = U∑V T Wherein, matrix U and matrix V are respectively AA T and A T matrices composed of the normalized eigenvectors of A; the diagonal matrix ∑ is obtained by taking the square root of the eigenvalues of AA T or A T A, the diagonal elements become singular values, and the remaining elements except the diagonal are 0.
9. A lost circulation warning method based on the PCA-XGBOOST algorithm according to claim 8, characterized in that, The eigenvalues are sorted from largest to smallest. According to the preset value of K, the first K corresponding eigenvectors are used as row vectors respectively to form the eigenvector matrix P. The data is transformed into the new space constructed by the K eigenvectors, that is, Y = PX. The calculation formula for the comprehensive score and ranking is: F = WP, where the F matrix represents the weight of each characteristic parameter factor, W = (w 1 , w 2 , … w k ). The calculation formula for the weight w i is: Through the above analysis, the importance of each parameter feature can be obtained. After sorting from large to small, those greater than the set threshold are identified as strongly correlated parameters under lost circulation accidents, and the rest are weakly correlated parameters.
10. A lost circulation warning method based on the PCA-XGBOOST algorithm according to claim 1, characterized in that, The essence of the XGBoost regression algorithm in S6 is to integrate a number of CART regression tree models into a model set based on CART regression trees.
Citation Information
Patent Citations
Drill bit jamming accident detection and early-warning method based on logging big data
CN109594967A
Well leakage accident detection and early warning method based on big data
CN111652253A