Machine learning based drilling hazard early warning method and related devices

By optimizing the hyperparameters of the support vector machine using the Seagull optimization algorithm based on machine learning, a drilling hazard early warning model was constructed. This solved the subjectivity and data processing problems of relying on expert experience in drilling engineering, and achieved efficient and accurate drilling hazard early warning.

CN122390440APending Publication Date: 2026-07-14GUANGZHOU MARINE GEOLOGICAL SURVEY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU MARINE GEOLOGICAL SURVEY
Filing Date
2026-03-27
Publication Date
2026-07-14

Smart Images

  • Figure CN122390440A_ABST
    Figure CN122390440A_ABST
Patent Text Reader

Abstract

The application discloses a drilling danger early warning method based on machine learning and related equipment, and introduces a sea gull optimization algorithm to automatically optimize the hyperparameters of a support vector machine, constructs a high-precision drilling danger prediction model, can realize objective quantitative analysis of the drilling state, and can effectively get rid of the dependence on expert subjective experience, and significantly improves the accuracy and response speed of the early warning; in addition, the application can continuously monitor and evaluate the model performance based on the real-time collected data, and automatically triggers the iteration update of the model by using the newly added data when the model precision decreases, forms a closed-loop mechanism of 'collection-prediction-feedback-optimization', provides reliable technical support for the safe and efficient operation of the drilling engineering, and can be widely applied to the technical field of data processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a drilling hazard early warning method and related equipment based on machine learning. Background Technology

[0002] In the fields of resource exploration and drilling engineering, the assessment of operational status and the early warning of abnormal accidents heavily rely on expert experience. Existing technical solutions typically involve experts making subjective judgments about the drilling status based on real-time sensor data and their long-accumulated field experience. However, this human-led judgment model has significant limitations: First, manual analysis is susceptible to subjective factors, leading to slow early warning responses and failing to meet the stringent real-time and accuracy requirements of field operations; second, because core judgments rely on individual experience, related knowledge and skills are difficult to replicate, disseminate, and apply on a large scale; furthermore, as exploration and development deepen, the amount of data collected by sensors explodes, and the data dimensions become increasingly complex, drastically increasing the difficulty of manually processing and analyzing this massive amount of heterogeneous data, further exacerbating the inefficiencies and inaccuracies of traditional methods. Summary of the Invention

[0003] The main objective of this invention is to propose a drilling hazard early warning method, device, electronic device, storage medium, and program product based on machine learning, aiming to solve at least one problem of the prior art.

[0004] To achieve the above objectives, one aspect of this invention proposes a drilling hazard early warning method based on machine learning, the method comprising: Obtain the dataset and initialize the seagull population; each set of data in the dataset includes the drilling hazard type associated with the feature variables of the data record, and each individual in the seagull population includes a set of hyperparameters of a support vector machine; Based on the dataset and the seagull population, the hyperparameters of each individual are quantified and applied to the F1 score of the support vector machine as the first score. If no first score satisfies the score condition, the seagull population is updated using the seagull optimization algorithm. The process is then repeated until a first score satisfies the score condition. The target prediction model is obtained by configuring the support vector machine according to the corresponding individual. Continuously collect real-time data, input the real-time feature vectors corresponding to the real-time data into the target prediction model to predict drilling risks and obtain the predicted risk type; If the amount of real-time data reaches the preset requirement, obtain the actual risk type corresponding to the real-time data, and combine it with the predicted risk type to obtain the F1 score of the target prediction model as the second score; If the second score is lower than the score threshold, increment the failure count by 1, return to the step of continuously collecting real-time data until the failure count exceeds the failure threshold, associate the real-time feature vector with the actual danger type and incorporate it into the dataset, reset the failure count, return to the step of initializing the seagull population, and continuously update the target prediction model.

[0005] In some embodiments, hyperparameters include regularization coefficients and kernel parameters. Initializing a seagull population includes the following steps: Initialize the number of individuals to 0; Regularization coefficients are generated based on random numbers within the first value range; Kernel parameters are generated based on random numbers within the second value range; The regularization coefficients and kernel parameters are grouped into a single entity; Increment the number of individuals by 1, return to the step of generating a regularization coefficient based on a random number within the first value range, until the number of individuals reaches the preset total number of individuals, and then summarize all individuals to complete the initialization of the seagull population.

[0006] In some embodiments, based on the dataset and the seagull population, the hyperparameters of each individual are quantified and applied to the F1 score of the support vector machine as the first score, including the following steps: The first individual in the seagull population was used as the candidate individual; The hyperparameters of the candidate individuals are applied to the support vector machine to obtain the candidate prediction model; Use the first set of data in the dataset as the prediction sample; Input the feature variables of the predicted sample into the candidate prediction model, and process the output of the candidate prediction model to obtain the sample prediction type. The next set of data in the dataset is used as the next prediction sample. The process of inputting the feature variables of the prediction sample into the candidate prediction model is repeated until all data in the dataset has been traversed. Based on the comparison results of the sample prediction type and drilling risk type corresponding to each group of data in the dataset, the number of prediction samples of each type is statistically obtained, and the F1 score of the candidate individual is obtained as the first score based on the quantification of the prediction samples. The next individual in the seagull population is taken as the next candidate individual. The process is repeated to apply the hyperparameters of the candidate individual to the support vector machine until the first score of each individual in the seagull population is obtained.

[0007] In some embodiments, updating the seagull population using a seagull optimization algorithm includes the following steps: The individual with the highest first score is considered the migrating individual, and environmental information is updated based on the number of updates in the seagull population. Based on migrating individuals and environmental information, migration operations are performed on each individual in the seagull population, and then hunting operations are carried out through spiral motion with random step size to update the seagull population, incrementing the update count by 1.

[0008] In some embodiments, environmental information includes the proportion of location changes and a balance search random number. The seagull population update configuration has an upper limit on the number of updates. Updating the environmental information based on the number of updates for the seagull population includes the following steps: The update progress value is determined based on the ratio of the current update count to the upper limit of the update count. The position change ratio is determined by the product of the complementary value of the update progress value to 1 and the preset control factor. The random number within the preset range is multiplied by the square of the position change ratio, and then the balance search random number is determined by multiplication.

[0009] In some embodiments, environmental information includes the proportion of location changes and equilibrium search random numbers. Based on migrating individuals and environmental information, migration operations are performed on each individual in the seagull population, and hunting operations are then carried out through spiral motion with random step sizes to update the seagull population, including the following steps: Based on the product of the location change ratio and the individual, the undirected migration of each individual in the seagull population is carried out to obtain the first individual corresponding to each individual; Multiply the sum of the first individual and the migrating individuals by the balanced search random number, and then perform directional migration through absolute value operation to obtain the second individual corresponding to each individual; The product of the equilibrium search random number and the first spiral motion parameter is used as the exponent of the natural constant for exponential operation. The result of the exponential operation is multiplied by the second spiral motion parameter to obtain the spiral motion radius. Based on the radius of the spiral motion, the three-dimensional coordinates of the spiral motion are constructed by combining trigonometric functions with the random step size flight of Levy's flight. Multiply the three-dimensional coordinates of the spiral motion, the second individual, and the migrating individual to obtain the completed hunting individual corresponding to each individual, thus updating the seagull population.

