A drilling abnormal event detection method based on periodic coding
Through a method based on periodic coding, combined with graph attention network and variational autoencoder, the characteristics and contextual information of drilling data are extracted, which solves the problem of anomaly detection in drilling construction, achieves efficient detection of abnormal drilling events, and improves the efficiency of drilling operations. Security.
Patent Information
- Application Number
- CN202411095178.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-08-12
AI Technical Summary
During the drilling construction process, existing technologies are difficult to accurately and effectively detect abnormal events, leading to safety risks and accidents.
Using a method based on periodic coding, combined with graph attention network, selective state space model, gated recurrent unit and neural network, the logging data while drilling is processed through a sliding window, feature relationships and contextual information are extracted, and the root mean square error is used The loss function and variational autoencoder perform prediction and reconstruction, and anomaly scores are calculated to determine anomalies.
This method can better extract the relationship between drilling parameters and parameters, detect abnormal drilling events, effectively prevent accidents, and improve drilling safety.
Smart Images

Figure CN118626957B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine learning and drilling development, and in particular to a drilling abnormal event detection method based on periodic coding. Background Art
[0002] During the drilling construction process, the possibility of drilling engineering accidents is happening at any time, which is a huge hidden danger threatening drilling safety. It will not only affect the environment and economy, but also threaten the lives of construction workers. Therefore, it is urgent to accurately and effectively detect abnormalities in the drilling process. With the scientific development of modern society and the popularization of sensors, comprehensive logging instruments have been widely used in drilling projects. Comprehensive logging instruments can directly detect multiple parameters such as drilling, drilling fluid, gas and formation pressure, and can continuously detect the entire process of drilling construction. In recent years, with the rapid development of machine learning technology around the world, intelligent oil and gas exploration and development has become a hot spot in the development of the global oil and gas industry. Experts in the field have conducted in-depth research on how to use machine learning technology to improve drilling safety issues. Experts have studied the relationship model between the main influencing factors of safety problems in the drilling process and the corresponding parameter changes, and proposed the combination of drilling models and expert systems, and continuously summarized and explored methods for judging safety risks. Drilling technology is developing from the traditional model to the combination of machine learning and artificial intelligence. Summary of the invention
[0003] Based on the above technical problems, the present invention proposes a drilling abnormal event detection method based on periodic coding, which has periodic coding, graph attention network, selective state space model, gated recurrent unit, neural network and variational autoencoder. The specific technical scheme is as follows.
[0004] A method for detecting abnormal drilling events based on periodic coding comprises the following steps:
[0005] Step S1: Processing the logging while drilling data, using a sliding window to divide the data, defining the data divided from all the logging while drilling data as window data, and loading the data in units of batch-sized window data, and periodically encoding the batch-sized window data using a sinusoidal function change;
[0006] Step S2: Use the graph attention network model to extract the relationship between the window data features with periodic encoding, and use the selective state space model to extract the context information of the window data with periodic encoding, and combine the information extracted by the two models;
[0007] Step S3: Using a gated recurrent unit to extract long-term dependencies of the data obtained in step S2;
[0008] Step S4: Use three fully connected layer neural networks to predict the data obtained in step S3, and use the root mean square error loss function to calculate the error between the original window data and the predicted data, which is defined as the prediction loss; at the same time, use the variational autoencoder to reconstruct the data obtained in S3 and calculate the reconstruction loss; the sum of the prediction loss and the reconstruction loss is taken as the total loss of model training;
[0009] Step S5: Perform model training, repeat steps S2 to S4 and use stochastic gradient descent to perform back propagation and update model network parameters;
[0010] Step S6: After the training is completed, the trained model is used to perform anomaly judgment, and the anomaly score is calculated according to the predicted value in step S4 and the reconstructed probability value. Whether an anomaly occurs is judged according to the anomaly score and the preset anomaly threshold.
[0011] Specifically, the step S1 includes the following sub-steps:
[0012] Step S11: Record the entire original logging while drilling data as ,in represents the set of real numbers, is the total length of the logging data while drilling, is the dimension of the logging while drilling data, that is, the number of features; the original logging while drilling data is standardized, and the formula is as follows:
[0013] ;
[0014] in, is the value after standardization, For logging while drilling data, , Respectively represent the minimum and maximum values of the entire original logging while drilling data;
[0015] Step S12: The standardized logging while drilling data is processed by The sliding window is divided into Load data with batch size and process to get batch data: ,in is the batch size of the data, is the size of the sliding window, is the number of characteristics of logging while drilling data;
[0016] Step S13: Using the sine function The batch data processed in step S12 is periodically encoded; wherein, The dimension is The sine function is applied to each logging data x in the matrix. Encode, the matrix dimension after encoding is .
[0017] Specifically, the step S2 includes the following sub-steps:
[0018] Step S21: Use the graph attention network to extract the relationship between the features of the logging while drilling data, and record the data processed in step S13 as: ,in, The vector representing the i-th feature of the logging while drilling data is The eigenvectors are considered as a complete graph. nodes;
[0019] Step S22: Extract the data processed in step S13 using the selective state space model context information;
[0020] Step S23: combining the relationship between the logging while drilling data features extracted in step S21 with the context information extracted in step S22.
[0021] Specifically, the step S21 further includes the following sub-steps:
[0022] Step S211: perform a transposition operation on the data processed in step S13. , and then perform a linear transformation Get the data to construct the complete graph;
[0023] Step S212: Calculate the edges of the complete graph, i.e. the attention coefficient. First, construct the attention input :
[0024] ;
[0025] in, The first The data of the nodes, Indicates The data of the nodes, Indicates connection, contains the connections of all feature pairs;
[0026] Then calculate the attention coefficient , the calculation formula is:
[0027] ;
[0028] in, is the column vector of learnable parameters, is a nonlinear activation function, represents the attention input calculated in step S212, which contains the connections of all feature pairs;
[0029] Step S213: Calculate the attention score , the calculation formula is:
[0030] ;
[0031] in, Nodes are measured For Node The attention score, yes The adjacent nodes of The number of features representing the logging while drilling data; represents the natural exponential function;
[0032] Step S214: Calculate the output of each node in the graph attention layer. The calculation formula is:
[0033] ;
[0034] in, Indicates The output of the feature vector has the same shape as the input feature vector, represents the number of characteristics of logging while drilling data, Indicates feature vectors, is a linear activation function.
[0035] Specifically, the step S22 further includes the following sub-steps:
[0036] Step S221: The data processed in step S13 After linear projection, the dimension is increased;
[0037] Step S222: The data obtained after the linear projection processing in step S221 is subjected to a one-dimensional convolution with a convolution kernel size of 2, and Linear activation function delinearizes and extracts local features;
[0038] Step S223: extracting context information of the data using the state space model, using the following calculation formula:
[0039] ;
[0040] ;
[0041] in, Indicates the logging data while drilling at time status, Indicates the last moment status, Logging while drilling data The feature vector at time, Represents the state space model extracted Information at the moment, , , , is the learnable parameter matrix; all the information extracted at the time of batch size data is recorded as ;
[0042] Step S224: Use linear projection to transform the data results Project back to the input dimension.
[0043] Specifically, the step S3 includes the following sub-steps:
[0044] Step S31: Use the gated recurrent unit to extract the long-term dependency of the logging data while drilling. First, calculate the information in the memory that needs to be used at the current moment. The calculation formula is:
[0045] ;
[0046] in, Indicates the logging data while drilling at the current time The memory you need, is the learnable parameter matrix, For the memory of the last moment, The logging data while drilling at the current time The eigenvector of
[0047] Step S32: Calculate the memory available at the current time t , the calculation formula is:
[0048] ;
[0049] in, is the learnable parameter matrix;
[0050] Step S33: By current time The output of updates the memory, and the calculation formula is:
[0051] ;
[0052] in, For updated memory, is the learnable parameter matrix;
[0053] Step S34: The last moment Memories and the present moment The output of is weighted summed to obtain the memory of the current time t, and the long-term dependency information of the logging data while drilling is extracted. The calculation formula is:
[0054] .
[0055] Specifically, the step S4 includes the following sub-steps:
[0056] Step S41: After using the gated recurrent unit to calculate the long-term dependency of the logging data while drilling, a fully connected layer network with three hidden dimensions of 2 is used as a prediction-based model, and the root mean square error is used as the loss function to obtain the prediction-based loss function The calculation formula is:
[0057] ;
[0058] in, Indicates the current input The next timestamp of Indicates Middle The value of the feature, represents the value of the i-th feature predicted by the prediction model;
[0059] Step S42: After using the gated recurrent unit to calculate the long-term dependency of the logging while drilling data, the variational autoencoder is used as the reconstruction-based model to define the logging while drilling data processed by step S3 as ; From a conditional distribution Reconstruction, where is the vector representation of the latent space, represents the set of real numbers, that is, the set of all real numbers, express dimensional real vector space, is the dimension of the logging data while drilling after processing in step S3; find the data distribution closest to the reconstruction The optimal model parameters, the true posterior density is expressed as:
[0060] ;
[0061] The edge density is expressed as:
[0062] ;
[0063] Introducing a recognition model Approximate posterior distribution, given the recognition model and generative models , based on the reconstruction loss function The calculation formula is:
[0064] ;
[0065] in, For a given observation In the case of The posterior distribution of ; For a given latent variable In the case of data The conditional distribution of is a latent variable The prior distribution of is the marginal likelihood of the data; and are the parameters learned through the network; is the expected negative log-likelihood of the given data, It is an encoder and The Kulbeck-Leibshaller degree.
[0066] Specifically, the step S5 includes the following sub-steps:
[0067] Step S51: The prediction-based loss calculated in step S4 and reconstruction-based loss The sum is taken as the total loss of model training, expressed as:
[0068] ;
[0069] Step S52: Using momentum and adaptive learning rate The algorithm repeats steps S2 to S4 for each batch size of window data loaded, and updates the model parameters to minimize the total loss.
[0070] Specifically, the step S6 includes the following sub-steps:
[0071] Step S61: Based on the anomaly score of the timestamp, two inference results are obtained for each timestamp, one of which is the predicted value obtained based on the prediction model. , and the other is the reconstruction probability obtained based on the reconstruction model , is the number of features of the logging data while drilling; the anomaly score is calculated for each feature, and the sum of the anomaly scores of all features is taken as the final anomaly score of the timestamp; the final anomaly score calculation formula is:
[0072] ;
[0073] in, Indicates The anomaly score of the feature, is the predicted value With actual value The square error indicates the degree to which the actual value deviates from the predicted value; The probability of encountering an outlier for the reconstruction model; is a hyperparameter, set between 0.4 and 1.0;
[0074] Step S62: Perform a timestamp abnormality judgment, and record the judgment result as , the final anomaly score calculated in step S61 is compared with the anomaly threshold Compare, if the anomaly score is greater than It indicates an abnormality, which is recorded as 1; if the abnormal score is less than It means normal, recorded as 0; specifically expressed as:
[0075] .
[0076] Beneficial effects of the present invention: The present invention proposes a drilling abnormal event detection method based on periodic coding, which uses periodic coding to periodically encode the original logging data while drilling, and uses a graph attention network to extract the relationship between the features of the logging data while drilling, so that the model can learn the change relationship of the main features when the drilling condition occurs. The selective state space model is used to extract the contextual relationship of the logging data while drilling, and the contextual relationship can reflect the trend of data change. When the drilling condition occurs, the change of the logging data while drilling will be different from the change trend of normal data; then the gated cyclic unit is used to extract the long-term dependency of the logging data while drilling, reflecting the data change during the entire drilling process. Finally, a prediction model based on a neural network and a reconstruction model based on a variational autoencoder are used to determine whether the logging data while drilling is abnormal, that is, whether an abnormal condition event occurs. Compared with the existing drilling anomaly detection model, this technology can better extract the relationship between the parameters while drilling and the law of normal data changes, and can effectively detect drilling abnormal events, and take measures to effectively prevent the occurrence of drilling accidents. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Figure 1 It is a flow chart of a method for detecting abnormal drilling events based on periodic coding in an embodiment of the present invention;
[0078] Figure 2 It is a schematic diagram of the network structure in an embodiment of the present invention. DETAILED DESCRIPTION
[0079] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described with reference to the accompanying drawings.
[0080] The purpose of the present invention is to provide a drilling abnormal event detection method based on periodic coding to solve the problem of drilling accidents caused by drilling conditions during the drilling process. The process is as follows: Figure 1 As shown in Figure 2, the overall network architecture is as follows: Figure 2 shown.
[0081] A method for detecting abnormal drilling events based on periodic coding comprises the following steps:
[0082] Step S1: Processing the logging data while drilling (biting pressure, rotation speed, drilling time, hook load, vertical pressure, casing pressure, inlet temperature, outlet temperature, inlet flow rate, outlet flow rate, etc.). First, the logging data while drilling is divided by a sliding window. The data obtained from the division of all the logging data while drilling is defined as window data. Then, the data is loaded in units of batch-sized window data. Finally, the batch-sized window data is periodically encoded using a sinusoidal function change.
[0083] Step S2: Use a graph attention network model (a deep learning method based on graph neural networks that captures the relationship between features by calculating the self-attention and interactive attention of each feature) to extract the relationship between the window data features with periodic encoding, and use a selective state space model to extract the contextual information of the window data with periodic encoding, and combine the information extracted by the two models.
[0084] Step S3: Use a gated recurrent unit to extract long-term dependencies of the data obtained in step S2.
[0085] Step S4: Use three fully connected layer neural networks to predict the data obtained in step S3, and use the root mean square error loss function to calculate the error between the original window data and the predicted data, which is defined as the prediction loss. At the same time, use the variational autoencoder to reconstruct the data obtained in S4 and calculate the reconstruction loss. The calculation method is detailed in step S42. The sum of the prediction loss and the reconstruction loss is taken as the total loss of model training.
[0086] Step S5: Perform model training, repeat steps S2-S4 and use stochastic gradient descent to perform back propagation and update the model network parameters.
[0087] Step S6: Use the trained model to perform anomaly judgment. First, calculate the anomaly score based on the value predicted by the prediction model in step S4 and the probability value reconstructed by the reconstruction model. The calculation steps are shown in step S61. Then, determine whether an anomaly occurs based on the anomaly score and the anomaly threshold.
[0088] In this embodiment, step S1 includes the following sub-steps:
[0089] Step S11: record the original logging data while drilling as ,in represents the set of real numbers, is the total length of the logging data while drilling, is the dimension of the logging data while drilling, that is, the number of features. First, the logging data while drilling is standardized. The standardization formula is as follows:
[0090]
[0091] in is the standardized value, is the original logging data while drilling. , They are used to calculate the minimum and maximum values of the entire original logging data while drilling.
[0092] Step S12: The standardized logging while drilling data is processed by The sliding window is divided into Load data with batch size and process to get batch data: ,in is the batch size of the data, is the size of the sliding window, is the number of characteristics of logging while drilling data.
[0093] Step S13: Using the sine function The batch data processed in step S12 is periodically encoded; wherein, The dimension is The sine function is applied to each logging data x in the matrix. Encode, the matrix dimension after encoding is .
[0094] In this embodiment, step S2 includes the following steps:
[0095] Step S21: Use the graph attention network (which can model the relationship between nodes in any graph) to extract the relationship between features, and record the data processed in step S13 as ,in The vector representing the i-th feature of the logging while drilling data is eigenvectors is considered as a complete graph (a complete graph is a simple undirected graph in which every pair of distinct vertices is connected by exactly one edge). nodes.
[0096] Step S211: In order to construct a complete graph, the data processed in step S13 is transposed. , and then perform a linear transformation Get the data to construct the complete graph.
[0097] Step S212: Calculate the edges of the complete graph, that is, the attention coefficient. First, construct the attention input:
[0098]
[0099] in Indicates connection, It contains the connections of all possible feature pairs, and then calculates the attention coefficient:
[0100]
[0101] in is the column vector of learnable parameters, is a non-linear activation function.
[0102] Step S213: Calculate the attention score, the calculation formula is as follows:
[0103]
[0104] in Nodes are measured For Node The attention score is yes The adjacent nodes of The number of features representing the logging while drilling data; represents the natural exponential function.
[0105] Step S214: Calculate the output of each node in the graph attention layer. The calculation formula is as follows:
[0106]
[0107] in Indicates The output of the feature vector has the same shape as the input feature vector, represents the number of characteristics of logging while drilling data, Indicates feature vectors, is a linear activation function.
[0108] Step S22: Use the selective state space model to extract context information of the data processed in step S13.
[0109] Step S221: linearly project the data processed in step S13 to increase the dimension so that the model can capture more detailed and complex features.
[0110] Step S222: The data obtained after processing in step S221 is subjected to a one-dimensional convolution with a convolution kernel size of 2, and delinearized using a σ linear activation function to achieve the purpose of extracting local features.
[0111] Step S223: Use the state space model to extract the context information of the data, and use the following formula for calculation:
[0112]
[0113]
[0114] in Indicates the logging data while drilling at time status, Indicates the last moment status, is the characteristic vector of the logging while drilling data at time t, , , , is the learnable parameter matrix.
[0115] The data result of the batch size calculated by the above formula is .
[0116] Step S224: Finally, linear projection is used to transform Project back to the input dimension.
[0117] Step S23: combining the relationship between the logging while drilling data features extracted in step S21 with the context information extracted in step S22.
[0118] In this embodiment, step S3 includes the following steps:
[0119] Step S31: Use the gated recurrent unit to extract the long-term dependency of the logging while drilling data. First, calculate the information in the memory (the information extracted at the previous moment) needed at the current moment. The calculation formula is as follows:
[0120]
[0121] in Indicates the logging data while drilling at the current time The memory you need, is the learnable parameter matrix, For the memory of the last moment, is the feature vector of the logging while drilling data at the current time t.
[0122] Step S32: Calculate the current time The available memory is calculated as follows:
[0123]
[0124] in is the learnable parameter matrix.
[0125] Step S33: By current time The output is used to update the memory. The calculation formula is as follows:
[0126]
[0127] in is the learnable parameter matrix.
[0128] Step S34: Finally, the last moment Memories and the present moment The output of is weighted summed to get the current moment The memory is the long-term dependent information of the extracted logging while drilling data. The calculation formula is as follows:
[0129]
[0130] In this embodiment, step S4 includes the following steps:
[0131] Step S41: After using the gated recurrent unit to calculate the long-term dependency of the logging data while drilling, a fully connected layer network with three hidden dimensions of 2 is used as a prediction-based model, and the root mean square error is used as the loss function, which is defined as follows:
[0132]
[0133] in, Indicates the current input The next timestamp of Indicates Middle The value of the feature, represents the value of the i-th feature predicted by the prediction model;
[0134] Step S42: After using the gated recurrent unit to calculate the long-term dependency of the logging data while drilling, the variational autoencoder is used as the reconstruction-based model to define the data processed in step S3 as , assuming that from a conditional distribution ) reconstruction, where is a vector representation of the latent space. The optimization goal is to find the data distribution that is closest to the reconstruction The best model parameters. The true posterior density is as follows:
[0135]
[0136] The edge density is expressed as:
[0137]
[0138] By introducing a recognition model To approximate the posterior distribution. Given the recognition model (encoder) and the generative model (decoder) , the loss function calculation formula based on reconstruction is as follows:
[0139]
[0140] For a given observation In the case of The posterior distribution of ; For a given latent variable In the case of data The conditional distribution of is a latent variable The prior distribution of is the marginal likelihood of the data; and are the parameters learned through the network; is the expected negative log-likelihood of the given data, It is an encoder and The Kulbeck-Leibshaller degree.
[0141] In this embodiment, step S5 includes the following sub-steps:
[0142] Step S51: The sum of the prediction-based loss and the reconstruction-based loss calculated in step S4 is taken as the total loss of model training:
[0143]
[0144] Step S52: Use (An optimization algorithm that combines momentum and adaptive learning rate) algorithm, each time loading the batch size window data, repeating S2-S4 steps, updating the model parameters to minimize the total loss.
[0145] In this embodiment, step S6 includes the following steps:
[0146] Step S61: Anomaly score based on timestamp. For each timestamp, there are two inference results, one is the predicted value obtained based on the prediction model. , and the other is the reconstruction probability obtained based on the reconstruction model ,in is the number of features of the LWD data. Anomaly scores are calculated for each feature. , and the sum of the anomaly scores of all features is taken as the final anomaly score of the timestamp. The calculation formula is as follows:
[0147]
[0148] in is the predicted value With actual value The square error indicates the degree to which the actual value deviates from the predicted value; is the probability of encountering an outlier in the reconstructed model. It is a hyperparameter and is generally set between 0.4 and 1.0.
[0149] Step S62: Perform timestamp abnormality judgment, recorded as , the anomaly score calculated in step S61 is compared with the anomaly threshold For comparison, the anomaly score is greater than Indicates anomaly, recorded as 1, and the anomaly score is less than Indicates normal, recorded as 0, details are as follows:
[0150] .
[0151] This scheme adopts a drilling abnormal event detection method based on periodic coding, uses a sine function to periodically encode the while drilling logging data, and uses a selective state space model to extract the context information of the while drilling logging data, so that the model can better detect abnormal data.
[0152] The present invention has shown and described the basic principles and main features of the present invention and the advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A drilling abnormal event detection method based on periodic coding, characterized in that: The following steps are involved: Step S1: Processing the logging while drilling data, using a sliding window to divide the data, defining the data divided from all the logging while drilling data as window data, and loading the data in units of batch-sized window data, and periodically encoding the batch-sized window data using a sinusoidal function change; Step S2: Use the graph attention network model to extract the relationship between the window data features with periodic encoding, and use the selective state space model to extract the context information of the window data with periodic encoding, and combine the information extracted by the two models; Step S3: Using a gated recurrent unit to extract long-term dependencies of the data obtained in step S2; Step S4: Use three fully connected layer neural networks to predict the data obtained in step S3, and use the root mean square error loss function to calculate the error between the original window data and the predicted data, which is defined as the prediction loss; at the same time, use the variational autoencoder to reconstruct the data obtained in S3 and calculate the reconstruction loss; the sum of the prediction loss and the reconstruction loss is taken as the total loss of model training; Step S5: Perform model training, repeat steps S2 to S4 and use stochastic gradient descent to perform back propagation and update model network parameters; Step S6: After the training is completed, the trained model is used to perform anomaly judgment, and the anomaly score is calculated according to the predicted value in step S4 and the reconstructed probability value. Whether an anomaly occurs is judged according to the anomaly score and the preset anomaly threshold.
2. The method for detecting abnormal drilling events based on periodic coding according to claim 1, characterized in that: The step S1 specifically includes the following sub-steps: Step S11: Record the entire original logging while drilling data as ,in represents the set of real numbers, is the total length of the logging data while drilling, is the dimension of the logging while drilling data, that is, the number of features; the original logging while drilling data is standardized, and the formula is as follows: ; in, is the value after standardization, For logging while drilling data, , Respectively represent the minimum and maximum values of the entire original logging while drilling data; Step S12: The standardized logging while drilling data is processed by The sliding window is divided into Load data with batch size and process to get batch data: ,in is the batch size of the data, is the size of the sliding window, is the number of characteristics of logging while drilling data; Step S13: Using the sine function The batch data processed in step S12 is periodically encoded; wherein, The dimension is The sine function is applied to each logging data x in the matrix. Encode, the matrix dimension after encoding is .
3. The method for detecting abnormal drilling events based on periodic coding according to claim 2, characterized in that: The step S2 specifically includes the following sub-steps: Step S21: Use the graph attention network to extract the relationship between the features of the logging while drilling data, and record the data processed in step S13 as: ,in, The vector representing the i-th feature of the logging while drilling data is The eigenvectors are considered as a complete graph. nodes; Step S22: Extract the data processed in step S13 using the selective state space model context information; Step S23: combining the relationship between the logging while drilling data features extracted in step S21 with the context information extracted in step S22.
4. The method for detecting abnormal drilling events based on periodic coding according to claim 3, characterized in that: The step S21 further comprises the following sub-steps: Step S211: perform a transposition operation on the data processed in step S13. , and then perform a linear transformation Get the data to construct the complete graph; Step S212: Calculate the edges of the complete graph, i.e. the attention coefficient. First, construct the attention input : ; in, represents the complete graph data obtained in step S211 The data of the nodes, Indicates The data of the nodes, Indicates connection, contains the connections of all feature pairs; Then calculate the attention coefficient , the calculation formula is: ; in, is the column vector of learnable parameters, is a nonlinear activation function, represents the calculated attention input, which contains the connection of all feature pairs; Step S213: Calculate the attention score , the calculation formula is: ; in, Nodes are measured For Node The attention score, yes The adjacent nodes of The number of features representing the logging while drilling data; represents the natural exponential function; Step S214: Calculate the output of each node in the graph attention layer. The calculation formula is: ; in, Indicates The output of the feature vector has the same shape as the input feature vector, represents the number of characteristics of logging while drilling data, Indicates feature vectors, is a linear activation function.
5. The method for detecting abnormal drilling events based on periodic coding according to claim 4, characterized in that: The step S22 further comprises the following sub-steps: Step S221: The data processed in step S13 After linear projection, the dimension is increased; Step S222: The data obtained after the linear projection processing in step S221 is subjected to a one-dimensional convolution with a convolution kernel size of 2, and Linear activation function delinearizes and extracts local features; Step S223: extracting context information of the data using the state space model, using the following calculation formula: ; ; in, Indicates the logging data while drilling at time status, Indicates the last moment status, Logging while drilling data The feature vector at time, Represents the state space model extracted Information at the moment, , , , is the learnable parameter matrix; all the information extracted at the time of batch size data is recorded as ; Step S224: Use linear projection to transform the data results Project back to the input dimension.
6. A drilling abnormal event detection method based on periodic coding according to claim 5, characterized in that: The step S3 specifically includes the following sub-steps: Step S31: Use the gated recurrent unit to extract the long-term dependency of the logging data while drilling. First, calculate the information in the memory that needs to be used at the current moment. The calculation formula is: ; in, Indicates the logging data while drilling at the current time The memory you need, is the learnable parameter matrix, For the memory of the last moment, The logging data while drilling at the current time The eigenvector of Step S32: Calculate the memory available at the current time t , the calculation formula is: ; in, is the learnable parameter matrix; Step S33: By current time The output of updates the memory, and the calculation formula is: ; in, For updated memory, is the learnable parameter matrix; Step S34: The last moment Memory and the present moment The output of is weighted summed to obtain the memory of the current time t, and the long-term dependency information of the logging data while drilling is extracted. The calculation formula is: 。 7. A method for detecting abnormal drilling events based on periodic coding according to claim 6, characterized in that: The step S4 specifically includes the following sub-steps: Step S41: After using the gated recurrent unit to calculate the long-term dependency of the logging data while drilling, a fully connected layer network with three hidden dimensions of 2 is used as a prediction-based model, and the root mean square error is used as the loss function to obtain the prediction-based loss function The calculation formula is: ; in, Indicates the current input The next timestamp of Indicates Middle The value of the feature, represents the value of the i-th feature predicted by the prediction model; Step S42: After using the gated recurrent unit to calculate the long-term dependency of the logging while drilling data, the variational autoencoder is used as the reconstruction-based model to define the logging while drilling data processed by step S3 as ; From a conditional distribution Reconstruction, where is the vector representation of the latent space, represents the set of real numbers, that is, the set of all real numbers, express dimensional real vector space, is the dimension of the logging data while drilling after processing in step S3; find the data distribution closest to the reconstruction The optimal model parameters, the true posterior density is expressed as: ; The edge density is expressed as: ; Introducing a recognition model Approximate posterior distribution, given the recognition model and generative models , based on the reconstruction loss function The calculation formula is: ; in, For a given observation In the case of The posterior distribution of For a given latent variable In the case of data The conditional distribution of is a latent variable The prior distribution of is the marginal likelihood of the data; and are the parameters learned through the network; is the expected negative log-likelihood of the given data, It is an encoder and The Kulbeck-Leibshaller degree.
8. The method for detecting abnormal drilling events based on periodic coding according to claim 7, characterized in that: The step S5 specifically includes the following sub-steps: Step S51: The prediction-based loss calculated in step S4 and reconstruction-based loss The sum is taken as the total loss of model training, expressed as: ; Step S52: Using momentum and adaptive learning rate The algorithm repeats steps S2 to S4 for each batch size of window data loaded, and updates the model parameters to minimize the total loss.
9. A method for detecting abnormal drilling events based on periodic coding according to claim 8, characterized in that: The step S6 specifically includes the following sub-steps: Step S61: Based on the anomaly score of the timestamp, two inference results are obtained for each timestamp, one of which is the predicted value obtained based on the prediction model. , and the other is the reconstruction probability obtained based on the reconstruction model , is the number of features of the logging data while drilling; the anomaly score is calculated for each feature, and the sum of the anomaly scores of all features is taken as the final anomaly score of the timestamp; the final anomaly score calculation formula is: ; in, Indicates The anomaly score of the feature, is the predicted value With actual value The square error indicates the degree to which the actual value deviates from the predicted value; The probability of encountering an outlier for the reconstruction model; is a hyperparameter, set between 0.4 and 1.0; Step S62: Perform a timestamp abnormality judgment, and record the judgment result as , the final anomaly score calculated in step S61 is compared with the anomaly threshold Compare, if the anomaly score is greater than It indicates an abnormality, which is recorded as 1; if the abnormal score is less than It means normal, recorded as 0; specifically expressed as: 。
Citation Information
Patent Citations
Time sequence anomaly detection method and system based on hypergraph attention network
CN117290800A
Well log correlation system
WO2023081113A1
