Well drilling accident early warning method and device, electronic equipment and storage medium
Through the drilling accident early warning method based on neural network, the genetic algorithm is used to optimize network parameters, and the dual-track verification is carried out in combination with the test set and the verification set, the problems of manual judgment of subjective bias and low efficiency in the existing technology are solved, and efficient and accurate drilling is achieved Accident warning.
Patent Information
- Application Number
- CN202410973973.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-19
AI Technical Summary
In the prior art, drilling accident warnings are highly dependent on manual judgments, and there are subjective biases and low efficiency problems, making it difficult to meet timeliness and large-scale applications.
A drilling accident warning method based on neural network is adopted, and the neural network and population are initialized by obtaining the annotated drilling data, and the network parameters are optimized using genetic algorithms, and a dual-track verification is combined with the test set and the verification set to improve prediction accuracy and applicability.
It significantly enhances the intelligence level of drilling accident warning, improves the accuracy and efficiency of early warning, and can conduct multi-source drilling accident warnings efficiently and accurately.
Smart Images

Figure CN118981637A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a drilling accident early warning method, device, electronic equipment and storage medium. Background Art
[0002] In the existing technology, the prediction of drilling accidents such as lost circulation, well kick, and blowout is highly dependent on the subjective judgment of technicians based on real-time sensor data, which requires technicians to have profound practical experience. However, manual judgment is inevitably affected by subjective bias and has limitations. Summary of the invention
[0003] The present invention aims to solve the problem of related technical limitations at least to a certain extent. To this end, the present invention proposes a drilling accident early warning method, device, electronic device and storage medium, which can efficiently and accurately perform multi-source drilling accident early warning.
[0004] On the one hand, an embodiment of the present invention provides a drilling accident early warning method, comprising:
[0005] Obtain drilling data with marked drilling accident types, and obtain a test set and a validation set based on the drilling data;
[0006] Initialize the network topology of the initial neural network; use the initial neural network as the first neural network;
[0007] Initializing an initial population; using the initial population as a first population; the first population includes a first number of individuals, each of which includes a first network parameter corresponding to a network topology structure of a first neural network, and the first network parameter is obtained based on binary coding;
[0008] Initializing the network parameters of the first neural network based on the individuals in the first population, and then obtaining the first prediction accuracy corresponding to each individual through test set processing;
[0009] All individuals in the first population are sorted based on the first prediction accuracy to obtain a second population; the second population is genetically processed to obtain a third population; the number of iterations is increased by 1; wherein the number of iterations is initially 0;
[0010] When the number of iterations reaches the iteration threshold, the target individual is determined based on the third population obtained from the last iteration; otherwise, the third population is used as the first population, and then the step of initializing the network parameters of the first neural network based on the individuals in the first population is returned to execute;
[0011] Initializing the network parameters of the first neural network based on the target individual, and then obtaining the second prediction accuracy of the target individual through processing of the validation set;
[0012] When the second prediction accuracy meets the accuracy requirement, the first neural network with network parameters initialized according to the target individual is used as the target neural network; otherwise, the network topology of the first neural network is optimized and adjusted to obtain the second neural network, the number of iterations is reset to 0, the second neural network is used as the first neural network, and then the step of initializing the initial population is returned to execute;
[0013] The target neural network is used to predict drilling accidents based on the drilling data to be predicted, and early warning processing is performed based on the results of the drilling accident prediction.
[0014] Optionally, initializing the initial population includes the following steps:
[0015] Initialize all initial network parameters corresponding to the network topology of the first neural network based on the random numbers in the first interval;
[0016] Binary-encode the initial network parameters to obtain first network parameters;
[0017] Individuals are obtained according to all the first network parameters, and the step of initializing all the initial network parameters corresponding to the network topology structure of the first neural network based on the random numbers in the first interval is returned to execute until a first number of individuals are obtained, and an initial population is obtained according to the first number of individuals.
[0018] Optionally, initializing the network parameters of the first neural network based on individuals in the first population comprises the following steps:
[0019] Binary decoding is performed on first network parameters included in all genes of individuals of the first population to obtain second network parameters represented in decimal form;
[0020] The second network parameters are applied to the first neural network, and a first neural network corresponding to initialization of network parameters for each individual in the first population is obtained.
[0021] Optionally, obtaining the first prediction accuracy corresponding to each individual by processing the test set includes the following steps:
[0022] Traversing each drilling data in the test set, inputting the first neural network corresponding to the individuals in the first population after initializing the network parameters, and obtaining the output prediction result;
[0023] Compare the prediction results with the drilling accident types marked corresponding to the input drilling data to obtain a second number of drilling data in the test set with consistent prediction results;
[0024] The first prediction accuracy of the first neural network corresponding to the individual after the network parameters are initialized is obtained according to the ratio of the second number to the total number of data in the test set.
[0025] Optionally, the second population is subjected to a genetic treatment comprising the following steps:
[0026] The individuals of the second population are subjected to selection treatment;
[0027] The selection process includes the following steps:
[0028] The third number of individuals in the second population with the highest first prediction accuracy are selected as the first choice;
[0029] A fourth number of individuals are randomly obtained from the second population as the second choice;
[0030] as a result of the selection process according to the first and second selections;
[0031] The sum of the third number and the fourth number is not greater than the first number.
[0032] Optionally, performing genetic treatment on the second population further comprises the following steps:
[0033] All individuals included in the result of the selection process are sorted based on the first prediction accuracy to obtain a fourth population;
[0034] Performing a gene crossover operation on the individuals traversed in the forward order and the individuals traversed in the reverse order at the corresponding positions in the fourth population; and / or,
[0035] Perform gene mutation operation on all individuals in the fourth population.
[0036] Optionally, the first neural network includes an input layer, a hidden layer, and an output layer; optimizing and adjusting the network topology structure of the first neural network includes the following steps:
[0037] The number of hidden layers is increased and adjusted based on an integer random value within a second interval.
[0038] On the other hand, an embodiment of the present invention provides a drilling accident warning device, comprising:
[0039] The first module is used to obtain drilling data marked with drilling accident types, and to obtain a test set and a validation set based on the drilling data;
[0040] The second module is used to initialize the network topology structure of the initial neural network; the initial neural network is used as the first neural network;
[0041] The third module is used to initialize the initial population; the initial population is used as the first population; the first population includes a first number of individuals, the individuals include first network parameters corresponding to the network topology structure of the first neural network, and the first network parameters are obtained based on binary coding;
[0042] A fourth module is used to initialize the network parameters of the first neural network based on the individuals in the first population, and then obtain the first prediction accuracy corresponding to each individual through test set processing;
[0043] The fifth module is used to sort all individuals in the first population based on the first prediction accuracy to obtain a second population; perform genetic processing on the second population to obtain a third population; and increase the number of iterations by 1; wherein the number of iterations is initially 0;
[0044] The sixth module is used to determine the target individual according to the third population obtained in the last iteration when the number of iterations reaches the iteration threshold; otherwise, the third population is used as the first population, and then the fourth module is returned to execute;
[0045] The seventh module is used to initialize the network parameters of the first neural network based on the target individual, and then obtain the second prediction accuracy of the target individual through verification set processing;
[0046] The eighth module is used to use the first neural network with network parameters initialized according to the target individual as the target neural network when the second prediction accuracy meets the accuracy requirement; otherwise, optimize and adjust the network topology of the first neural network to obtain the second neural network, reset the number of iterations to 0, use the second neural network as the first neural network, and then return to execute the third module;
[0047] The ninth module is used to predict drilling accidents based on the drilling data to be predicted through the target neural network, and to perform early warning processing based on the results of the drilling accident prediction.
[0048] On the other hand, an embodiment of the present invention provides an electronic device, including: a processor and a memory; the memory is used to store programs; the processor executes the program to implement the above-mentioned drilling accident warning method.
[0049] On the other hand, an embodiment of the present invention provides a computer storage medium, in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to implement the above-mentioned drilling accident warning method.
[0050] The embodiment of the present invention obtains drilling data marked with drilling accident types, and obtains a test set and a verification set based on the drilling data; initializes the network topology of an initial neural network; uses the initial neural network as a first neural network; initializes an initial population; uses the initial population as a first population; the first population includes a first number of individuals, and the individuals include first network parameters corresponding to the network topology of the first neural network, and the first network parameters are obtained based on binary coding; initializes the network parameters of the first neural network based on the individuals in the first population, and then obtains a first prediction accuracy corresponding to each individual through test set processing; sorts all individuals in the first population based on the first prediction accuracy to obtain a second population; performs genetic processing on the second population to obtain a third population; increases the number of iterations by 1; wherein the number of iterations is initially 0; when the number of iterations reaches When the iteration threshold is reached, the target individual is determined according to the third population obtained from the last iteration; otherwise, the third population is used as the first population, and then the step of initializing the network parameters of the first neural network based on the individuals in the first population is returned; the network parameters of the first neural network are initialized based on the target individual, and then the second prediction accuracy of the target individual is obtained through the verification set processing; when the second prediction accuracy meets the accuracy requirement, the first neural network with the network parameters initialized according to the target individual is used as the target neural network; otherwise, the network topology of the first neural network is optimized and adjusted to obtain the second neural network, the number of iterations is reset to 0, the second neural network is used as the first neural network, and then the step of initializing the initial population is returned; drilling accidents are predicted according to the drilling data to be predicted through the target neural network, and early warning processing is performed according to the results of the drilling accident prediction. The embodiment of the present invention proposes a drilling accident prediction method based on a neural network, which relies on the neural network to significantly enhance the intelligence level of accident early warning; and by combining binary coding and genetic iteration to find the optimal network parameters, binary coding can assist in improving the efficiency of genetic processing, and genetic iteration can effectively improve the prediction accuracy of the neural network; at the same time, the embodiment of the present invention proposes a dual-track verification process of the test set and the verification set, which strengthens the support for multi-dimensional expansion of input data and ensures the applicability and generalization ability of the neural network model. The embodiments of the present invention can provide drilling accident warnings efficiently and accurately. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation to the technical solution of the present invention.
[0052] Figure 1 A schematic diagram of the structural topology of a BP neural network provided in an embodiment of the present invention;
[0053] Figure 2A schematic diagram of an implementation environment for drilling accident early warning provided by an embodiment of the present invention;
[0054] Figure 3 A schematic diagram of a process flow of a drilling accident early warning method provided by an embodiment of the present invention;
[0055] Figure 4 A schematic diagram of the expansion process of initializing an initial population provided by an embodiment of the present invention;
[0056] Figure 5 A schematic diagram of an expanded process of initializing network parameters of a first neural network based on individuals in a first population provided by an embodiment of the present invention;
[0057] Figure 6 A schematic diagram of an expanded flow chart of a process for obtaining a first prediction accuracy rate provided by an embodiment of the present invention;
[0058] Figure 7 A schematic diagram of the expansion flow of the selection process provided by an embodiment of the present invention;
[0059] Figure 8 A schematic diagram of the overall flow of network parameter optimization of a neural network applied to a drilling accident early warning provided by an embodiment of the present invention;
[0060] Fig. 9 A structural schematic diagram of a drilling accident warning device provided by an embodiment of the present invention;
[0061] Fig.10 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0063] It should be noted that, although the functional modules are divided in the system schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first / S100", "second / S200", etc. in the specification, claims and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0064] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0065] It is understandable that the drilling accident warning method provided in the embodiment of the present invention can be applied to any computer device with data processing and computing capabilities, and this computer device can be various terminals or servers. When the computer device in the embodiment is a server, the server is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the terminal is a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., but is not limited to this.
[0066] To facilitate the understanding of the technical solution of the present invention, the specific terms of the technical features that may appear in the embodiments of the present invention are first explained:
[0067] Genetic Algorithm (GA) is a computational model that simulates the biological evolution process, using mechanisms such as natural selection and gene recombination to search and optimize complex problems. It is a heuristic search algorithm, and its basic idea is to create a group of artificial individuals for optimization and solution by simulating the mechanisms of natural inheritance and evolution. In a genetic algorithm, each individual represents a potential solution, and each individual has its own fitness evaluation criteria. By selecting, crossing over, and mutating these individuals, the adaptability of the current population is gradually improved and the potential solution space is explored in order to find the optimal solution. Genetic algorithms have the characteristics of a wide range of applications, strong global search, and easy parallel computing. They are suitable for optimizing and solving various types of problems, including combinatorial optimization, continuous optimization, and multi-objective optimization. Compared with other algorithms, genetic algorithms can efficiently search for the global optimal solution and are widely used in various fields, including but not limited to engineering optimization design, artificial intelligence tasks, financial analysis and prediction, etc.
[0068] Binary encoding: Binary numbers are numbers expressed in the binary number system, which is a number system with a base of 2. In this system, numbers are usually represented by two different symbols, 0 (for zero) and 1 (for one). The base 2 representation system is binary. In digital electronic circuits, the implementation of logic gates directly uses binary, so modern computers and computer-dependent devices use binary. Each digit is called a bit (binary digit).
[0069] BP (back propagation) neural network is a multi-layer feedforward neural network trained according to the error back propagation algorithm. It is one of the most widely used neural network models. The process of BP neural network is mainly divided into two stages. The first stage is the forward propagation of the signal, from the input layer through the hidden layer, and finally to the output layer; the second stage is the back propagation of the error, from the output layer to the hidden layer, and finally to the input layer, and the weights and biases from the hidden layer to the output layer, and the weights and biases from the input layer to the hidden layer are adjusted in turn.
[0070] refer to Figure 1 , the following focuses on the input layer, hidden layer and output layer of the BP neural network. Input layer: data input of the BP neural network. The number of input layers depends on the number of input variables. Hidden layer: maps the data x from the input layer. Simply put, refer to the formula HiddenLayerOutput=F(w*x+b), where w and b are called weight and threshold parameters, and F() is the mapping rule, also called the activation function. In other words, the hidden layer maps the input influencing factor data x and generates a mapping value. There can be multiple hidden layers, and the number of neural networks in each hidden layer can also be customized. Output layer: the result output of the BP neural network. The number of output layers depends on the number of output variables. Simply put, refer to the formula OutputLayerOutput=w*HiddenLayerOutput+b, where w and b are weight and threshold parameters. Gradient descent algorithm: by calculating the deviation between the output result and the y value passed in by the neural network model, the algorithm is used to adjust the parameters such as weights and thresholds accordingly.
[0071] In the oil and gas extraction industry, well leakage, well kick and well blowout are three serious accidents related to drilling operations. They all involve the abnormal flow of underground fluids (such as water, oil and gas) during the drilling process, but each has its own characteristics and dangers.
[0072] Lost circulation: refers to the accidental inflow of drilling fluid (also known as mud) into the formation during the drilling process, usually due to the high permeability of the formation or improper drilling pressure control, which leads to the loss of drilling fluid. Lost circulation may lead to a reduction in the amount of drilling fluid, affecting the cooling and cleaning capabilities of the wellbore, and may also expose the wellbore wall and increase the risk of collapse. In severe cases, lost circulation will hinder further drilling, and even require special measures to plug the lost layer.
[0073] Well kick: refers to underground fluid (mainly natural gas or liquid) entering the wellbore at a rate exceeding the normal circulation rate, but has not yet reached the surface. Well kicks are usually caused by the formation pressure being greater than the pressure in the wellbore, or the drilling fluid column pressure being insufficient to balance the formation pressure. If well kicks are not controlled in time, they will quickly develop into a more serious blowout. Well kicks are emergency situations and require immediate measures such as adding weight to the drilling fluid, shutting down the blowout preventer, etc. to re-establish the pressure balance in the wellbore.
[0074] Blowout: One of the most serious accidents, when it occurs, underground high-pressure fluid (oil, gas, water or other mixtures) rushes out of the wellhead in an uncontrollable manner and reaches the ground or sea surface. Blowouts not only lead to huge resource losses, but may also cause catastrophic consequences such as fire, explosion, and environmental pollution, seriously threatening personnel safety and the environment. Blowouts usually require the emergency activation of emergency plans, including the use of special well control equipment (such as blowout preventers), injection of heavy drilling fluid or cement plugs, etc. to seal the well.
[0075] K-fold cross-validation is a commonly used technique for evaluating the performance of machine learning models. The specific operation process is as follows: First, the entire dataset is evenly divided into K non-overlapping subsets (or "folds"), and each subset keeps the data distribution as consistent as possible to ensure that the proportion of samples in each category in each subset is similar. Next, K rounds of training and validation are performed. In each round: one subset is selected as the validation set, and the remaining K-1 subsets are combined as the test set. Repeating this for K rounds will result in K performance evaluation scores, and the average of these scores is usually taken as the final model evaluation indicator. The advantage of K-fold cross-validation is that it can better utilize all data for training and testing, providing valuable information about the stability and reliability of the model, while helping to avoid overfitting during model selection and parameter adjustment.
[0076] like Figure 2 FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the invention. Figure 2 The implementation environment includes at least one terminal 102 and a server 101. The terminal 102 and the server 101 can be connected to a network wirelessly or wired to complete data transmission and exchange.
[0077] Server 101 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0078] In addition, the server 101 can also be a node server in the blockchain network. Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm.
[0079] The terminal 102 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal 102 and the server 101 may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiment of the present invention.
[0080] Based on the example Figure 2 In the implementation environment shown, an embodiment of the present invention provides a drilling accident warning method. The following is explained by taking the application of the drilling accident warning method in the server 101 as an example. It can be understood that the drilling accident warning method can also be applied to the terminal 102.
[0081] Reference Figure 3 , Figure 3 The flowchart of the drilling accident early warning method applied to the server provided in the embodiment of the present invention, the execution subject of the drilling accident early warning method can be any of the aforementioned computer devices (including servers or terminals).
[0082] Reference Figure 3 , the method comprises the following steps:
[0083] S100, obtaining drilling data marked with drilling accident types, and obtaining a test set and a validation set based on the drilling data;
[0084] For example, in some specific implementations, obtaining the test set and the validation set may be implemented as follows:
[0085] The drilling data used in the present invention mainly comes from public data at home and abroad, and multiple sets of data records collected from daily drilling reports, daily mud reports, completion reports and other materials. Some data show that drilling accidents occur during the drilling process, and some data show that the drilling process is normal. Each set of data includes multiple characteristics such as lithology, pore size, porosity, pore pressure, fracture pressure, shear stress, gel strength, pump pressure, drill bit speed, primary fracture direction, cement slurry density, drilling fluid density, inlet flow, outlet flow, pump displacement, and whether the three abnormal situations of drilling leakage, well kick, and blowout have occurred in this set of data (i.e., the drilling accident type, the marked drilling accident type where the corresponding abnormal situation has occurred is the corresponding accident type, and the marked drilling accident type where none of them has occurred is normal).
[0086] Among them, in some preferred implementations, the present invention can use the idea of K-fold cross validation to split the test set and the validation set, where K can be customized and is generally about 5 to 10, and the value of K is evaluated according to the actual amount of data collected. First, K groups are obtained through K-fold cross validation, and generally VerifySize groups (VerifySize can be customized, generally 2) are randomly selected as the validation set, and the other K-VerifySize groups are used as the test set.
[0087] S200, initializing the network topology structure of the initial neural network; using the initial neural network as the first neural network;
[0088] Exemplarily, in some specific implementations, the neural network may adopt a BP neural network; Exemplarily, the BP neural network topology may be determined as:
[0089] For each set of drilling data, the data features are 15 features, including lithology, pore size, porosity, pore pressure, fracture pressure, shear stress, gel strength, pump pressure, drill bit speed, primary fracture direction, cement slurry density, drilling fluid density, inlet flow, outlet flow, pump displacement, etc., that is, there are 15 input variables and 1 output variable (type 0 means normal, type 1 means well leakage, type 2 means well kick, type 3 means well kick, type 0 means other situations). That is, the BP neural network has 15 input layers and 1 output layer.
[0090] The present invention can use a three-layer BP neural network, the activation function is a Sigmoid function, and there is an approximate relationship between the number of hidden layer neural networks n2 and the number of input layer neurons n1, refer to the following formula:
[0091] n2=2*n1+1;
[0092] Therefore, when the BP neural network topology has 15 input layers, 31 hidden layers and 1 output layer, the weight parameter w to be optimized can be determined as 15*31+31*1=496 (i.e. (n1+1)*n2), and the threshold parameter b to be optimized can be determined as 31+1=32 (i.e. n2+1), that is, the optimization variables searched by the genetic algorithm are 496+32=528 in total (i.e. (n1+2)*n2).
[0093] S300, initializing an initial population; using the initial population as the first population;
[0094] The first population includes a first number of individuals, each of which includes a first network parameter corresponding to a network topology structure of a first neural network, and the first network parameter is obtained based on binary coding;
[0095] It should be noted that in some embodiments, Figure 4 As shown, initializing the initial population may include the following steps: S301, initializing all initial network parameters corresponding to the network topology structure of the first neural network based on random numbers in a first interval; S302, binary encoding the initial network parameters to obtain first network parameters; S303, obtaining individuals according to all the first network parameters, returning to execute the step of initializing all initial network parameters corresponding to the network topology structure of the first neural network based on random numbers in the first interval, until a first number of individuals are obtained, and obtaining the initial population according to the first number of individuals.
[0096] Among them, the network parameters (including the first network parameters, the second network parameters and the network parameters of the neural network application) include weight parameters and threshold parameters.
[0097] For example, in some specific implementations, population initialization may be implemented as follows:
[0098] The population is composed of a large number of individuals, each of which has multiple genes, which represent the weight parameter w and threshold parameter b of the BP neural network. Assume that the current BP neural network topology is n input layers. 1 The number of hidden layers is n 2 The output layer is 1, so the weight parameter w to be optimized is n in total. 1 *n 2 +n 2 *1, the threshold parameter b to be optimized is n in total 2 +1. Generally speaking, the weight w and threshold b are in the range of [-1,1], and can be flexibly adjusted according to actual conditions.
[0099] The core of population initialization is to generate sizePop (i.e., the first number) individuals (customizable, 50 by default), and initialize the corresponding genes for each individual. The present invention uses binary to represent gene encoding. The initialization gene first generates a decimal value, refer to the following formula, and then converts it into binary through encoding. Among them, random(0,1) represents a random number of [0,1].
[0100] w i =-1+(1-(-1))*random(0,1),1≤i≤n 1 *n 2 +n 2 *1;
[0101] b i =-1+(1-(-1))*random(0,1),1≤i≤n 2 +1;
[0102]
[0103] Now we have obtained individuals represented by decimal coded real numbers, which need to be converted into individuals represented by binary codes. The present invention uses a relative coding processing method, which is as follows:
[0104] Decimal to binary encoding process: Regardless of weight w or threshold b, the search interval of each gene is [-1,1], and the binary encoding length is encodeLen, that is, encodeLen bits are needed to represent [-1,1]. encodeLen can be customized. According to experience, encodeLen=20 is sufficient, which performs well between data accuracy and computing performance. Refer to formula (1) for binary encoding accuracy. If there is a decimal gene, the binary encoding can be calculated by formula (2). The ToBinary() function converts a decimal integer into binary.
[0105]
[0106] In general, the population initialization process is as follows: traverse each gene of each individual, randomly obtain the initialization value, and then determine the final gene expression form through binary coding. Here is an explanation of the reason for using binary coding, because the BP neural network has many parameters and a huge search space, and binary coding can easily achieve better population evolution through mutation operations, thereby obtaining the optimal value.
[0107] S400, initializing network parameters of a first neural network based on individuals in a first population, and then obtaining a first prediction accuracy corresponding to each individual through test set processing;
[0108] It should be noted that in some embodiments, Figure 5 As shown, initializing the network parameters of the first neural network based on the individuals in the first population may include the following steps: S401, binary decoding of the first network parameters included in all genes of the individuals in the first population to obtain second network parameters expressed in decimal; S402, applying the second network parameters to the first neural network to obtain the first neural network corresponding to the network parameter initialization based on each individual in the first population.
[0109] For example, in some specific implementations, the parameters are first obtained by binary decoding, which can be implemented as follows:
[0110] Now we have a new population. Since all the genes of each individual in the population are binary encoded and need to be decoded before they can be used in the BP neural network, this step is to traverse each gene of each individual, perform binary decoding one by one, and finally obtain the individual represented in decimal.
[0111] Then, the BP neural network parameters are initialized based on the obtained decimal representation of the individuals, so as to face the test set data, and the drilling accident prediction BP neural network model is ready.
[0112] Binary to decimal decoding process: With the encoding process, the decoding process is the opposite of the calculation process. If there is a binary GeneBinary, the binary decoding can be obtained by calculating formula (3). The ToDecimal() function converts a binary integer into a decimal system.
[0113] GeneDecimal=-1+ToDecimal(GeneBinary)*GeneAccuracy (3)
[0114] In some embodiments, such as Figure 6 As shown, obtaining the first prediction accuracy corresponding to each individual by processing the test set may include the following steps: S403, traversing each drilling data in the test set, inputting the first neural network corresponding to the individual based on the first population after initializing the network parameters, and obtaining the output prediction result; S404, comparing the prediction result with the drilling accident type marked corresponding to the input drilling data, and obtaining the second number of drilling data with consistent prediction results in the test set; S405, obtaining the first prediction accuracy of the first neural network corresponding to the individual after initializing the network parameters according to the ratio of the second number to the total number of data in the test set.
[0115] For example, in some specific implementations, the prediction accuracy rate can be calculated based on the BP neural network as follows:
[0116] Each individual in the population represents the BP neural network weight w and threshold b, that is, each individual represents a BP neural network. Based on each individual, each array of the test set is traversed, input into the BP neural network model, and the prediction result is obtained, which is then compared with the actual result. The present invention uses the prediction accuracy Precision as the fitness function for evaluation. Precision is between [0,1]. The larger the score, the better the model performance. The calculation formula is as follows:
[0117]
[0118] Among them, TrueSize indicates the number of correct predictions. TestSetSize indicates the number of test set data.
[0119] At the same time, you can also record the best individual at the moment:
[0120]
[0121] S500, sorting all individuals in the first population based on the first prediction accuracy to obtain a second population; performing genetic processing on the second population to obtain a third population; and increasing the number of iterations by 1;
[0122] Among them, the number of iterations is initially 0;
[0123] It should be noted that, in some embodiments, performing genetic processing on the second population may include the following steps: performing selection processing on individuals of the second population; wherein, Figure 7 As shown, the selection process includes the following steps: S501, taking the third number of individuals with the highest first prediction accuracy in the second population as the first selection; S502, randomly obtaining the fourth number of individuals from the second population as the second selection; S503, taking the first selection and the second selection as the result of the selection process; wherein the sum of the third number and the fourth number is not greater than the first number.
[0124] When the number of individuals selected as a result of the selection process is less than the first number, the range of individuals in the population can be gradually optimized and narrowed down with better individuals having higher accuracy in a process of cyclic iteration.
[0125] Exemplarily, in some specific implementations, taking the selection number equal to the first number as an example, the selection operator can be applied to individuals based on probability, and the implementation can be as follows: the selection operator mainly selects better individuals based on probability. The larger the Precision, the better the individual, and the smaller the Precision, the worse the individual. The selection operator will select sizePop (i.e., the first number) individuals. The core idea of selection is to first sort all individuals from small to large according to the prediction accuracy Precision, and select SelectRate*sizePop according to SelectRate (which can be customized, with a value range of [0,1] and a default of 0.8), and the remaining (1-SelectRate)*sizePop individuals are randomly selected from the population. The advantage of doing this is that individuals with excellent performance will directly participate in the evolution of the population, while individuals with poor performance still have the opportunity to participate in the evolution of the population, which not only increases the probability of excellent genes being selected, but also ensures the diversity of genes.
[0126] Among them, in some embodiments, the genetic processing of the second population may also include the following steps: sorting all individuals contained in the results of the selection processing based on the first prediction accuracy to obtain a fourth population; performing a gene crossover operation on the individuals traversed in forward order and the individuals traversed in reverse order at corresponding positions in the fourth population; and / or performing a gene mutation operation on all individuals in the fourth population.
[0127] It should be understood that when both the gene crossover operation and the gene mutation operation are performed, the corresponding operations can be performed simultaneously, or one operation can be performed based on the result of another operation.
[0128] For example, in some specific implementations, applying the crossover operator to individuals based on probability can be implemented as follows: Now that sizePop individuals are obtained, all individuals are sorted from small to large according to the prediction accuracy Precision. Then, the individual with the largest Precision and the individual with the smallest Precision are crossovered, and the individual with the second largest Precision and the second smallest Precision are crossovered, and so on.
[0129] If two individuals 1 and Individual 2 Perform crossover and then traverse Individual 1 Each gene from Individual 2 A gene is randomly selected for crossover. Next, the and gene 2 Do crossover. Repeat this process to complete the random crossover of all genes. 1All genes will be from Individual 1 Randomly select genes for crossover:
[0130]
[0131] Applying mutation operators to individuals based on probability can be achieved as follows: Now we have sizePop individuals that have just undergone crossover operations, and the next step is mutation operations. Traverse each individual one by one, randomly select mutationGeneSize genes (can be customized, default is 10), for each gene, randomly select mutationBitSize (can be customized, default is 3) positions, and then perform mutation operations. Repeat this process to complete the gene mutation operations of all individuals.
[0132] It should be noted that in order to improve computational efficiency, the crossover operation and mutation operation can be performed in parallel.
[0133] S600, when the number of iterations reaches the iteration threshold, determine the target individual according to the third population obtained in the last iteration; otherwise, take the third population as the first population, and then return to the step of initializing the network parameters of the first neural network based on the individuals in the first population;
[0134] For example, in some specific implementations, these individuals have just undergone crossover and mutation operations, indicating that a population reproduction has been completed, and a new generation of populations has been obtained through the survival of the fittest. Among them, when there is only one individual left in the second population, the target individual can be directly determined, and when there is more than one individual in the second population, the individual with the highest accuracy (i.e., BestIndividual) can be determined as the target individual.
[0135] S700, initializing the network parameters of the first neural network based on the target individual, and then obtaining the second prediction accuracy of the target individual through verification set processing;
[0136] It should be noted that the principle logic of initializing the network parameters of the first neural network based on the target individual is the same as the principle logic of initializing the network parameters of the first neural network based on the individuals in the first population, which will not be repeated here.
[0137] For example, in some specific implementations, the optimal parameters (i.e., the target individual) are obtained, that is, the neural network weight w and the threshold b have been adjusted to the optimal value. For the validation set data, the drilling accident prediction BP neural network model is ready. At this point, the optimal drilling accident prediction BP neural network model has been obtained. Traverse each array group of the validation set, input it into the BP neural network model, obtain the prediction result, and then compare it with the actual result, and finally calculate the prediction accuracy Precisionverify .
[0138] S800, when the second prediction accuracy meets the accuracy requirement, the first neural network whose network parameters are initialized according to the target individual is used as the target neural network; otherwise, the network topology of the first neural network is optimized and adjusted to obtain the second neural network, the number of iterations is reset to 0, the second neural network is used as the first neural network, and then the step of initializing the initial population is returned to be executed;
[0139] It should be noted that, in some embodiments, the first neural network includes an input layer, a hidden layer and an output layer; optimizing and adjusting the network topology structure of the first neural network may include the following steps: increasing and adjusting the number of hidden layers based on an integer random value within the second interval.
[0140] For example, in some specific implementations, when the BP neural network model for predicting drilling accidents that meets expectations is not found, the process will start over. The entire process will not end until the expected model is found. TargetPrecision is a value of [0,1] that can be customized and defaults to 0.9, which is used to determine the optimal model.
[0141] When restarting, first, the parameters related to the genetic algorithm are reset, including the number of inner loop iterations reset to 0, the current population reset, etc. Specifically, the number of hidden layers n 2 Random adjustments will also be made. The adjustment formula is as follows, where R(1,10) represents an integer random value of [1,10], which means that a few neural network units will be added each time to improve the prediction accuracy of the BP neural network.
[0142] S900, predicting drilling accidents based on the drilling data to be predicted through a target neural network, and performing early warning processing based on the results of the drilling accident prediction.
[0143] For example, in some specific implementations, the predicted results include normal and abnormal (including accident types such as leakage, well gust, and blowout). When the predicted result is normal, only the result is notified. When the predicted result is abnormal, an early warning can be issued in the form of an alarm.
[0144] In order to explain the principle of the technical solution of the present invention in detail, the overall process of the present invention is described below in combination with some specific embodiments. It is easy to understand that the following is an explanation of the technical principle of the present invention and cannot be regarded as a limitation of the present invention.
[0145] First of all, it should be noted that the current technical solutions rely on subjective judgments made by experts based on real-time sensor data, combined with long-term accumulated drilling field experience to judge drilling status and abnormal accident alarms. However, manual judgment is inevitably affected by subjective bias and has great limitations. At the same time, relevant experience and knowledge are difficult to replicate and apply on a large scale.
[0146] Disadvantages of existing technology:
[0147] 1) Slow early warning response: The early warning mechanism that relies on manual judgment significantly reduces the efficiency of analysis, and the emergency response is not timely enough to meet the timeliness requirements.
[0148] 2) Limited dissemination of experience: Since early warning relies on personal work experience, relevant experience and knowledge are difficult to replicate and apply on a large scale.
[0149] 3) The difficulty of data analysis has increased dramatically: With the explosive growth of data volume and the rapid expansion of data dimensions, manual processing and analysis of data has become increasingly difficult.
[0150] In view of this, the present invention provides a drilling accident early warning method, such as Figure 8 As shown, the specific implementation steps may include:
[0151] Step 1: Get the test set and validation set. The drilling data used in this paper mainly comes from public data at home and abroad. Multiple sets of data records are collected from daily drilling reports, daily mud reports, completion reports and other materials. Some data show that drilling accidents occurred during the drilling process, and some data show that the drilling process is normal. Each set of data includes multiple characteristics such as lithology, pore size, porosity, pore pressure, fracture pressure, shear stress, gel strength, pump pressure, drill bit speed, primary fracture direction, cement slurry density, drilling fluid density, inlet flow, outlet flow, pump displacement, and whether the three abnormal conditions of drilling leakage, well kick, and blowout were sent in this set of data.
[0152] This article uses the idea of K-fold cross validation to split the test set and the validation set, where K can be customized and is generally around 5 to 10. The value of K is evaluated based on the actual amount of data collected. First, K groups are obtained through K-fold cross validation. Generally, VerifySize groups (VerifySize can be customized, generally 2) are randomly selected as the validation set, and the other K-VerifySize groups are used as the test set.
[0153] Step 2: Update the BP network topology. This step mainly does two things: reset the parameters of the genetic algorithm and update the BP network topology.
[0154] First, reset the parameters related to the genetic algorithm, including resetting the number of inner loop iterations to 0, resetting the current population, etc.
[0155] The following is to determine the BP neural network topology. For each set of drilling data, the data features are 15 features, including lithology, pore size, porosity, pore pressure, fracture pressure, shear stress, gel strength, pump pressure, drill bit speed, primary fracture direction, cement slurry density, drilling fluid density, inlet flow, outlet flow, pump displacement, etc., that is, there are 15 input variables and 1 output variable (type 0 means normal, type 1 means well leakage, type 2 means well kick, type 3 means well kick, type 0 means other situations). That is, the BP neural network has 15 input layers and 1 output layer.
[0156] This paper uses a three-layer BP neural network, the activation function is the Sigmoid function, and the number of hidden layer neural networks is n 2 and the number of neurons in the input layer n 1 There is an approximate relationship between them, refer to the following formula:
[0157] n 2 =2*n 1 +1
[0158] Therefore, the BP neural network topology has 15 input layers, 31 hidden layers, and 1 output layer. At this time, there are 15*31+31*1=496 weight parameters w to be optimized, and 31+1=32 threshold parameters b to be optimized, that is, there are 496+32=528 optimization variables searched by the genetic algorithm.
[0159] When step 2 is executed for the first time, the network topology is 15-31-1. Each time step 2 is executed, the number of hidden layers n is 2 Random adjustments will be made. The adjustment formula is as follows, where R(1,10) represents an integer random value of [1,10], which means that several neural network units will be added each time, thereby improving the prediction accuracy of the BP neural network.
[0160] n 2 =n 2 +R(1,10)
[0161] Step 3: Population initialization. The population is composed of a large number of individuals, each of which has multiple genes, which represent the weight parameter w and threshold parameter b of the BP neural network. Assume that the current BP neural network topology has 15 input layers and n hidden layers. 2 The output layer is 1, so the weight parameter w to be optimized is 15*n in total. 2 +n 2 *1, the threshold parameter b to be optimized is n in total 2+1. Generally speaking, the value range of weight w and threshold b is [-1, 1], and can be flexibly adjusted according to actual conditions.
[0162] The core of population initialization is to generate sizePop individuals (customizable, 50 by default), and initialize the corresponding genes for each individual. The present invention uses binary to represent gene encoding. The initialization gene first generates a decimal value, refer to the following formula, and then converts it into binary through encoding. Among them, random(0,1) represents a random number of [0,1].
[0163] w i =-1+(1-(-1))*random(0,1),1≤i≤15*n 2 +n 2 *1;
[0164] b i =-1+(1-(-1))*random(0,1),1≤i≤n 2 +1;
[0165]
[0166] Now we have obtained individuals represented by decimal coded real numbers, which need to be converted into individuals represented by binary codes. The present invention uses a relative coding processing method, which is as follows:
[0167] Decimal to binary encoding process: Regardless of weight w or threshold b, the search interval of each gene is [-1,1], and the binary encoding length is encodeLen, that is, encodeLen bits are needed to represent [-1,1]. encodeLen can be customized. According to experience, encodeLen=20 is sufficient, which performs well between data accuracy and computing performance. Refer to formula (1) for binary encoding accuracy. If there is a decimal gene, the binary encoding can be calculated by formula (2). The ToBinary() function converts a decimal integer into binary.
[0168]
[0169] Here is a specific example. Assuming that encodeLen = 20, substituting it into formula (1) we can get the data accuracy GeneAccuracy = 1.9073504518036383e-06;
[0170] Assuming Gene = -1, substituting into formula (2) the binary number obtained is 0000 0000 0000 0000 0000;
[0171] Assuming Gene = 0.35195, substituting it into formula (2) yields the binary number 0101 0011 0000 1011 0101;
[0172] Assuming Gene = 1, substituting into formula (2) the binary number obtained is 1111 1111 1111 1111 1111;
[0173] Binary to decimal decoding process: With the encoding process, the decoding process is the opposite of the calculation process. If there is a binary GeneBinary, the binary decoding can be obtained by calculating formula (3). The ToDecimal() function converts a binary integer into a decimal system.
[0174] GeneDecimal=-1+ToDecimal(GeneBinary)*GeneAccuracy (3)
[0175] Here is a specific example. Assuming that encodeLen = 20, substituting it into formula (1) we can get the data accuracy GeneAccuracy = 1.9073504518036383e-06;
[0176] Assuming that the binary number of Gene is 0000 0000 0000 0000 0000, substituting it into formula (3) yields -1;
[0177] Assuming that the binary number of Gene is 0101 0011 0000 1011 0101, substituting it into formula (3) yields 0.35195;
[0178] Assuming that the binary number of Gene is 1111 1111 1111 1111 1111, substituting it into formula (3) yields 1;
[0179] In general, the population initialization process is as follows: traverse each gene of each individual, randomly obtain the initialization value, and then determine the final gene expression form through binary coding. Here is an explanation of the reason for using binary coding, because the BP neural network has many parameters and a huge search space, and binary coding can easily achieve better population evolution through mutation operations, thereby obtaining the optimal value.
[0180] Step 4: Binary decoding to obtain parameters. Now we have a new population. Since all genes of each individual in the population are binary coded, they need to be decoded before they can be used in the BP neural network. Therefore, this step is to traverse each gene of each individual and perform binary decoding one by one. The decoding process refers to step 3, and finally the individual represented in decimal is obtained.
[0181] Step 5: Initialize BP neural network parameters. In step 1, the test set was obtained; in step 2, the topological structure of the BP neural network was clarified; in step 3, the population was initialized; in step 4, the neural network weight w and threshold b represented by each individual in the population were obtained. Facing the test set data, the BP neural network model for drilling accident prediction is ready.
[0182] Step 6: Calculate the prediction accuracy based on the BP neural network. Each individual in the population represents the BP neural network weight w and threshold b, that is, each individual represents a BP neural network. Based on each individual, traverse each array of the test set, input it into the BP neural network model, get the prediction result, and then compare it with the actual result. This article uses the prediction accuracy Precision as the fitness function for evaluation. Precision is between [0,1]. The larger the score, the better the model performance. The calculation formula is as follows. Among them, TrueSize represents the number of correct predictions. TestSetSize represents the number of test set data.
[0183]
[0184] At the same time, record the best performing individual at the moment:
[0185]
[0186] Step 7: Apply the selection operator to individuals based on probability. The selection operator mainly selects better individuals based on probability. The larger the Precision, the better the individual, and the smaller the Precision, the worse the individual. The selection operator will select sizePop individuals. The core idea of selection is to first sort all individuals from small to large according to the prediction accuracy Precision, select SelectRate*sizePop individuals according to SelectRate (which can be customized, the value range is [0,1], and the default is 0.8), and the remaining (1-SelectRate)*sizePop individuals are randomly selected from the population. The advantage of doing this is that individuals with excellent performance will directly participate in the evolution of the population, while individuals with poor performance still have the opportunity to participate in the evolution of the population, which not only increases the probability of excellent genes being selected, but also ensures the diversity of genes.
[0187] Step 8: Apply the crossover operator to individuals based on probability. Now we have sizePop individuals, and all individuals will be sorted from small to large according to the prediction accuracy Precision. Then, the individual with the largest Precision and the individual with the smallest Precision will be crossovered, and the individual with the second largest Precision and the second smallest Precision will be crossovered, and so on.
[0188] If two individuals 1 and Individual 2 Perform crossover and then traverse Individual 1 Each gene from Individual 2 A gene is randomly selected for crossover. Next, the and gene 2 Do crossover. Repeat this process to complete the random crossover of all genes. 1 All genes will be from Individual 1 Randomly select genes for crossover.
[0189]
[0190] Here is an example:
[0191] Assume Individual 1 w i The gene is 0101 0011 10 00 1011 0101;
[0192] Assume Individual 2 w j The gene is 1100 0100 00 11 0101 1111;
[0193] Based on the above rules, w i 0101 0011 10 and w j The 11 0101 1111 crossover is performed, and the genes after the crossover are as follows:
[0194] After the crossover, Individual 1 w i The gene is 11 0101 1111 00 1011 0101;
[0195] After the crossover, Individual 2 w j The gene is 1100 0100 00 0101 0011 10;
[0196] Step 9: Apply the mutation operator to individuals based on probability. Now we have sizePop individuals that have just undergone the crossover operation. The next step is the mutation operation. Traverse each individual one by one, randomly select mutationGeneSize genes (can be customized, the default is 10), for each gene, randomly select mutationBitSize (can be customized, the default is 3) positions, and then perform the mutation operation. Repeat this process to complete the gene mutation operation of all individuals.
[0197] Let's take an example, assuming that Individual 1 w i The gene is 0101 0011 1000 1011 0101. After the mutation, Individual 1 w i The gene is 0111 0011 1100 1001 0101.
[0198] It should be noted that in order to improve computational efficiency, the crossover operation and mutation operation can be performed in parallel.
[0199] Step 10: Get the next generation population. After steps 7 to 9, these individuals have just undergone crossover and mutation operations, indicating that a population reproduction has been completed. Through the survival of the fittest, a new generation of population is obtained.
[0200] Step 11: Satisfy the maximum number of iterations. Steps 4 to 10 are the innermost loop. Each time it is executed, the number of iterations increases by one. If the number of iterations exceeds the maximum value MaxGenCnt (which can be customized and is 20 by default), go to step 12, otherwise go to step 4.
[0201] Step 12: Find the optimal BP neural network parameters. When reaching this step, the entire genetic algorithm process is completed, indicating that the optimal parameters BestIndividual have been obtained:
[0202]
[0203] Step 13: Initialize BP neural network parameters. In step 1, the test set was obtained. In step 2, the BP network topology was determined. In step 12, the optimal parameter BestIndividual was obtained, that is, the neural network weight w and threshold b were adjusted to the optimal value. For the validation set data, the drilling accident prediction BP neural network model is ready.
[0204] Step 14: Calculate the classification accuracy based on the BP neural network. At this time, the optimal BP neural network model for drilling accident prediction has been obtained. Traverse each array group in the validation set, input it into the BP neural network model to get the prediction result, then compare it with the real result, and finally calculate the prediction accuracy Precision verify 。
[0205] It should be noted that Precision is calculated based on the test set in Step 5, but here Precision is calculated based on the validation set verify 。
[0206] Step 15: The classification accuracy meets the requirements. Steps 2 to 15 are the outermost loop. Whenever an expected BP neural network model for drilling accident prediction is not found, it will start over. Only when the expected model is found will the entire process end. TargetPrecision is a value in [0,1], which can be customized and defaults to 0.9 for determining the optimal model. The logic is as follows:
[0207] If Precision verify ≥TargetPrecision, it means that the verification result meets the expectation, that is, the BP neural network model for drilling accident prediction meets the expectation. At this time, go to Step 16 and the entire process ends completely.
[0208] If Precision verify <TargetPrecision, it means that the verification result does not meet the expectation and there is still room for optimization in the BP neural network model for drilling accident prediction. At this time, go to Step 2, reset the relevant parameters of the genetic algorithm, update the BP neural network topology, and search for the optimal parameters again, and the entire process starts over.
[0209] Step 16: Find the optimal BP neural network model. When reaching this step, it indicates that the BP neural network model for drilling accident prediction meets the expectation and the entire process ends completely.
[0210] In summary, for the BP neural network, the values of the weights w and the thresholds b are very important. The present invention does not use the common gradient descent algorithm, but introduces the genetic algorithm method to find the optimal weights w and thresholds b, thereby improving the prediction accuracy of the BP neural network. This is the main starting point of the present invention. In order to further prevent drilling accidents and reduce the losses caused by drilling accidents, the present invention proposes to improve the genetic algorithm to optimize the BP neural network model to enhance the drilling prediction ability. Compared with the prior art, the present invention has at least the following beneficial effects:
[0211] 1) A drilling accident prediction method based on the BP neural network is proposed, relying on the BP neural network, which significantly enhances the intelligent level of accident early warning.
[0212] 2) A method based on improved genetic algorithm to search for the optimal parameters of BP neural network was proposed, which automated the network parameter adjustment process and improved the accuracy of early warning.
[0213] 3) A dual-track verification process of test set and validation set is proposed, which strengthens the support for multi-dimensional expansion of input data and ensures the applicability and generalization ability of the BP neural network model.
[0214] On the other hand, Fig. 9 As shown, an embodiment of the present invention provides a drilling accident warning device 900, which may include:
[0215] The first module 910 is used to obtain drilling data marked with drilling accident types, and to obtain a test set and a validation set based on the drilling data;
[0216] The second module 920 is used to initialize the network topology structure of the initial neural network; the initial neural network is used as the first neural network;
[0217] The third module 930 is used to initialize the initial population; the initial population is used as the first population; the first population includes a first number of individuals, the individuals include first network parameters corresponding to the network topology structure of the first neural network, and the first network parameters are obtained based on binary coding;
[0218] The fourth module 940 is used to initialize the network parameters of the first neural network based on the individuals in the first population, and then obtain the first prediction accuracy corresponding to each individual through test set processing;
[0219] The fifth module 950 is used to sort all individuals in the first population based on the first prediction accuracy to obtain a second population; perform genetic processing on the second population to obtain a third population; and increase the number of iterations by 1; wherein the number of iterations is initially 0;
[0220] The sixth module 960 is used to determine the target individual according to the third population obtained in the last iteration when the number of iterations reaches the iteration threshold; otherwise, the third population is used as the first population, and then the fourth module 940 is returned to be executed;
[0221] The seventh module 970 is used to initialize the network parameters of the first neural network based on the target individual, and then obtain the second prediction accuracy of the target individual through verification set processing;
[0222] The eighth module 980 is used to, when the second prediction accuracy meets the accuracy requirement, use the first neural network with network parameters initialized according to the target individual as the target neural network; otherwise, optimize and adjust the network topology of the first neural network to obtain the second neural network, reset the number of iterations to 0, use the second neural network as the first neural network, and then return to execute the third module 930;
[0223] The ninth module 990 is used to predict drilling accidents based on the drilling data to be predicted through the target neural network, and perform early warning processing based on the results of the drilling accident prediction.
[0224] The contents of the method embodiments of the present invention are all applicable to the device embodiments. The functions specifically implemented by the device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0225] On the other hand, an embodiment of the present invention further provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the above-mentioned hydrate stability region bottom boundary prediction method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0226] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0227] like Fig.10 As shown, Fig.10 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0228] The processor 1001 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention.
[0229] The memory 1002 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1002 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1002, and the processor 1001 calls and executes the network node population optimization method of the embodiment of the present invention;
[0230] Input / output interface 1003, used to implement information input and output;
[0231] The communication interface 1004 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);
[0232] A bus 1005 , which transmits information between various components of the device (e.g., the processor 1001 , the memory 1002 , the input / output interface 1003 , and the communication interface 1004 );
[0233] The processor 1001 , the memory 1002 , the input / output interface 1003 and the communication interface 1004 are connected to each other in communication within the device via the bus 1005 .
[0234] The electronic device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0235] The contents of the method embodiments of the present invention are all applicable to the electronic device embodiments. The functions specifically implemented by the electronic device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0236] Another aspect of an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a program, and the program is executed by a processor to implement the above method.
[0237] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read to Only Memory, CD to ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0238] The contents of the method embodiments of the present invention are all applicable to the computer-readable storage medium embodiments. The functions specifically implemented by the computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0239] The embodiment of the present invention also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above method.
[0240] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0241] It should be noted that, although several modules of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0242] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD to ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present invention.
[0243] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.
[0244] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0245] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0246] The logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be embodied in any computer-readable medium for use by an instruction execution device, apparatus or device (such as a computer-based device, a device including a processor, or other device that can fetch instructions from an instruction execution device, apparatus or device and execute the instructions), or in conjunction with such instruction execution device, apparatus or device. For purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution device, apparatus or device, or in conjunction with such instruction execution device, apparatus or device.
[0247] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0248] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution device. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0249] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0250] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0251] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A drilling accident early warning method, characterized in that: The following steps are involved: Acquire drilling data marked with drilling accident types, and obtain a test set and a validation set based on the drilling data; Initializing a network topology structure of an initial neural network; using the initial neural network as a first neural network; Initializing an initial population; using the initial population as a first population; the first population includes a first number of individuals, the individuals include first network parameters corresponding to the network topology of the first neural network, and the first network parameters are obtained based on binary coding; Initializing the network parameters of the first neural network based on the individuals in the first population, and then obtaining a first prediction accuracy corresponding to each of the individuals through processing the test set; Sort all the individuals in the first population based on the first prediction accuracy to obtain a second population; perform genetic processing on the second population to obtain a third population; increase the number of iterations by 1; wherein the number of iterations is initially 0; When the number of iterations reaches an iteration threshold, a target individual is determined according to the third population obtained in the last iteration; otherwise, the third population is used as the first population, and then the step of initializing the network parameters of the first neural network based on the individuals in the first population is returned to execute; Initializing the network parameters of the first neural network based on the target individual, and then obtaining a second prediction accuracy of the target individual through processing the validation set; When the second prediction accuracy meets the accuracy requirement, the first neural network with network parameters initialized according to the target individual is used as the target neural network; otherwise, the network topology of the first neural network is optimized and adjusted to obtain a second neural network, the number of iterations is reset to 0, the second neural network is used as the first neural network, and then the step of initializing the initial population is returned to execute; The target neural network is used to predict drilling accidents based on the drilling data to be predicted, and early warning processing is performed based on the results of the drilling accident prediction.
2. The drilling accident early warning method according to claim 1, characterized in that: Initializing the initial population includes the following steps: Initialize all initial network parameters corresponding to the network topology structure of the first neural network based on random numbers within a first interval; Binary-encoding the initial network parameters to obtain the first network parameters; The individuals are obtained by arranging all the first network parameters, and the step of initializing all the initial network parameters corresponding to the network topology structure of the first neural network based on the random numbers in the first interval is returned to execute until the first number of individuals are obtained, and the initial population is obtained by arranging the first number of individuals.
3. The drilling accident early warning method according to claim 1, characterized in that: The initializing the network parameters of the first neural network based on the individuals in the first population comprises the following steps: Binary decoding is performed on the first network parameters included in all genes of the individuals of the first population to obtain second network parameters represented in decimal form; The second network parameters are applied to the first neural network to obtain the first neural network corresponding to the network parameters initialized based on each of the individuals in the first population.
4. The drilling accident early warning method according to claim 1, characterized in that: The step of obtaining the first prediction accuracy corresponding to each individual by processing the test set comprises the following steps: Traversing each of the drilling data in the test set, inputting the first neural network corresponding to the individuals in the first population after initializing network parameters, and obtaining an output prediction result; Comparing the prediction result with the drilling accident type marked corresponding to the input drilling data, and obtaining a second number of the drilling data in the test set having consistent prediction results; The first prediction accuracy of the first neural network corresponding to the individual after network parameters are initialized is obtained according to the ratio of the second number to the total number of data in the test set.
5. The drilling accident early warning method according to claim 1, characterized in that: The genetic treatment of the second population comprises the following steps: performing a selection process on the individuals of the second population; The selection process includes the following steps: The third number of individuals in the second population with the highest first prediction accuracy are selected as the first selection; randomly obtaining a fourth number of the individuals from the second population as a second selection; as a result of the selection process according to the first selection and the second selection; The sum of the third number and the fourth number is not greater than the first number.
6. The drilling accident early warning method according to claim 5, characterized in that: The genetic treatment of the second population further comprises the following steps: sorting all the individuals included in the result of the selection process based on the first prediction accuracy to obtain a fourth population; Performing a gene crossover operation on the individuals traversed in forward order and the individuals traversed in reverse order at corresponding positions in the fourth population; and / or, Performing a gene mutation operation on all the individuals in the fourth population.
7. The drilling accident early warning method according to claim 1, characterized in that: The first neural network includes an input layer, a hidden layer and an output layer; the optimizing and adjusting the network topology structure of the first neural network includes the following steps: The number of hidden layers is increased and adjusted based on an integer random value within a second interval.
8. A drilling accident warning device, characterized in that: include: The first module is used to obtain drilling data marked with drilling accident types, and to obtain a test set and a validation set based on the drilling data; The second module is used to initialize the network topology structure of the initial neural network; and use the initial neural network as the first neural network; A third module is used to initialize an initial population; the initial population is used as a first population; the first population includes a first number of individuals, the individuals include first network parameters corresponding to the network topology structure of the first neural network, and the first network parameters are obtained based on binary coding; A fourth module is used to initialize the network parameters of the first neural network based on the individuals in the first population, and then obtain a first prediction accuracy corresponding to each individual through processing of the test set; A fifth module is used to sort all the individuals in the first population based on the first prediction accuracy to obtain a second population; perform genetic processing on the second population to obtain a third population; and increase the number of iterations by 1; wherein the number of iterations is initially 0; The sixth module is used for determining the target individual according to the third population obtained in the last iteration when the number of iterations reaches the iteration threshold; otherwise, taking the third population as the first population and then returning to execute the fourth module; A seventh module is used to initialize the network parameters of the first neural network based on the target individual, and then obtain a second prediction accuracy of the target individual through processing the validation set; The eighth module is used for, when the second prediction accuracy meets the accuracy requirement, using the first neural network with network parameters initialized according to the target individual as the target neural network; otherwise, optimizing and adjusting the network topology of the first neural network to obtain a second neural network, resetting the number of iterations to 0, using the second neural network as the first neural network, and then returning to execute the third module; The ninth module is used to predict drilling accidents based on the drilling data to be predicted through the target neural network, and perform early warning processing based on the results of the drilling accident prediction.
9. An electronic device, characterized in that: including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method according to any one of claims 1 to 7.
10. A computer storage medium storing a program executable by a processor, characterized in that: The program executable by the processor is used to implement the method according to any one of claims 1 to 7 when executed by the processor.
Citation Information
Cited By
Well drilling accident real-time prediction method and device, electronic equipment and storage medium
CN119647668A
Well drilling leakage accident prediction method and device, electronic equipment and storage medium
CN119801475A
A drilling well leakage accident prediction method and device, electronic equipment and storage medium
CN119801475B
Synergistic preparation method and system for ocean drilling mud
CN119811541A