[0010] In some embodiments, until a first score satisfies the score condition, a target prediction model is obtained based on the corresponding individual configuration support vector machine, including the following steps: If there is a first score that exceeds the score threshold, the hyperparameters of the corresponding individual are applied to the support vector machine to obtain the target prediction model; If there is no first score exceeding the score threshold, and the number of updates for the seagull population reaches the preset update limit, the individual with the largest first score in the seagull population obtained from the last update is used as the configuration individual. The hyperparameters of the configuration individual are applied to the support vector machine to configure the target prediction model.

[0011] To achieve the above objectives, another aspect of the present invention proposes a drilling hazard early warning device based on machine learning, the device comprising: The first module is used to acquire a dataset and initialize the seagull population. Each set of data in the dataset includes the drilling hazard type associated with the feature variables of the data record, and each individual in the seagull population includes a set of hyperparameters of a support vector machine. The second module is used to quantify the hyperparameters of each individual based on the dataset and the seagull population, and apply them to the F1 score of the support vector machine as the first score. The third module is used to update the seagull population through the seagull optimization algorithm if no first score satisfies the score condition, and then return to execute the operation of the second module until a first score satisfies the score condition. The target prediction model is obtained by configuring a support vector machine according to the corresponding individual. The fourth module is used to continuously collect real-time data, input the real-time feature vectors corresponding to the real-time data into the target prediction model to predict drilling risks and obtain the predicted risk type. The fifth module is used to obtain the actual risk type corresponding to the real-time data if the amount of real-time data reaches the preset requirement, and to obtain the F1 score of the target prediction model as the second score by combining the predicted risk type with the quantitative analysis. The sixth module increments the failure count by 1 if the second score is lower than the score threshold, returns to the operation of the fourth module, and continues until the failure count exceeds the failure threshold. Then, it associates the real-time feature vector with the actual danger type and incorporates it into the dataset, resets the failure count, and returns to the operation of initializing the seagull population in the first module to continuously update the target prediction model.

[0012] To achieve the above objectives, another aspect of the present invention provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned method.

[0013] To achieve the above objectives, another aspect of the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned method.

[0014] To achieve the above objectives, another aspect of the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the aforementioned method.

[0015] The embodiments of this invention include at least the following beneficial effects: This invention provides a drilling hazard early warning method, device, electronic device, storage medium, and program product based on machine learning. This solution initializes a seagull population by acquiring a dataset; wherein each data set in the dataset includes drilling hazard types associated with feature variables of the data records, and each individual in the seagull population includes a set of hyperparameters for a support vector machine; based on the dataset and the seagull population, the F1 score of each individual's hyperparameters applied to the support vector machine is quantized as a first score; if no first score satisfies the score condition, the seagull population is updated using the seagull optimization algorithm, and the process returns to executing the F1 score of each individual's hyperparameters applied to the support vector machine based on the dataset and the seagull population as the first score. The process involves several steps: First, a first score is obtained that satisfies the score condition. Then, a target prediction model is obtained based on the corresponding individual configuration support vector machine. Second, real-time data is continuously collected, and the real-time feature vectors corresponding to the real-time data are input into the target prediction model to predict drilling risks and obtain the predicted risk type. If the amount of real-time data reaches a preset requirement, the actual risk type corresponding to the real-time data is obtained, and the F1 score of the target prediction model is quantified based on the predicted risk type as the second score. If the second score is lower than the score threshold, the failure count is incremented by 1, and the process returns to the step of continuously collecting real-time data until the failure count exceeds the failure threshold. Then, the real-time feature vectors are associated with the actual risk type and merged into the dataset, the failure count is reset, and the process returns to the step of initializing the seagull population, continuously updating the target prediction model. This invention constructs a high-precision drilling hazard prediction model by introducing the Seagull optimization algorithm to automatically optimize the hyperparameters of the support vector machine. This model enables objective quantitative analysis of drilling conditions, effectively eliminating reliance on expert subjective experience and significantly improving the accuracy and response speed of early warnings. Furthermore, this invention continuously monitors and evaluates model performance based on real-time data collection, and automatically triggers iterative updates using new data when model accuracy declines, forming a closed-loop mechanism of "collection-prediction-feedback-optimization." Specifically, this invention not only overcomes the limitations of personal experience in dissemination and replication but also achieves adaptive adaptation to changes in drilling conditions, ensuring the early warning model maintains optimal performance over the long term. It effectively reduces the difficulty of analyzing massive amounts of high-dimensional data, providing reliable technical support for the safe and efficient operation of drilling projects. Attached Figure Description

[0016] Figure 1 This is a schematic diagram of an implementation environment for a drilling hazard early warning method based on machine learning provided in an embodiment of the present invention; Figure 2 This is a flowchart illustrating the drilling hazard early warning method based on machine learning provided in an embodiment of the present invention. Figure 3 This is a schematic diagram of the overall process of the drilling hazard early warning method based on machine learning provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of the drilling hazard early warning device based on machine learning provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of this invention; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this invention as detailed in the appended claims.

[0018] It is understood that the terms "first," "second," etc., used in this invention may be used to describe various concepts, but unless specifically stated otherwise, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of embodiments of this invention, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words "if" or "when" as used herein may be interpreted as "when," "in response to determination," or "in the event of a determination."

[0019] The terms “at least one,” “multiple,” “each,” “any,” etc., used in this invention, “at least one” includes one, two, or more than two; “multiple” includes two or more than two; “each” refers to each of the corresponding multiple; and “any” refers to any one of the multiple.

[0020] Unless otherwise defined, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used in this invention is for descriptive purposes only and is not intended to limit the invention.

[0021] To facilitate understanding of the technical solution of this invention, the key terms that may be involved in the technical solution of this invention will first be explained: Ocean drilling refers to drilling activities at the bottom of the deep sea to obtain core samples of the Earth's crust and upper mantle in order to study the Earth's internal structure and geological processes. This process involves using specialized drilling equipment and vessels, such as ocean drilling ships, to conduct drilling operations at depths of several thousand meters on the seabed. This process not only helps scientists understand the Earth's internal structure but also reveals important geological phenomena such as the Earth's historical changes and plate tectonics.

[0022] The Seagull Optimization Algorithm (SOA) is a swarm optimization algorithm inspired by the migration and foraging behaviors of seagulls in nature. Its core simulations of three behaviors in a seagull flock are: 1) Migration (global exploration), adjusting individual positions through linearly decreasing variables to avoid collisions and guide the flock towards the optimal solution; 2) Attack behavior, simulating the spiral motion of seagulls during foraging, dynamically adjusting attack angles and speeds to precisely approximate the optimal solution; and 3) A position update mechanism, combining historical optimal positions and individual experience to balance global search and local exploitation capabilities. This algorithm is widely used in path planning, engineering optimization, and machine learning parameter tuning due to its advantages of few parameters, ease of implementation, and fast convergence. It is important to note that it may get trapped in local optima; robustness can be enhanced through adaptive parameter strategies.

[0023] Support Vector Machines (SVMs) are a classic machine learning method that has demonstrated great potential in pattern recognition, classification, and regression analysis due to their excellent generalization ability and effective handling of nonlinear problems. Its core concept lies in constructing an optimal decision boundary that not only clearly separates samples of different classes but also has the maximum margin, aiming to enhance the model's predictive performance on unknown data. For nonlinear problems, SVMs utilize kernel tricks to map to a high-dimensional space, achieving effective separation. They are suitable for small to medium-sized datasets and high-dimensional feature spaces.

[0024] 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.

[0025] Loss of drilling fluid (also known as mud) refers to the accidental inflow of drilling fluid into the formation during drilling. This is usually caused by high formation permeability or improper drilling pressure control, leading to fluid loss. Loss of drilling fluid can reduce the amount of drilling fluid, affecting the cooling and cleaning capabilities of the wellbore, and may also expose the wellbore wall, increasing the risk of collapse. In severe cases, loss of drilling can hinder continued drilling and may even require special measures to seal the lost circulation zone.

[0026] A well kick occurs when underground fluid (mainly natural gas or liquids) enters the wellbore at a rate exceeding normal circulation speed, but before reaching the surface. Well kicks are usually caused by formation pressure exceeding the pressure inside the wellbore, or by insufficient drilling fluid column pressure to balance the formation pressure. If not controlled promptly, a well kick can quickly escalate into a more severe blowout. A well kick is an emergency requiring immediate action, such as increasing the drilling fluid volume and shutting off the blowout preventer (BOP), to re-establish pressure balance within the wellbore.

[0027] A blowout is one of the most serious accidents, occurring when high-pressure underground fluids (oil, gas, water, or other mixtures) are uncontrollably ejected from the wellhead and reach the surface or sea. Blowouts not only cause enormous resource losses but can also trigger catastrophic consequences such as fires, explosions, and environmental pollution, seriously threatening human safety and the environment. Blowouts typically require the immediate activation of emergency response plans, including the use of specialized well control equipment (such as blowout preventers), injection of re-drilling fluid, or cement plugs to seal and control the well.

[0028] In related technologies, existing solutions typically rely on experts to subjectively assess the drilling status based on real-time sensor data and their long-accumulated drilling field experience. However, this human-driven judgment mode has significant limitations.

[0029] In view of this, this invention provides a drilling hazard early warning method and related equipment based on machine learning. This method initializes a seagull population by acquiring a dataset; each data set in the dataset includes drilling hazard types associated with feature variables of the data records, and each individual seagull in the population includes a set of hyperparameters for a support vector machine; based on the dataset and the seagull population, the F1 score of each individual's hyperparameters applied to the support vector machine is quantized as a first score; if no first score satisfies the score condition, the seagull population is updated using the seagull optimization algorithm, and the process returns to the step of quantizing the hyperparameters of each individual based on the dataset and the seagull population and applying them to the support vector machine as the first score, until a first score is found. If the data meets the score condition, a target prediction model is obtained based on the corresponding individual configuration support vector machine. Real-time data is continuously collected, and the real-time feature vectors corresponding to the real-time data are input into the target prediction model to predict drilling risks and obtain the predicted risk type. If the amount of real-time data reaches the preset requirement, the actual risk type corresponding to the real-time data is obtained, and the F1 score of the target prediction model is obtained by combining the predicted risk type as a second score. If the second score is lower than the score threshold, the failure count is incremented by 1, and the process returns to the step of continuously collecting real-time data until the failure count exceeds the failure threshold. At this point, the real-time feature vectors are associated with the actual risk type and merged into the dataset, the failure count is reset, and the process returns to the step of initializing the seagull population to continuously update the target prediction model. This invention constructs a high-precision drilling hazard prediction model by introducing the Seagull optimization algorithm to automatically optimize the hyperparameters of the support vector machine. This model enables objective quantitative analysis of drilling conditions, effectively eliminating reliance on expert subjective experience and significantly improving the accuracy and response speed of early warnings. Furthermore, this invention continuously monitors and evaluates model performance based on real-time data collection, and automatically triggers iterative updates using new data when model accuracy declines, forming a closed-loop mechanism of "collection-prediction-feedback-optimization." Specifically, this invention not only overcomes the limitations of personal experience in dissemination and replication but also achieves adaptive adaptation to changes in drilling conditions, ensuring the early warning model maintains optimal performance over the long term. It effectively reduces the difficulty of analyzing massive amounts of high-dimensional data, providing reliable technical support for the safe and efficient operation of drilling projects.

[0030] It is understood that the drilling hazard early warning method based on machine learning provided by this 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 communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the terminal can be a smartphone, tablet, laptop, or desktop computer, but it is not limited to these.

[0031] like Figure 1 The diagram shown is a schematic representation of an implementation environment provided by an embodiment of the present invention. (Refer to...) Figure 1 The implementation environment includes at least one terminal 102 and a server 101. The terminal 102 and the server 101 can be connected via a network, either wirelessly or via a wired connection, to complete data transmission and exchange.

[0032] Server 101 can be a standalone physical server, a server cluster or distributed system consisting 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 communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0033] Additionally, server 101 can also be a node server in a blockchain network. Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms.

[0034] Terminal 102 can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. Terminal 102 and server 101 can be directly or indirectly connected via wired or wireless communication, and this embodiment of the invention does not impose any limitations.

[0035] For example, based on Figure 1 The implementation environment shown in this embodiment of the invention provides a drilling hazard early warning method based on machine learning. The following description uses the application of this machine learning-based drilling hazard early warning method in server 101 as an example. It can be understood that this machine learning-based drilling hazard early warning method can also be applied in terminal 102.

[0036] Reference Figure 2 , Figure 2 This is an optional flowchart of a drilling hazard early warning method based on machine learning provided in an embodiment of the present invention. The executing entity of the drilling hazard early warning method based on machine learning can be any of the aforementioned computer devices (including servers or terminals). Figure 2 The method may include, but is not limited to, steps S100 to S600.

[0037] Step S100: Obtain the dataset and initialize the seagull population; Each set of data in the dataset includes the type of drilling hazard associated with the feature variables of the data record, and each individual in the seagull population includes a set of hyperparameters of a support vector machine. It should be noted that the hyperparameters include regularization coefficients and kernel parameters. In some embodiments, initializing the seagull population may include the following steps: initializing the number of individuals to 0; generating regularization coefficients based on random numbers within a first value range; generating kernel parameters based on random numbers within a second value range; combining the regularization coefficients and kernel parameters into a single individual; incrementing the number of individuals by 1, and returning to the step of generating regularization coefficients based on random numbers within the first value range, until the number of individuals reaches the preset total number of individuals, and summing all individuals to complete the initialization of the seagull population.

[0038] For example, in some specific embodiments, the drilling data used in this invention mainly consists of two parts: historical data and field operation data, which together constitute a complete dataset. Each data record contains multiple feature variables, 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 rate, outlet flow rate, and pump discharge rate. Simultaneously, the data is labeled with whether the record has experienced one of three abnormal conditions: lost circulation, well kick, or blowout. The seagull population is composed of a large number of individuals, each representing a set of parameters to be optimized. In this invention, the algorithm is applied to the hyperparameter tuning of Support Vector Machine (SVM), specifically focusing on two key parameters: the regularization coefficient C and the kernel parameter g. These two parameters together constitute the genetic code of the seagull population individuals, and their interaction determines the overall performance of the SVM model. Through in-depth data research, and considering the real-time prediction needs of drilling accidents, the final value range of the regularization coefficient C is determined to be... The final range of values ​​for the kernel parameter g is: Finally, the individual is completed using the following formula. The initialization, where express random floating-point numbers, express A random floating-point number.

[0039]

[0040]

[0041]

[0042] Step S200: Based on the dataset and the seagull population, the hyperparameters of each individual are quantified and applied to the F1 score of the support vector machine as the first score; It should be noted that in some embodiments, step S200 may include the following steps: taking the first individual in the seagull population as a candidate individual; applying the hyperparameters of the candidate individual to a support vector machine to configure a candidate prediction model; taking the first set of data in the dataset as a prediction sample; inputting the feature variables of the prediction sample into the candidate prediction model, and processing the output through the candidate prediction model to obtain the sample prediction type; taking the next set of data in the dataset as a prediction sample, and returning to execute the step of inputting the feature variables of the prediction sample into the candidate prediction model, until all data in the dataset has been traversed; statistically obtaining the number of prediction samples of each type based on the comparison results between the sample prediction type corresponding to each set of data in the dataset and the drilling hazard type, and obtaining the F1 score corresponding to the candidate individual as the first score based on the quantification of the prediction samples; taking the next individual in the seagull population as a candidate individual, and returning to execute the step of applying the hyperparameters of the candidate individual to the support vector machine, until the first score of each individual in the seagull population is obtained.

[0043] For example, in some specific implementations, each individual in the population represents the regularization coefficient C and kernel parameter g of the SVM (Support Vector Machine), that is, each individual represents an SVM prediction model. Based on the prediction model represented by each individual, the latest dataset is traversed one by one, and each data point is input into the model to obtain the prediction result, which is then compared with the true result. This invention uses the commonly used F1 score as the fitness function for evaluation. The F1 score is between [0, 1], and the larger the score, the better the model performance. The calculation formula is as follows. Here, TP is the number of correctly predicted positive class samples, FP is the number of incorrectly predicted positive class samples (actually negative class), and FN is the number of incorrectly predicted negative class samples (actually positive class).

[0044]

[0045]

[0046]

[0047] In summary, based on the latest dataset, the prediction model for each individual is iterated through one by one, and the F1 score of the output result, i.e. the fitness function value, is calculated.

[0048] Step S300: If there is no first score that satisfies the score condition, update the seagull population through the seagull optimization algorithm, return to execute the step of quantizing the hyperparameters of each individual based on the dataset and the seagull population and applying them to the F1 score of the support vector machine as the first score, until there is a first score that satisfies the score condition, and obtain the target prediction model by configuring the support vector machine according to the corresponding individual. It should be noted that, in some embodiments, updating the seagull population using the seagull optimization algorithm may include the following steps: taking the individual with the largest first score as the migrating individual, updating the environmental information based on the number of updates of the seagull population; performing migration operations on each individual in the seagull population based on the migrating individual and the environmental information, and then performing hunting operations through a spiral motion with a random step size to update the seagull population, and incrementing the update count by 1.

[0049] It should be noted that the environmental information includes the position change ratio and the balance search random number. The seagull population update configuration has an upper limit on the number of updates. In some embodiments, updating the environmental information based on the number of updates of the seagull population may include the following steps: determining the update progress value based on the ratio of the current update number to the upper limit of the update number; determining the position change ratio based on the product of the complementary value of the update progress value to 1 and a preset control factor; multiplying a random number within a preset range with the square of the position change ratio, and then determining the balance search random number through a multiplication operation.

[0050] For example, in some implementations, this step performs dynamic calculations of environmental information to provide a basis for decision-making regarding seagull population migration and foraging behavior. The core objective is to avoid individual collisions and balance the algorithm's global-local search capabilities. Specifically, this involves calculating two pieces of environmental information: the proportion of seagull position changes. And balancing global-local search random numbers .

[0051] seagull's position change ratio This randomization of migration direction and distance prevents seagulls from overlapping (colliding) during migration, ensuring population diversity. Its calculation is based on an iterative process that adaptively adjusts the random numbers, balancing global and local search. For subsequent attack operations, randomness is injected into the spiral motion to prevent the algorithm from getting trapped in local optima (such as a "death spiral"). Its calculation is achieved using pseudo-random numbers. The formula is as follows:

[0052]

[0053] in This is the control factor for the Seagull optimization algorithm, with a value range of (0, 1], adjusted empirically, and a default value of 0.5. i represents the current iteration number, with a value range of [1, MG]. It represents a random number in the range [0, 1].

[0054] It should be noted that the environmental information includes the position change ratio and the balance search random number. In some embodiments, based on the migrating individuals and environmental information, migration operations are performed on each individual in the seagull population, and then hunting operations are carried out through a spiral motion with random step size to update the seagull population. This may include the following steps: based on the product of the position change ratio and the individual, each individual in the seagull population is migrated undirected to obtain the first individual corresponding to each individual; the sum of the first individual and the migrating individuals is multiplied by the balance search random number, and then the absolute value is used to perform directional migration to obtain the second individual corresponding to each individual; the product of the balance search random number and the first spiral motion parameter is used as the exponent of the natural constant for exponential operation, and the result of the exponential operation is multiplied by the second spiral motion parameter to obtain the spiral motion radius; based on the spiral motion radius, the three-dimensional coordinates of the spiral motion are constructed using trigonometric functions combined with the random step size flight of Levy's flight; the three-dimensional coordinates of the spiral motion, the second individual, and the migrating individuals are multiplied to obtain the individuals corresponding to each individual who have completed hunting to update the seagull population.

[0055] For example, in some specific implementations, a single seagull Taking migration as an example, the calculation process is as follows: First, individual seagulls migrate randomly. Then, the seagulls move towards the individual with the best population in this iteration. They migrated. Among them, This indicates the location of the seagulls before their unpredictable migration. This indicates the location of seagulls after their unpredictable migration. Let represent the optimal individual in the population during the t-th iteration. All individuals migrate according to the above process, and then the entire seagull population completes its migration.

[0056]

[0057]

[0058]

[0059] in, Given a preset total number of individuals, the migration process exhibits significant adaptive characteristics: in the initial iteration phase ( Smaller), focusing on global exploration of new parameter space; later iterations ( (Gradually increasing in size), focusing on local fine-grained development. This mechanism directly optimizes the search efficiency of the regularization coefficient C and kernel parameter g of the SVM support vector machine, supporting the accurate construction of the drilling accident early warning model. After the migration is completed, the attack operation is executed, forming a global-local collaborative optimization closed loop.

[0060] With a single seagull Taking hunting as an example, the calculation process is as follows: Represents the radius of the spiral motion. The three-dimensional coordinates represent the helical motion. It is a random value between [0, 1], and it is a random step-size flight referenced to Levi's flight. Therefore... It is not entirely based on the radius of the spiral motion. It was determined that. This indicates the seagull's location after completing its hunt. In the formula below, and These are parameters related to helical motion, with a value range of (0, 1]. They are adjusted based on experience, and the default value is 0.5, which is a constant.

[0061]

[0062]

[0063]

[0064]

[0065]

[0066] All individuals hunt according to the above process, and then the entire gull population completes the hunt. Each gull flies from one location to another towards the best individual, thus updating the gull population's location.

[0067] It should be noted that in some embodiments, the process of obtaining the target prediction model by configuring a support vector machine based on the corresponding individual until a first score satisfies the score condition may include the following steps: if a first score exceeds a score threshold, the hyperparameters of the corresponding individual are applied to the support vector machine to configure the target prediction model; if no first score exceeds the score threshold, and the number of updates to the seagull population reaches a preset update limit, the individual with the largest first score in the seagull population obtained from the last update is used as the configuration individual, and the hyperparameters of the configuration individual are applied to the support vector machine to configure the target prediction model.

[0068] For example, in some specific implementations, the F1 score of each individual in the population is traversed. If an individual's F1 score exceeds the TargetF1 (i.e., the score threshold, defined according to requirements, with a value range of [0, 1], and a default value of 0.9), it indicates that the optimal parameters have been found; otherwise, iteration needs to continue to update the seagull population. Furthermore, in the inner loop of the seagull algorithm's optimization, the iteration count (i.e., the update count) is incremented by 1 each time it is executed. If the current iteration count exceeds the maximum iteration count MG (i.e., the upper limit of the update count), the individual with the highest F1 score is used to configure the target prediction model. The maximum iteration parameter MG is defined according to requirements.

[0069] Step S400: Continuously collect real-time data, input the real-time feature vector corresponding to the real-time data into the target prediction model to predict drilling risks and obtain the predicted risk type. For example, in some specific implementations, the real-time data here is obtained from field drilling reports, mud reports, and completion reports, or from field monitoring systems; it is front-line real-time operational data. 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 rate, outlet flow rate, and pump discharge rate. This data can be manually recorded as needed or automatically generated by the monitoring system. Based on this data, it is input into a drilling accident prediction SVM support vector machine model to perform on-site drilling accident prediction.

[0070] Step S500: If the amount of real-time data reaches the preset requirement, obtain the actual risk type corresponding to the real-time data, and combine the predicted risk type to obtain the F1 score of the target prediction model as the second score. For example, in some specific embodiments, the present invention uses the F1 score to evaluate the prediction model, which requires a certain amount of real-time data, generally more than 1,000 data points, before the prediction model is used to calculate the F1 score. If the amount of data is too small, it is easy to produce large errors. Therefore, this step is to calculate the second score after obtaining a certain amount of data. It should be noted that the quantification logic principle of the second score is the same as that of the first score, and will not be elaborated here.

[0071] Step S600: If the second score is lower than the score threshold, increment the failure count by 1, return to the step of continuously collecting real-time data until the failure count exceeds the failure threshold, associate the real-time feature vector with the actual danger type and merge it into the dataset, reset the failure count, return to the step of initializing the seagull population, and continuously update the target prediction model. For example, in some specific implementations, based on the calculated F1 score (second score), if the F1 score exceeds TargetF1, it indicates that the current prediction model meets expectations; if the score is lower than TargetF1, the failure count Delt is incremented by one; if the failure count Delt exceeds MaxDelt (failure threshold), the SVM support vector machine needs to be updated; otherwise, the current model can continue to be used. If the SVM support vector machine needs to be updated, the Seagull algorithm parameters, the failure count Delt, and the relevant SVM support vector machine parameters are reset, that is, the entire search process restarts.

[0072] To explain in detail the principle of the technical solution of the present invention, the overall process of the present invention will be described below with reference to some specific embodiments. It is easy to understand that the following is an explanation of the technical principle of the present invention and should not be regarded as a limitation of the present invention.

[0073] First, it's important to note that in the past, the prediction of lost circulation, well kicks, and blowouts relied heavily on subjective judgments made by technicians based on real-time sensor data. This required technicians to possess extensive practical experience. However, human judgment is inevitably influenced by subjective biases and has limitations. Specifically, 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 determine drilling status and trigger alarms for abnormal events. However, human judgment is inevitably influenced by subjective biases and has significant limitations. Furthermore, the relevant experience and knowledge are difficult to replicate and apply on a large scale.

[0074] The disadvantages of existing technologies include: 1) Slow early warning response: Early warning mechanisms that rely on manual judgment significantly reduce analysis efficiency, and emergency response is not timely enough, making it difficult to meet the timeliness requirements.

[0075] 2) Limited dissemination of experience: Since early warning relies on individual work experience, the relevant experience and knowledge are difficult to replicate and apply on a large scale.

[0076] 3) Data analysis difficulty 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.

[0077] In view of the shortcomings of existing technologies, this invention proposes a drilling hazard early warning method based on machine learning. The optimal parameters of the SVM (Support Vector Machine) are found using the Seagull Algorithm, thereby obtaining a drilling hazard prediction model, such as... Figure 3 As shown, embodiments of the present invention can be implemented through the following process: Step 1: Obtain the latest dataset. The drilling data used in this invention mainly consists of two parts: historical data and field operation data, which together constitute a complete dataset.

[0078] 1) Historical data: Primarily sourced from publicly available domestic and international data, including multiple sets of records extracted from documents such as daily drilling reports, daily mud reports, and well completion reports. This data covers both cases of accidents such as lost circulation, well kicks, or blowouts that occurred during drilling, as well as relevant information under normal operating conditions.

[0079] 2) Field Operation Data: Data is collected directly from the front-line operation site. The process is as follows: First, a drilling accident prediction model is applied to predict accidents such as lost circulation, well kick, or blowout in real time; second, the accuracy of the prediction results is manually verified. Regardless of whether the prediction is correct or incorrect, the relevant data (if the prediction is incorrect, it is corrected) will be included in the dataset. The model update mechanism is dynamically adjusted based on prediction performance: when the prediction is consistently correct, the system updates the model periodically according to preset configurations; when the prediction fails and specific conditions (such as an error rate threshold) are met, a model update is triggered immediately.

[0080] Each data record contains multiple characteristic variables, such as lithology, pore size, porosity, pore pressure, fracture pressure, shear stress, gel strength, pump pressure, drill bit rotation speed, primary fracture direction, cement slurry density, drilling fluid density, inlet flow rate, outlet flow rate, and pump displacement. The data also indicates whether the record has experienced one of three abnormal conditions: lost circulation, well kick, or blowout. It is important to emphasize that the iterative updates of the drilling accident prediction model and the prediction operations based on that model are independent and do not affect each other. While the model update is incomplete, the system continues to use the previous version for prediction; after the update is complete, a version switch will be triggered, during which the prediction service will be paused, and then the latest version of the model will be automatically applied to resume operations. Proceed to step 2.

[0081] Step 2: Seagull Population Initialization. The seagull population consists of a large number of individuals, each representing a set of parameters to be optimized. In this invention, the algorithm is applied to hyperparameter tuning of Support Vector Machine (SVM), specifically focusing on two key parameters: the regularization coefficient C and the kernel parameter g. The specific meanings of these two parameters are as follows: Regularization coefficient C: This is a core hyperparameter in SVM, directly determining the model's tolerance for classification errors in the training data. Specifically, a larger C value strengthens the model's penalty for misclassification, causing the decision boundary to more strictly fit the training samples. However, this can lead to overfitting, where the model performs well on the training set but generalizes poorly on unseen data. Conversely, a smaller C value reduces the penalty, making the model more tolerant of errors, potentially leading to underfitting, where the model fails to fully capture the inherent patterns in the data, resulting in insufficient predictive performance. In practical applications, the value of C is typically within a certain range... .

[0082] The kernel parameter *g* controls the width or range of influence of the kernel function, directly affecting the SVM's mapping ability in high-dimensional spaces. A larger *g* value makes the kernel function more localized, enhancing the model's fitting accuracy to the training data, but also easily leading to overfitting; a smaller *g* value expands the kernel function's coverage, improving the model's smoothness, but may cause underfitting due to neglecting details. The value of *g* is also highly dependent on the data characteristics and needs to be flexibly set through experimental or theoretical analysis. In practical applications, the value of *g* is... .

[0083] These two parameters together constitute the genetic code of individual seagulls in the population, and their interaction determines the overall performance of the SVM model. Through in-depth data research, and considering the real-time prediction needs of drilling accidents, the final value range of the regularization coefficient C is [value missing]. The final range of values ​​for the kernel parameter g is: Finally, the individual is initialized using the following formula, where... express random floating-point numbers, express A random floating-point number. Proceed to step 3.

[0084]

[0085]

[0086]

[0087] Step 3: Calculate the F1 score based on the prediction model. Each individual in the population represents the regularization coefficient C and kernel parameter g of the SVM (Support Vector Machine), that is, each individual represents an SVM prediction model. Based on the prediction model represented by each individual, the latest dataset is traversed one by one, and each data point is input into the model to obtain the prediction result, which is then compared with the true result. This invention uses the commonly used F1 score as the fitness function for evaluation. The F1 score is between [0, 1], and the larger the score, the better the model performance. The calculation formula is as follows. Here, TP is the number of correctly predicted positive class samples, FP is the number of incorrectly predicted positive class samples (actually negative class), and FN is the number of incorrectly predicted negative class samples (actually positive class).

[0088]

[0089]

[0090]

[0091] In summary, using the latest dataset as a benchmark, the prediction model for each individual is iterated through, and the F1 score, i.e., the fitness function value, is calculated. Simultaneously, the best-performing individual at any given time is recorded. Proceed to step 4.

[0092]

[0093] Step 4: Meet the minimum prediction requirement. Iterate through the F1 score of each individual in the population. If an individual's F1 score exceeds the TargetF1 (defined according to requirements, with a value range of [0, 1] and a default value of 0.9), it means that the optimal parameters have been found, and proceed to step 9. Otherwise, it is necessary to continue iterating and proceed to step 5.

[0094] Step 5: Update Environmental Information. This step dynamically calculates environmental parameters to provide a basis for decision-making regarding seagull population migration and foraging behavior. The core objective is to avoid individual collisions and balance the algorithm's global-local search capabilities. Specifically, this involves calculating two environmental parameters: the proportion of seagull position changes. And balancing global-local search random numbers .

[0095] seagull's position change ratio This randomization of migration direction and distance prevents seagulls from overlapping (colliding) during migration, ensuring population diversity. Its calculation is based on an iterative process that adaptively adjusts the random numbers, balancing global and local search. For subsequent attack operations, randomness is injected into the spiral motion to prevent the algorithm from getting trapped in local optima (such as a "death spiral"). Its calculation is achieved using pseudo-random numbers. The formula is as follows:

[0096]

[0097] in This is the control factor for the Seagull optimization algorithm, with a value range of (0, 1]. It is adjusted empirically, with a default value of 0.5. `i` represents the current iteration number (each execution of steps 3 to 8 counts as one iteration), with a value range of [1, MG]. This represents a random number in the range [0, 1]. Proceed to step 6.

[0098] Step 6: Perform migration. Seagull migration involves all individuals flying from one location to another. This step drives the seagull population to update its position, avoiding collisions through random perturbations and migrating in a directional manner to the vicinity of the optimal solution. The migration operation is the core behavior of the inner loop of the seagull optimization algorithm, directly affecting the search efficiency of the SVM (Support Vector Machine) parameters. At the level of an individual seagull, migration first prevents multiple individuals from occupying the same location through random relocation, and then moves towards the optimal individual in the population. Although not all seagulls can reach the optimal position in a single iteration, after multiple iterations, the entire population will converge at that position from different directions. At the same time, the position of the optimal individual may change dynamically, but its fitness continuously decreases, prompting the population to continuously track and fly towards the evolved optimal position, thereby optimizing the global convergence performance.

[0099] With a single seagull Taking migration as an example, the calculation process is as follows: First, individual seagulls migrate randomly. Then, the seagulls move towards the individual with the best population in this iteration. They migrated. Among them, This indicates the location of the seagulls before their unpredictable migration. This indicates the location of seagulls after their unpredictable migration. Let represent the optimal individual in the population during the t-th iteration. All individuals migrate according to the above process, and then the entire seagull population completes its migration.

[0100]

[0101]

[0102]

[0103] The transfer process exhibits significant adaptive characteristics: in the initial stage of iteration ( Smaller), focusing on global exploration of new parameter space; later iterations ( (Gradually increasing in size), focusing on local fine-grained development. This mechanism directly optimizes the search efficiency of the regularization coefficient C and kernel parameter g of the SVM support vector machine, supporting the accurate construction of the drilling accident early warning model. After migration, the attack operation is executed, forming a global-local collaborative optimization closed loop. Proceed to step 7.

[0104] Step 7: Execute the attack operation. The attack behavior of the seagull population simulates the dynamic spiral movement pattern of seagulls hunting in nature. This operation is initiated after migration is completed, and the core objective is to approximate the optimal solution through a spiral trajectory in three-dimensional space, achieving a fine search in the parameter space. Its mathematical model adopts a parameterized spiral equation, where the radius controls the spiral scale, the angle parameter determines the direction of movement, and u and v constitute a three-dimensional coordinate basis vector. This design can dynamically adjust the attack angle and speed, allowing individuals to continuously optimize their position along the migration path. However, spiral motion has inherent limitations: when the algorithm gets stuck in a local optimum, the spiral radius may continue to shrink, causing the population to oscillate near non-global optima (i.e., the 'death spiral' phenomenon), which severely restricts the algorithm's global convergence ability.

[0105] With a single seagull Taking hunting as an example, the calculation process is as follows: Represents the radius of the spiral motion. The three-dimensional coordinates represent the helical motion. It is a random value between [0, 1], and it is a random step-size flight referenced to Levi's flight. Therefore... It is not entirely based on the radius of the spiral motion. It was determined that. This indicates the seagull's location after completing its hunt. In the formula below, and These are parameters related to helical motion, with a value range of (0, 1]. They are adjusted based on experience, and the default value is 0.5, which is a constant.

[0106]

[0107]

[0108]

[0109]

[0110]

[0111] All individuals hunt according to the above process, and then the entire gull population completes the hunt. Each gull flies from one location to another towards the optimal individual, thus updating the gull population's location. Proceed to step 8.

[0112] Step 8: Exceeding the maximum number of iterations. Steps 3 to 8 belong to the inner loop of the Seagull Algorithm's optimization. Each execution increments the iteration count by 1. If the current iteration count exceeds the maximum number of iterations MG, proceed to step 9; otherwise, continue iterating and return to step 3. The maximum iteration parameter MG is defined according to requirements, with a default value of 12.

[0113] Step 9: Find the optimal parameter vector. Reaching this step indicates that the inner loop of the Seagull Algorithm has been completed, meaning the optimal parameters have been found. Proceed to step 10.

[0114]

[0115] Step 10: Update the SVM (Support Vector Machine). The optimal parameters were obtained in Step 9. That is, the regularization coefficient C and the kernel parameter g have been adjusted to the optimal values. The SVM support vector machine model for real-time data-driven drilling accident prediction is ready. Proceed to step 12.

[0116] Step 11: Obtain Real-Time Data. Real-time data here refers to data obtained from on-site drilling reports, mud reports, and completion reports, or from the on-site monitoring system; it represents real-time operational data from the front lines. Each set of data includes multiple features 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 rate, outlet flow rate, and pump displacement. This data can be manually recorded as needed or automatically generated by the monitoring system. Based on this data, it is input into the drilling accident prediction SVM support vector machine model to perform on-site drilling accident prediction.

[0117] This invention uses F1 score to evaluate the prediction model, which requires a certain amount of real-time data, generally more than 1,000 data points, before the prediction model is used to calculate the F1 score. If the amount of data is too small, it is easy to produce a large error. Therefore, this step will only proceed to step 12 after a certain amount of data has been obtained.

[0118] Step 12: Calculate the F1 score based on SVM (Support Vector Machine). Based on the optimal SVM model built in Step 10, iterate through the acquired real-time data, inputting each data point into the model to obtain the prediction result, which is then compared with the actual situation. Here, the F1 score is also used as the fitness function for evaluation, calculated in the same way as in Step 3, thus obtaining the F1 score based on real-time data. Proceed to Step 13.

[0119] Step 13: Add real-time data to the dataset. This step involves adding the acquired real-time data to the dataset, thereby updating the entire dataset. If the prediction is correct, the real-time data is directly added to the dataset, i.e., the dataset is updated. If the prediction is incorrect, the result is corrected, and then the real-time data is added to the dataset, i.e., the dataset is updated. Proceed to Step 14.

[0120] Step 14: Update the iteration count. Based on the F1 score calculated in Step 12, if the F1 score exceeds TargetF1, it indicates that the current prediction model meets expectations. If the score is lower than TargetF1, the failure count (Delt) is incremented by one, as shown in the following formula:

[0121] Step 15: Update the prediction model. If the number of failures (Delt) exceeds MaxDelt, the SVM (Support Vector Machine) needs to be updated; proceed to Step 16. Otherwise, the current model can continue to be used; proceed to Step 11.

[0122] Step 16: Reset all parameters. Reset the Seagull Algorithm parameters, the number of failures (Delt), and the SVM (Support Vector Machine) related parameters. That is, the entire search process restarts and proceeds to Step 2.

[0123] In summary, steps 3 to 8 constitute the inner loop of the Seagull Algorithm, searching for the optimal parameters and iteratively updating to obtain the optimal SVM (Support Vector Machine) prediction model. Steps 2 to 16 constitute the outer loop of adjusting the network topology, searching for the optimal SVM prediction model by trying different network topologies. Steps 11 to 15 constitute the outer loop of real-time data prediction. Based on real-time operational data, an SVM prediction model is developed for drilling accident prediction, predicting whether accidents such as lost circulation, well kick, and blowout will occur. These two processes are independent and do not affect each other. When the SVM prediction model iteration update is not complete, the prediction model uses the previous version; when the iteration update is complete, a prediction model version update is triggered. During the version update, drilling accident prediction is temporarily suspended, and after the update, the latest version of the model is used.

[0124] In summary, this invention proposes a drilling hazard early warning method based on machine learning. It uses the Seagull Algorithm to find the optimal parameters of the SVM (Support Vector Machine), thereby obtaining a drilling hazard prediction model. Compared with existing technologies, this invention has at least the following beneficial effects: 1) A drilling accident prediction method based on SVM (Support Vector Machine) is proposed, which significantly enhances the intelligence level of accident early warning.

[0125] 2) An improved Seagull algorithm-based method for searching the optimal parameters of SVM (Support Vector Machine) was proposed, which automates the network parameter tuning process and improves the accuracy of early warning.

[0126] 3) Integrating on-site operation data to verify the prediction effectiveness and accelerate the iterative upgrade of the SVM support vector machine prediction model, thereby ensuring the real-time update and rapid prediction capability of the drilling accident prediction model.

[0127] like Figure 4 As shown, this embodiment of the invention also provides a drilling hazard early warning device 900 based on machine learning, which can implement the above-mentioned method. This device may include: The first module 901 is used to acquire a dataset and initialize the seagull population; wherein, each set of data in the dataset includes the drilling hazard type associated with the feature variables of the data record, and each individual in the seagull population includes a set of hyperparameters of a support vector machine; The second module 902 is used to quantify the hyperparameters of each individual based on the dataset and the seagull population, and apply them to the F1 score of the support vector machine as the first score. The third module 903 is used to update the seagull population through the seagull optimization algorithm if no first score satisfies the score condition, and then return to execute the operation of the second module until a first score satisfies the score condition, and obtain the target prediction model according to the corresponding individual configuration support vector machine. The fourth module 904 is used to continuously collect real-time data, input the real-time feature vector corresponding to the real-time data into the target prediction model to predict drilling risks and obtain the predicted risk type. The fifth module 905 is used to obtain the actual risk type corresponding to the real-time data if the amount of real-time data reaches the preset requirement, and to obtain the F1 score of the target prediction model as the second score by combining the predicted risk type with the quantitative analysis. Module 6, 906, is used to increment the failure count by 1 if the second score is lower than the score threshold, return to execute the operation of Module 4, until the failure count exceeds the failure threshold, associate the real-time feature vector with the actual danger type and incorporate it into the dataset, reset the failure count, return to execute the operation of initializing the seagull population in Module 1, and continuously update the target prediction model.

[0128] It is understood that the content of the above method embodiments is applicable to the present device embodiments. The specific functions 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.

[0129] This invention also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described above. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0130] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment 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.

[0131] like Figure 5 As shown, Figure 5The hardware structure of an electronic device 1000 according to another embodiment is illustrated. The electronic device 1000 includes: The processor 1001 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, 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. The memory 1002 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RaM). The memory 1002 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001. Input / output interface 1003 is used to implement information input and output; The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004); The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.

[0132] The electronic device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0133] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.

[0134] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.

[0135] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0136] It is understood that the content of the above method embodiments is applicable to the embodiments of this program product. The specific functions implemented by the embodiments of this program product 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.

[0137] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0138] The drilling hazard early warning method, device, electronic device, storage medium, and program product based on machine learning provided in this invention initialize a seagull population by acquiring a dataset. Each data set in the dataset includes a drilling hazard type associated with the feature variables of the data records, and each individual seagull in the population includes a set of hyperparameters for a support vector machine. Based on the dataset and the seagull population, the F1 score of each individual's hyperparameters applied to the support vector machine is quantized and used as a first score. If no first score satisfies the score condition, the seagull population is updated using the seagull optimization algorithm, and the process returns to the step of quantizing the hyperparameters of each individual based on the dataset and the seagull population and applying them to the support vector machine as the first score, until a first score is found. If a score meets the score condition, a target prediction model is obtained based on the corresponding individual configuration support vector machine. Real-time data is continuously collected, and the real-time feature vectors corresponding to the real-time data are input into the target prediction model to predict drilling risks and obtain the predicted risk type. If the amount of real-time data reaches the preset requirement, the actual risk type corresponding to the real-time data is obtained, and the F1 score of the target prediction model is obtained by combining the predicted risk type as a second score. If the second score is lower than the score threshold, the failure count is incremented by 1, and the process returns to the step of continuously collecting real-time data until the failure count exceeds the failure threshold. At this point, the real-time feature vectors are associated with the actual risk type and merged into the dataset, the failure count is reset, and the process returns to the step of initializing the seagull population, continuously updating the target prediction model. This invention constructs a high-precision drilling hazard prediction model by introducing the Seagull optimization algorithm to automatically optimize the hyperparameters of the support vector machine. This model enables objective quantitative analysis of drilling conditions, effectively eliminating reliance on expert subjective experience and significantly improving the accuracy and response speed of early warnings. Furthermore, this invention continuously monitors and evaluates model performance based on real-time data collection, and automatically triggers iterative updates using new data when model accuracy declines, forming a closed-loop mechanism of "collection-prediction-feedback-optimization." Specifically, this invention not only overcomes the limitations of personal experience in dissemination and replication but also achieves adaptive adaptation to changes in drilling conditions, ensuring the early warning model maintains optimal performance over the long term. It effectively reduces the difficulty of analyzing massive amounts of high-dimensional data, providing reliable technical support for the safe and efficient operation of drilling projects.

[0139] The embodiments described in this invention are for the purpose of more clearly illustrating the technical solutions of the embodiments of this invention, and do not constitute a limitation on the technical solutions provided by the embodiments of this invention. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this invention are also applicable to similar technical problems.

[0140] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present invention, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0141] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0142] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0143] The preferred embodiments of the present invention have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and spirit of the present invention should be within the scope of the claims of the present invention.

Claims

1. A drilling hazard early warning method based on machine learning, characterized in that, The method includes the following steps: Obtain a dataset and initialize a seagull population; wherein, each set of data in the dataset includes drilling hazard types associated with feature variables of the data records, and each individual in the seagull population includes a set of hyperparameters of a support vector machine; Based on the dataset and the seagull population, the hyperparameters of each individual are quantified and applied to the F1 score of the support vector machine as the first score; If no first score satisfies the score condition, the seagull population is updated using the seagull optimization algorithm. The process of applying the hyperparameters of each individual to the support vector machine as the first score, based on the dataset and the seagull population, is repeated until a first score satisfies the score condition. The support vector machine is then configured according to the corresponding individual to obtain the target prediction model. Continuously collect real-time data, input the real-time feature vector corresponding to the real-time data into the target prediction model to predict drilling risks and obtain the predicted risk type; If the amount of real-time data reaches the preset requirement, the actual risk type corresponding to the real-time data is obtained, and the F1 score of the target prediction model is obtained by combining the predicted risk type as a second score. If the second score is lower than the score threshold, the failure count is incremented by 1, and the process returns to the step of continuously collecting real-time data until the failure count exceeds the failure threshold. Then, the real-time feature vector is associated with the actual danger type and incorporated into the dataset. The failure count is reset, and the process returns to the step of initializing the seagull population, continuously updating the target prediction model.

2. The method according to claim 1, characterized in that, The hyperparameters include regularization coefficients and kernel parameters. The initialization of the seagull population includes the following steps: Initialize the number of individuals to 0; The regularization coefficient is generated based on random numbers within a first value range; The kernel parameters are generated based on random numbers within the second value range; The regularization coefficient and the kernel parameter are combined into a single entity; Increment the number of individuals by 1, return to the step of generating the regularization coefficient based on the first value range of random numbers, until the number of individuals reaches the preset total number of individuals, and summarize all the individuals to complete the initialization of the seagull population.

3. The method according to claim 1, characterized in that, The process of quantifying the hyperparameters of each individual based on the dataset and the seagull population, and applying them to the F1 score of the support vector machine as the first score, includes the following steps: The first individual in the seagull population is selected as the candidate individual; The hyperparameters of the candidate individuals are applied to the support vector machine to obtain a candidate prediction model; Use the first set of data in the dataset as the prediction sample; The feature variables of the predicted sample are input into the candidate prediction model, and the sample prediction type is obtained by processing the data through the candidate prediction model. The next set of data in the dataset is used as the predicted sample, and the process of inputting the feature variables of the predicted sample into the candidate prediction model is repeated until all data in the dataset has been traversed. Based on the comparison results between the sample prediction type and the drilling hazard type corresponding to each group of data in the dataset, the number of prediction samples of each type is statistically obtained, and the F1 score corresponding to the candidate individual is obtained as the first score based on the quantification of the prediction samples. The next individual in the seagull population is taken as the candidate individual, and the process of applying the hyperparameters of the candidate individual to the support vector machine is repeated until the first score of each individual in the seagull population is obtained.

4. The method according to claim 1, characterized in that, The process of updating the seagull population using the seagull optimization algorithm includes the following steps: The individual with the highest first score is taken as the migrating individual, and the environmental information is updated based on the number of updates of the seagull population; Based on the migrating individuals and the environmental information, a migration operation is performed on each individual in the seagull population, and then a hunting operation is performed through a spiral motion with a random step size to update the seagull population, and the update count is incremented by 1.

5. The method according to claim 4, characterized in that, The environmental information includes the location change ratio and the balance search random number. The seagull population update configuration has an upper limit on the number of updates. Updating the environmental information based on the number of updates of the seagull population includes the following steps: The update progress value is determined based on the ratio of the current update count to the upper limit of the update count, and the position change ratio is determined by multiplying the complementary value of the update progress value to 1 with a preset control factor. The random number within the preset range is multiplied by the square of the position change ratio, and then the balance search random number is determined by multiplication.

6. The method according to claim 4, characterized in that, The environmental information includes the location change ratio and the balance search random number. Based on the migrating individuals and the environmental information, the migration operation is performed on each individual in the seagull population, and then hunting operations are conducted through a spiral motion with random step sizes to update the seagull population. This includes the following steps: Based on the product of the location change ratio and the individual, each individual in the seagull population undergoes undirected migration to obtain the first individual corresponding to each individual; Multiply the sum of the first individual and the migrating individuals by the balance search random number, and then perform directional migration through absolute value operation to obtain the second individual corresponding to each individual; The product of the balance search random number and the first spiral motion parameter is used as the exponent of the natural constant for exponential operation. The result of the exponential operation is multiplied by the second spiral motion parameter to obtain the spiral motion radius. Based on the spiral motion radius, the three-dimensional coordinates of the spiral motion are constructed by combining trigonometric functions with the random step size flight of Levy's flight. Multiply the three-dimensional coordinates of the spiral motion, the second individual, and the migrating individual to obtain the completed hunting individual corresponding to each individual, thereby updating the seagull population.

7. The method according to claim 1, characterized in that, The process of obtaining a target prediction model by configuring the support vector machine according to the corresponding individual until a first score satisfies the score condition includes the following steps: If the first score exceeds the score threshold, the hyperparameters of the corresponding individual are applied to the support vector machine to obtain the target prediction model; If no first score exceeds the score threshold, and the number of updates for the seagull population reaches the preset update limit, the individual with the largest first score in the seagull population obtained from the last update is taken as the configuration individual, and the hyperparameters of the configuration individual are applied to the support vector machine to configure the target prediction model.

8. A drilling hazard early warning device based on machine learning, characterized in that, The device includes: The first module is used to acquire a dataset and initialize a seagull population; wherein, each set of data in the dataset includes drilling hazard types associated with feature variables of the data records, and each individual in the seagull population includes a set of hyperparameters of a support vector machine; The second module is used to quantify the hyperparameters of each individual and apply them to the support vector machine to obtain the F1 score as the first score, based on the dataset and the seagull population. The third module is used to update the seagull population through the seagull optimization algorithm if no first score satisfies the score condition, and then return to execute the operation of the second module until a first score satisfies the score condition, and then configure the support vector machine according to the corresponding individual to obtain the target prediction model. The fourth module is used to continuously collect real-time data, input the real-time feature vector corresponding to the real-time data into the target prediction model to predict drilling risks and obtain the predicted risk type. The fifth module is used to obtain the actual risk type corresponding to the real-time data if the amount of real-time data reaches a preset requirement, and to obtain the F1 score of the target prediction model as the second score by combining the predicted risk type with the actual risk type. The sixth module is used to increment the failure count by 1 if the second score is lower than the score threshold, return to execute the operation of the fourth module, until the failure count exceeds the failure threshold, associate the real-time feature vector with the actual danger type and incorporate it into the data set, reset the failure count, return to execute the operation of initializing the seagull population in the first module, and continuously update the target prediction model.

9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the method according to any one of claims 1 to 7.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 7.