Stratum temperature and pressure machine learning analysis method based on sparrow search algorithm optimization
The formation temperature and pressure machine learning analysis method optimized by the sparrow search algorithm solves the problems of high cost, poor timeliness and weak generalization ability in the existing technology, and realizes efficient and reliable formation temperature and pressure prediction, supporting real-time drilling decision-making and reservoir evaluation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-10
- Publication Date
- 2026-03-13
AI Technical Summary
Existing methods for obtaining formation temperature and pressure are costly, have poor timeliness, and lack generalization ability, making it difficult to guarantee analytical accuracy.
A machine learning analysis method for formation temperature and pressure optimized by the sparrow search algorithm is proposed. By analyzing the scatter plot matrix and correlation heat map of well logging data, a machine learning model for rapidly calculating formation temperature and pressure is established, and the model parameters are optimized using the sparrow search algorithm.
A complete analysis process was constructed, including data correlation analysis, multi-model training, SSA optimization, and performance comparison screening, to ensure that the model has strong generalization ability and can be reliably applied to new well section data, providing tools for real-time drilling decision-making and reservoir evaluation.
Smart Images

Figure CN121661379A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of formation temperature and pressure analysis technology, and specifically to a formation temperature and pressure machine learning analysis method based on the Sparrow Search algorithm. Background Technology
[0002] Formation temperature and formation pressure are two of the most critical parameters in oil and gas reservoir evaluation, drilling engineering design, and production dynamic analysis. Existing methods for obtaining formation temperature and pressure, such as drill pipe testing (DST) and measurement while drilling (MWD), while direct and reliable, are costly, have poor timeliness, and struggle to obtain continuous full-section profiles. Calculation methods based on well logging data (such as calculating formation pressure using sonic transit time) largely rely on empirical formulas and regional prior knowledge, lacking generalization ability and accuracy under complex geological conditions.
[0003] Therefore, existing technologies for analyzing temperature and pressure have drawbacks such as high cost, poor timeliness, and weak generalization ability, making it difficult to guarantee analytical accuracy. Summary of the Invention
[0004] The purpose of this invention is to provide a formation temperature and pressure machine learning analysis method based on the sparrow search algorithm optimization, so as to solve the technical problems of high cost, poor timeliness and weak generalization ability in the existing technology.
[0005] To solve the above-mentioned technical problems, the present invention specifically provides the following technical solution:
[0006] A formation temperature and pressure machine learning analysis method based on the sparrow search algorithm optimization is characterized by the following steps:
[0007] Acquire well logging curves, formation temperature data, and formation pressure data;
[0008] By analyzing the scatter plot matrix and correlation heat map of well logging data, the correlation between well logging curves and formation temperature and formation pore pressure was determined.
[0009] Based on the aforementioned correlation, a machine learning model for rapidly calculating formation temperature is established using well logging curves and formation temperature data to obtain a formation temperature prediction model. The sparrow search algorithm is then used to optimize the parameters of the formation temperature prediction model.
[0010] Based on the aforementioned correlation, a learning model for rapidly calculating formation pressure is established using well logging curves and formation pressure data, resulting in a formation pressure prediction model. The sparrow search algorithm is then used to optimize the parameters of the formation pressure prediction model.
[0011] As a preferred embodiment of the present invention, the logging curves include natural gamma ray (GR), spontaneous potential (SP), acoustic transit time (AC), density (DEN), and resistivity (RT) logging data.
[0012] As a preferred embodiment of the present invention, the method for obtaining the well logging data scatter plot matrix includes:
[0013] The parameters are paired up in pairs from natural gamma ray (GR) logging data, spontaneous potential (SP) logging data, sonic transit time (AC) logging data, density (DEN) logging data, resistivity (RT) logging data, formation temperature data, and formation pressure data.
[0014] Plot scatter plots between pairs of parameters, and organize all scatter plots into a matrix to obtain the well logging data scatter plot matrix.
[0015] As a preferred embodiment of the present invention, the method for obtaining the correlation heatmap includes:
[0016] The parameters are paired up in pairs from natural gamma ray (GR) logging data, spontaneous potential (SP) logging data, sonic transit time (AC) logging data, density (DEN) logging data, resistivity (RT) logging data, formation temperature data, and formation pressure data.
[0017] Calculate the Pearson correlation coefficients between each pair of paired parameters, organize all Pearson correlation coefficients into a matrix, and display the magnitude of the correlation coefficients using color mapping to obtain a correlation heatmap.
[0018] As a preferred embodiment of the present invention, the correlation between the logging curve and formation temperature and formation pore pressure includes:
[0019] The logging curves for sonic transit time, density, spontaneous gamma, and spontaneous potential are positively correlated with formation temperature and pressure. Spontaneous potential has the highest correlation with temperature and pressure, while resistivity has a negative correlation.
[0020] As a preferred embodiment of the present invention, the method for establishing a machine learning model for rapidly calculating formation temperature includes:
[0021] The logging curves and formation temperature data were divided into a first training set, a first test set, and a first prediction set according to a ratio of 0.8, 0.1, and 0.1, respectively.
[0022] In the first training set, support vector machine (SVM), random forest (RF), and neural network (DNN) models were trained to obtain SVM, RF, and DNN models for quickly calculating formation temperature.
[0023] As a preferred embodiment of the present invention, the method for establishing a machine learning model for rapidly calculating formation pressure includes:
[0024] Well logging curves and formation temperature data were divided into a second training set, a second test set, and a second prediction set according to ratios of 0.8, 0.1, and 0.1.
[0025] In the second training set, support vector machine (SVM), random forest (RF), and neural network (DNN) models were trained to obtain SVM, RF, and DNN models for quickly calculating formation pressure.
[0026] As a preferred embodiment of the present invention, the algorithm flow of the sparrow search algorithm includes:
[0027] Step 1: Establish a population X consisting of n sparrows. The expression for population X is:
[0028] ;
[0029] Where d is the number of hyperparameters to be optimized. Let n be the position of the nth sparrow in dimension d;
[0030] Step 2: Set fitness value The fitness value represents an individual sparrow's ability to find food. The expression is:
[0031] ;
[0032] in, For the fitness function, Let be the fitness value of the nth sparrow. Let n be the position vector of the nth sparrow;
[0033] Step 3: Based on population X and fitness value The location update formula for the discoverer is set as follows:
[0034] ;
[0035] in, For the number of iterations, The maximum number of iterations, , They were respectively in the second sequence During the nth iteration, the 1st The sparrow that was the discoverer was in the first The position of the dimension It is a random number in [0,1]. This is the warning value, and its range is [0,1]. The safe value is [0.5, 1], Q is a random number that follows a normal distribution, and L is a 1×d matrix with all elements being 1;
[0036] Step 4: Based on population X and fitness value The location update formula for discoverers is set as follows:
[0037] ;
[0038] in, In the first In the next iteration, the sparrow, as the discoverer, is in the best position. Let A be the worst possible position for the sparrow that discovers the sparrow, and let A be a 1×d matrix where each element is randomly assigned a value of 1 or -1. ;
[0039] Step 5: Set the number of scout sparrows to 10% to 20% of the total population. Their initial positions are randomly generated within the population. The behavioral expression for scout alerts is:
[0040] ;
[0041] in, Let t be the current globally optimal sparrow position in the t-th iteration, β be a control parameter, a random number following a standard normal distribution, K be a uniform random number with a value range of [-1, 1], and ε be a small constant to avoid the denominator being zero; The fitness value of the sparrow acting as a scout. The sparrow in the best position in the whole game fitness value, Sparrow in the worst position globally The fitness value.
[0042] As a preferred embodiment of the present invention, the method for optimizing formation temperature prediction model parameters using the sparrow search algorithm includes:
[0043] The SVM, RF, and DNN models for rapidly calculating formation temperature are coupled into the Sparrow Search Algorithm (SSA). The population size is set to 30, the maximum number of iterations is 30, and the hyperparameters of the SVM model are set as follows: penalty parameter c∈[0.01,30], RBF kernel function parameter gamma∈[0.01, 100]. The hyperparameters of the RF model are set as follows: number of decision trees n_estimators∈[1, 100], number of randomly selected features in each decision tree max_features∈[1, 5]. The hyperparameters of the DNN model are set as follows: learning rate η∈[0.001 0.01], maximum number of iterations Epoch∈[10, 100], number of neurons in the three hidden layers of the neural network num∈[1, 100], and batch size is [1, 100].
[0044] In the first test set, the hyperparameters of SVM, RF, and DNN models were iteratively optimized using the Sparrow Search Algorithm (SSA). The optimal hyperparameter values for the SVM model were determined as follows: c = 30, gamma = 1.0833601483892072. The optimal hyperparameter values for the RF model were: n_estimators = 3, max_features = 1. The optimal hyperparameter values for the DNN model were: learning rate = 0.0070915492375424735, number of iterations = 45, batch size = 10, number of neurons in the first hidden layer = 24, number of neurons in the second hidden layer = 54, and number of neurons in the third hidden layer = 18.
[0045] By setting the SVM model, RF model and DNN model through the optimal solution of hyperparameters, we obtain the SSA-SVM model, SSA-RF model and SSA-DNN model for fast formation temperature calculation.
[0046] The performance of the SSA-SVM model, SSA-RF model, and SSA-DNN model was evaluated using the first prediction set, and the SSA-RF model, which can quickly calculate formation temperature, was determined as the formation temperature prediction model.
[0047] As a preferred embodiment of the present invention, the method for optimizing formation pressure prediction model parameters using the sparrow search algorithm includes:
[0048] The SVM, RF, and DNN models for rapidly calculating formation pressure are coupled into the Sparrow Search Algorithm (SSA). The population size is set to 30, the maximum number of iterations is 30, and the hyperparameters of the SVM model are set as follows: penalty parameter c∈[0.01,30], RBF kernel function parameter gamma∈[0.01, 100]. The hyperparameters of the RF model are set as follows: number of decision trees n_estimators∈[1, 100], number of randomly selected features in each decision tree max_features∈[1, 5]. The hyperparameters of the DNN model are set as follows: learning rate η∈[0.001 0.01], maximum number of iterations Epoch∈[10, 100], number of neurons in the three hidden layers of the neural network num∈[1, 100], and batch size is [1, 100].
[0049] In the second test set, the hyperparameters of SVM, RF, and DNN models were iteratively optimized using the Sparrow Search Algorithm (SSA). The optimal hyperparameter values for the SVM model were determined as follows: c = 30, gamma = 0.635358571651844. The optimal hyperparameter values for the RF model were: n_estimators = 4, max_features = 2. The optimal hyperparameter values for the DNN model were: learning rate = 0.00912545405185615, number of iterations = 78, batch size = 13, number of neurons in the first hidden layer = 53, number of neurons in the second hidden layer = 37, and number of neurons in the third hidden layer = 85.
[0050] By setting the SVM model, RF model and DNN model through the hyperparameter optimal solution, the SSA-SVM model, SSA-RF model and SSA-DNN model for fast formation pressure calculation are obtained.
[0051] The performance of the SSA-SVM model, SSA-RF model, and SSA-DNN model was evaluated using the second prediction set, and the SSA-DNN model, which can quickly calculate formation pressure, was determined as the formation pressure prediction model.
[0052] Compared with the prior art, the present invention has the following advantages:
[0053] This invention constructs a complete analysis process that includes data correlation analysis, multi-model training, SSA optimization, and performance comparison screening. Through final evaluation on the first and second prediction sets, it ensures that the selected optimal model has strong generalization ability and can be reliably applied to new and unseen well section data, providing a powerful tool for real-time drilling decision-making and reservoir evaluation. Attached Figure Description
[0054] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.
[0055] Figure 1 A flowchart of a formation temperature and pressure machine learning analysis method based on a sparrow search algorithm optimized according to an embodiment of the present invention;
[0056] Figure 2 The logging curves, formation temperature data, and formation pressure data diagrams provided in this embodiment of the invention;
[0057] Figure 3This invention provides a scatter plot matrix and correlation heatmap of well logging data in embodiments of the invention.
[0058] Figure 4 A comparison chart of the formation pressure model prediction performance provided in the embodiments of the present invention;
[0059] Figure 5 The contribution of characteristic parameters in the formation pressure model provided in the embodiments of the present invention;
[0060] Figure 6 A comparison chart of the formation temperature model prediction performance provided in the embodiments of the present invention;
[0061] Figure 7 The contribution of characteristic parameters in the formation temperature model provided in the embodiments of the present invention. Detailed Implementation
[0062] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0063] like Figure 1 As shown, this invention provides a formation temperature and pressure machine learning analysis method based on the sparrow search algorithm, comprising the following steps:
[0064] Acquire well logging curves, formation temperature data, and formation pressure data;
[0065] By analyzing the scatter plot matrix and correlation heat map of well logging data, the correlation between well logging curves and formation temperature and formation pore pressure was determined.
[0066] Based on the correlation, a machine learning model for rapidly calculating formation temperature is established using well logging curves and formation temperature data to obtain a formation temperature prediction model. The sparrow search algorithm is then used to optimize the parameters of the formation temperature prediction model.
[0067] Based on the correlation, a learning model for rapidly calculating formation pressure is established using well logging curves and formation pressure data, resulting in a formation pressure prediction model. The sparrow search algorithm is then used to optimize the parameters of the formation pressure prediction model.
[0068] The logging curves include natural gamma ray (GR), spontaneous potential (SP), sonic transit time (AC), density (DEN), and resistivity (RT) logging data.
[0069] Methods for obtaining scatter plot matrices of well logging data include:
[0070] The parameters are paired up in pairs from natural gamma ray (GR) logging data, spontaneous potential (SP) logging data, sonic transit time (AC) logging data, density (DEN) logging data, resistivity (RT) logging data, formation temperature data, and formation pressure data.
[0071] Plot scatter plots between pairs of parameters, and organize all scatter plots into a matrix to obtain the well logging data scatter plot matrix.
[0072] Methods for obtaining correlation heatmaps include:
[0073] Pairing parameters in natural gamma ray (GR) logging data, spontaneous potential (SP) logging data, sonic transit time (AC) logging data, density (DEN) logging data, resistivity (RT) logging data, formation temperature data, and formation pressure data.
[0074] Calculate the Pearson correlation coefficients between each pair of paired parameters, organize all Pearson correlation coefficients into a matrix, and display the magnitude of the correlation coefficients using color mapping to obtain a correlation heatmap.
[0075] The correlations between well logging curves and formation temperature and formation pore pressure include:
[0076] The logging curves for sonic transit time, density, spontaneous gamma, and spontaneous potential are positively correlated with formation temperature and pressure. Spontaneous potential has the highest correlation with temperature and pressure, while resistivity has a negative correlation.
[0077] This invention collects GR, SP, AC, DEN, and RT curves from well DK-9, along with corresponding measured formation temperature and pressure data. It then plots scatter plot matrices and correlation coefficient heatmaps for all variables. The scatter plot matrix visually reveals the nonlinear relationships and data distribution among the variables, while the heatmaps quantify the strength of their linear correlations. This provides data-driven decision support for selecting key input features, avoiding the blind selection of features. Specifically, it clarifies the rule that "sonic transit time, density, etc., are positively correlated with temperature and pressure, while resistivity is negatively correlated." This not only provides a scientific basis for selecting input features for machine learning models but also makes the model's predictions interpretable.
[0078] Methods for establishing machine learning models for rapidly calculating formation temperature include:
[0079] The logging curves and formation temperature data were divided into a first training set, a first test set, and a first prediction set according to a ratio of 0.8, 0.1, and 0.1, respectively.
[0080] In the first training set, support vector machine (SVM), random forest (RF), and neural network (DNN) models were trained to obtain SVM, RF, and DNN models for quickly calculating formation temperature.
[0081] Methods for establishing machine learning models for quickly calculating formation pressure include:
[0082] Well logging curves and formation temperature data were divided into a second training set, a second test set, and a second prediction set according to ratios of 0.8, 0.1, and 0.1.
[0083] In the second training set, support vector machine (SVM), random forest (RF), and neural network (DNN) models were trained to obtain SVM, RF, and DNN models for quickly calculating formation pressure.
[0084] Among them, the kernel functions of Support Vector Machines (SVM) mainly fall into three categories: polynomial kernel functions, radial basis functions (RBF), and sigmoid functions. This invention uses the radial basis function (RBF), whose expression is: .
[0085] The core approach of using SVM to solve problems encountered in regression fitting has shifted from finding the optimal plane to finding an optimal surface that minimizes the error between all original data and the target classification surface.
[0086] Generally, we assume the dataset contains l training samples. ,in , , This is the corresponding output value.
[0087] Let the regression polynomial established in the new space be: ;
[0088] in, Let ε be a linear loss function in a multinomial nonlinear function mapping expression. ;
[0089] Where f(x) is the predicted value of the objective function; y is the true value. This means that if the difference between the objective expression f(x) and the true value y is less than or equal to ε, then the value of the loss function is equal to 0.
[0090] Slack variables were introduced The mathematical expression for SVM is:
[0091] ;
[0092] Where C is the penalty value, the larger C is, the larger the penalty function is for samples with training error greater than ε, and ε represents the upper limit of the error of the objective function. The smaller ε is, the smaller the error of the objective function.
[0093] Use the Largerange function to solve for the dual form of the above equation:
[0094] ;
[0095] in, This is the kernel function.
[0096] Let the optimal solution obtained by the above equation be Then we can obtain the expressions for w* and b*. Therefore, the regression function is: .
[0097] Random Forest (RF), proposed by Leo Breiman in 2001, is an improvement on Bagging and consists of a large number of decision trees. RF can meet the needs of classification and regression. For classification, voting determines the prediction result of each decision tree, and the class with the most votes is selected. For regression, the mean of all decision trees is selected as the prediction result.
[0098] The RF regression model can be mathematically interpreted as follows: Given a specific dataset, X is the independent variable (input data), and Y is the dependent variable to be predicted (output data). Assuming that the distributions of (X,Y) are independent, a training set is randomly generated from (X,Y), and the prediction result is denoted as g(X). Then, its mean squared generalization error is expressed as: ;
[0099] Assuming there are h decision trees, what is the predicted value of h decision trees? The average value is the prediction result of random forest regression. If Then the following formula holds true: ;
[0100] In the above formula The generalization error is represented by PE. ** When h is infinitely large, the average generalization error of a single decision tree is denoted as PE. * PE * satisfy: ;
[0101] The above equation satisfies: ;
[0102] in This represents the weighted correlation coefficient between the residuals. The final regression function for the randomization function is: ;
[0103] The construction steps or process of this algorithm are as follows:
[0104] Step 1: Use the Bootstrap resampling method to randomly select n samples with replacement from the dataset, repeating this sampling K times to obtain K training sample sets, which are independent and identically distributed. Simultaneously, the samples not selected in the K samplings are grouped into K out-of-bag (OOB) data sets, becoming the K test sample sets.
[0105] Step 2: Construct a decision tree using the K training samples extracted in Step 1. A random subspace method is used to select the node feature variables of the decision tree; that is, when a sample has n features, m features are randomly selected from each node of the decision tree. Then, the information values contained in these features are calculated, and the most representative feature and its corresponding value are selected from the m features for node splitting.
[0106] Step 3: Each tree will grow to its maximum extent until the number of samples in a node is less than the originally set threshold or the minimum mean square error is less than the set threshold, at which point the decision tree terminates.
[0107] Step 4: Based on the above steps, K decision trees were obtained. Combining these K decision trees can construct a random forest regression model. Then, inputting the data will yield... ,Will average As a prediction result of the random forest regression model.
[0108] After generating pre-pruned decision trees, feature importance can be obtained using the Gini index of each decision tree in the random forest. Let G be the Gini index, and if dataset A has M classes in a classification problem, the probability that a subset belongs to the Mth class is... Then the Gini index is: ;
[0109] In a decision tree, the change in the Gini index before and after pruning a certain internal node is denoted as V. Suppose that after pruning, two new nodes appear, and the Gini indexes of these two new nodes are denoted as . Then we have the following formula: ;
[0110] Let feature N be in the decision tree. Let S be the set of nodes that appear in the decision tree. Then, the feature N in the decision tree... The importance of is recorded as follows: ;
[0111] If there are K decision trees in a random forest, then the Gini score of feature N in the random forest algorithm is: ;
[0112] Finally, after normalizing the Gini indices obtained from different features, the importance ranking of the different features is obtained by sorting them.
[0113] Neural networks are products derived from the analysis, abstraction, and imitation of the operation of biological neural networks. They are network structures that connect a large number of individual neurons according to certain rules, forming a network capable of processing information in parallel. They belong to a type of intelligent mathematical operation model. This model was first proposed by an American psychologist who analyzed the characteristics of biological neurons and, after combining them with mathematical theory, proposed the first mathematical model of an artificial neuron.
[0114] A neural network consists of a large number of processing units called neurons (corresponding to nerve cells in the human brain). The function of a neuron is to calculate the inner product of the input vector and the weight vector, and then pass it through a nonlinear transfer function to obtain a scalar result.
[0115] ;
[0116] ;
[0117] Commonly used activation functions include:
[0118] (1) Sigmoid function: ;
[0119] (2) tanh function: ;
[0120] (3) ReLU function: ;
[0121] (4) Leaky ReLU function: ;
[0122] Taking a neural network model containing an input layer, two hidden layers, and an output layer as an example, the first... The linear coefficient from the i-th neuron in layer 1 to the j-th neuron in layer 1 is defined as... The bias of the j-th neuron in the l-th layer is defined as The bias of the j-th neuron in the l-th layer is defined as The output of the first hidden layer is calculated as shown in the following equation:
[0123] ;
[0124] Suppose that the activation function we choose is The output of the j-th neuron in the (l+1)-th layer is defined as Then the input to the second hidden layer is:
[0125] ;
[0126] The output calculation for the second hidden layer is shown in the following formula:
[0127] ;
[0128] The input to the output layer is: ;
[0129] The output of the output layer is then: ;
[0130] The general expression for the loss function of a neural network is: The loss function is used to measure the degree of inconsistency between the true value y and the predicted value f(x), and generally, a smaller value is better. A small loss function indicates that the machine learning model closely approximates the true distribution of the data, indicating good model performance; a large loss function indicates that the machine learning model deviates significantly from the true distribution of the data, indicating poor model performance. For regression problems, the loss function is: ;
[0131] in, y represents the predicted result, and y represents the actual result.
[0132] Gradient descent is one of the most commonly used optimization algorithms and currently the most frequently used method for optimizing neural networks. It is an algorithm that reaches the minimum value of a function through iterative steps. To find a local minimum of a function using gradient descent, steps can be taken that are proportional to the negative value of the function's gradient (or approximate gradient) at the current point.
[0133] The gradient represents the directional derivative of a function at a given point, where the directional derivative along that direction reaches its maximum value; in other words, it is the derivative of the function at the current position. ;
[0134] In the formula, As the independent variable, For about The function, Let represent the gradient. Then the independent variable parameter in the i-th step should be equal to: ;
[0135] η is the learning rate. When the learning rate is too low, many steps are needed to converge. Conversely, when the learning rate is too high, gradient descent will fail to reach the minimum value.
[0136] The learning process of BP neural network reservoir modeling consists of two stages: The first stage is forward propagation, which involves inputting known reservoir geological information as training samples. Using the established network structure and the thresholds and weights obtained from the previous training step, the output of each neuron is calculated from the first layer onwards. This process processes the input geological variable data and outputs the results. The second stage is backpropagation, where the output error is propagated back through the hidden layers to the input layers, distributing the error to all units in each layer. This yields the error signal for each unit, which serves as the basis for adjusting the weights. Specifically, by comparing the deviation between the actual output and the expected parameters, the network error is determined and propagated back to the reservoir attribute data processing units, thus readjusting their connections. This process of forward and backward propagation of signals and adjustment of layer weights is repeated continuously. This continuous adjustment of weights is the network's learning and training process. This continues until the network's output error is reduced to an acceptable level or until a predetermined number of training iterations are completed.
[0137] Assumption It is known that the following can be calculated using the chain rule:
[0138] ;
[0139] and ;
[0140] Therefore, as long as the error of the lth layer is known... Then you can calculate , , , and Used to update the parameters w and b of the l-th layer. It is passed to the (l-1)th layer to further calculate the derivatives of the parameters of the (l-1)th layer.
[0141] In the Sparrow Search Algorithm (SSA), sparrows can be categorized into three types: leaders, followers, and alerters. Within the population, leaders play a role in finding resources, providing clues such as foraging areas and directions. Followers, with their keen observation skills, capture the leader's movements to obtain food. Sparrows primarily utilize both leader and follower strategies for foraging, maintaining a cooperative yet competitive relationship. Alerters typically reside on the periphery of the population, where they are more vulnerable to predators, thus requiring them to constantly adjust their position to secure safer areas. Based on this brief overview, the following principles can be summarized:
[0142] (1) Resource reserve principle: Leaders usually control more food resources and are responsible for finding more favorable areas for the population, that is, areas with abundant food, and contacting followers to provide relevant foraging areas and directions.
[0143] (2) The principle of constant proportion: As long as a better resource is found, every sparrow can become a leader. However, the overall proportion of the two remains constant. That is to say, for every sparrow whose status changes to a leader, there must be another sparrow whose status changes to a follower. In other words, the status of leaders and followers is in a dynamic switching process.
[0144] (3) Warning and escape principle: If a sparrow discovers a predator, it will issue a warning. Once the warning value exceeds the warning threshold, the followers will escape to other safe areas to forage under the guidance of the leader.
[0145] (4) The principle of surveillance and plunder: When sparrows are foraging, they will always find the discoverer with the best food resources and obtain food from that area or forage around the leader. At the same time, if the followers want to improve their foraging rate, they will monitor the leader in real time in order to plunder food resources.
[0146] (5) The principle of flying towards the best: The scarcer the resources available to followers, the worse their foraging locations will be within the population. Some followers who are starving are more likely to fly to areas with more resources to forage.
[0147] (6) Warning and transfer principle: When a danger is sensed, sparrows on the periphery will immediately move to a safe location, while those in the middle of the population will adopt a random movement strategy to move closer to other individuals.
[0148] The process of the sparrow search algorithm includes:
[0149] Step 1: Establish a population X consisting of n sparrows. The expression for population X is:
[0150] ;
[0151] Where d is the number of hyperparameters to be optimized. Let n be the position of the nth sparrow in dimension d;
[0152] Step 2: Set fitness value The fitness value represents an individual sparrow's ability to find food. The expression is:
[0153] ;
[0154] in, is the fitness function, is the fitness value of the nth sparrow, is the position vector of the nth sparrow;
[0155] Step 3: According to the population X and the fitness value , set the position update formula of the discoverer as:
[0156] ;
[0157] where, is the number of iterations, is the maximum number of iterations, , are respectively at the th, th iteration, the position of the th sparrow as the discoverer at the th dimension, is a random number in [0,1]. is the warning value, with a value range of [0,1], is the safety value, with a value range of [0.5,1], Q is a random number subject to a normal distribution, and L is a 1×d matrix with all elements being 1;
[0158] When the situation of R2 < ST occurs, it means that the foraging environment is safe at this time, no predators are found, and the discoverer can perform a large number of search operations;
[0159] When the situation of R2 > ST occurs, it means that an individual in the sparrow population has already discovered a predator and issued an alarm. At this time, all sparrows will perform anti-predation behaviors and quickly transfer to other safe places to continue foraging;
[0160] Step 4: According to the population X, the fitness value and the position update formula of the discoverer, set the position update formula of the joiner as:
[0161] ;
[0162] where, is the best position of the sparrow as the discoverer at the th iteration, is the worst position of the sparrow as the discoverer, A is a 1×d matrix, and each element is randomly assigned 1 or -i, ;
[0163] When the situation of occurs, it indicates that the joiner with a lower fitness value has not found food in the current state. In order to improve the survival rate, it needs to go to other areas to forage.
[0164] Step 5: Set the number of scout sparrows to 10% to 20% of the total population. Their initial positions are randomly generated within the population. The behavioral expression for scout alerts is:
[0165] ;
[0166] in, Let t be the current globally optimal sparrow position in the t-th iteration, β be a control parameter, a random number following a standard normal distribution, K be a uniform random number with a value range of [-1, 1], and ε be a small constant to avoid the denominator being zero; The fitness value of the sparrow acting as a scout. The sparrow in the best position in the whole game fitness value, Sparrow in the worst position globally The fitness value.
[0167] When f appears i =f g In this situation, it indicates that the sparrow in question is in the optimal position globally and will move closer to other sparrows to reduce the risk of being preyed upon.
[0168] When f appears i >f g In this situation, it indicates that the sparrow in question is on the edge of the population and is more vulnerable to predators, and will quickly move to the current optimal position.
[0169] In this invention, the hyperparameters of Support Vector Machine (SVM) include the penalty parameter C and the parameter gamma of the RBF kernel function. The hyperparameters of Sparrow Search Algorithm (SSA) for optimizing Random Forest (RF) include the number of decision trees n_estimators, the number of randomly selected features in each decision tree max_features, and the maximum depth of the tree max_depth. The hyperparameters of Sparrow Search Algorithm (SSA) for optimizing Neural Network (DNN) include network structure parameters and model training parameters. The network structure parameters include the number and type of intermediate layers (fully connected, dropout, normalized, convolutional, etc.), the number of neurons per layer, and the activation function. The model training parameters include the loss function, optimization method, batch size, number of iterations, learning rate, regularization method and coefficients, and initialization method.
[0170] Methods for optimizing the penalty parameter C and the gamma parameter of the RBF kernel function in Support Vector Machines (SVM) using the sparrow search algorithm include:
[0171] Each sparrow's position is represented as a (C, gamma) combination. The initial position is randomly generated within a preset range. The fitness value of the population is calculated using the relative standard error RSEM or the correlation coefficient R2 as the fitness function. The population size and maximum number of iterations of the sparrow search algorithm SSA are set.
[0172] During the iteration process of the Sparrow Search Algorithm (SSA):
[0173] Update the position of the leading sparrow based on the discoverer's updated formula, and explore new (C, gamma) combinations;
[0174] The position of the following sparrow is updated according to the formula for updating the position of the introducer, so as to move closer to the high-quality solution;
[0175] The position of the early warning sparrow is updated based on the behavior formula of the reconnaissance and early warning system to avoid getting trapped in local optima.
[0176] The fitness values of all sparrows are recalculated after each iteration;
[0177] The sparrow position with the highest fitness that reaches the maximum number of iterations is taken as the optimal combination solution (C, gamma).
[0178] Methods for optimizing the number of decision trees (n_estimators), the number of randomly selected features (max_features) for each decision tree, and the maximum depth (max_depth) in Random Forest (RF) using the Sparrow Search algorithm include:
[0179] Each sparrow's position is represented as a (n_estimators, max_features, max_depth) combination. The initial position is randomly generated within a preset range. The fitness value of the population is calculated using the relative standard error RSEM or the correlation coefficient R2 as the fitness function. The population size and maximum number of iterations of the sparrow search algorithm SSA are set.
[0180] During the iteration process of the Sparrow Search Algorithm (SSA):
[0181] Update the position of the leading sparrow according to the discoverer's update formula, and explore new combinations of (n_estimators, max_features, max_depth);
[0182] The position of the following sparrow is updated according to the formula for updating the position of the introducer, so as to move closer to the high-quality solution;
[0183] The position of the early warning sparrow is updated based on the behavior formula of the reconnaissance and early warning system to avoid getting trapped in local optima.
[0184] The fitness values of all sparrows are recalculated after each iteration;
[0185] The position of the sparrow with the highest fitness that reaches the maximum number of iterations is taken as the optimal combination solution of (n_estimators, max_features, max_depth).
[0186] The methods for optimizing network structure parameters and model training parameters in a neural network (DNN) using the sparrow search algorithm include:
[0187] Each sparrow's position is represented as a combination of (network structure parameters, model training parameters). The initial position is randomly generated within a preset range. The fitness value of the population is calculated using the relative standard error RSEM or the correlation coefficient R2 as the fitness function. The population size and maximum number of iterations of the sparrow search algorithm SSA are set.
[0188] During the iteration process of the Sparrow Search Algorithm (SSA):
[0189] Update the position of the leading sparrow according to the discovery formula, and explore new combinations of (network structure parameters, model training parameters);
[0190] The position of the following sparrow is updated according to the formula for updating the position of the introducer, so as to move closer to the high-quality solution;
[0191] The position of the early warning sparrow is updated based on the behavior formula of the reconnaissance and early warning system to avoid getting trapped in local optima.
[0192] The fitness values of all sparrows are recalculated after each iteration;
[0193] The sparrow position with the highest fitness that reaches the maximum number of iterations is taken as the optimal combination of (network structure parameters, model training parameters).
[0194] This invention cleverly balances global search and local exploitation capabilities through the SSA algorithm. Its watchdog mechanism effectively avoids getting trapped in local optima, which is difficult to achieve with traditional optimization methods. The resulting hyperparameters (such as the complex three-layer neuron structure in the DNN stress model) are often difficult to design manually, fully tapping the potential performance of the machine learning model.
[0195] This invention automates the entire process from model training and hyperparameter optimization to performance comparison. By setting the population and number of iterations of the SSA (Self-Assessing and Optimizing System), parallel optimization and evaluation of three machine learning models can be automatically completed, significantly reducing manual intervention and computational time costs. This makes it possible to quickly select the optimal prediction model for a specific formation temperature and pressure monitoring task, thus improving analysis efficiency.
[0196] Methods for optimizing formation temperature prediction model parameters using the sparrow search algorithm include:
[0197] The SVM, RF, and DNN models for rapidly calculating formation temperature are coupled into the Sparrow Search Algorithm (SSA). The population size is set to 30, the maximum number of iterations is 30, and the hyperparameters of the SVM model are set as follows: penalty parameter c∈[0.01,30], RBF kernel function parameter gamma∈[0.01, 100]. The hyperparameters of the RF model are set as follows: number of decision trees n_estimators∈[1, 100], number of randomly selected features in each decision tree max_features∈[1, 5]. The hyperparameters of the DNN model are set as follows: learning rate η∈[0.001 0.01], maximum number of iterations Epoch∈[10, 100], number of neurons in the three hidden layers of the neural network num∈[1, 100], and batch size is [1, 100].
[0198] In the first test set, the hyperparameters of SVM, RF, and DNN models were iteratively optimized using the Sparrow Search Algorithm (SSA). The optimal hyperparameter values for the SVM model were determined as follows: c = 30, gamma = 1.0833601483892072. The optimal hyperparameter values for the RF model were: n_estimators = 3, max_features = 1. The optimal hyperparameter values for the DNN model were: learning rate = 0.0070915492375424735, number of iterations = 45, batch size = 10, number of neurons in the first hidden layer = 24, number of neurons in the second hidden layer = 54, and number of neurons in the third hidden layer = 18.
[0199] By setting the SVM model, RF model and DNN model through the optimal solution of hyperparameters, we obtain the SSA-SVM model, SSA-RF model and SSA-DNN model for fast formation temperature calculation.
[0200] The performance of the SSA-SVM model, SSA-RF model, and SSA-DNN model was evaluated using the first prediction set (the evaluation metrics were the goodness of fit between the model's predicted values and the true values, the relative standard error RSEM, and the correlation coefficient R). The SSA-RF model, which can quickly calculate formation temperature, was determined as the formation temperature prediction model.
[0201] Methods for optimizing formation pressure prediction model parameters using the sparrow search algorithm include:
[0202] The SVM, RF, and DNN models for rapidly calculating formation pressure are coupled into the Sparrow Search Algorithm (SSA). The population size is set to 30, the maximum number of iterations is 30, and the hyperparameters of the SVM model are set as follows: penalty parameter c∈[0.01,30], RBF kernel function parameter gamma∈[0.01, 100]. The hyperparameters of the RF model are set as follows: number of decision trees n_estimators∈[1, 100], number of randomly selected features in each decision tree max_features∈[1, 5]. The hyperparameters of the DNN model are set as follows: learning rate η∈[0.001 0.01], maximum number of iterations Epoch∈[10, 100], number of neurons in the three hidden layers of the neural network num∈[1, 100], and batch size is [1, 100].
[0203] In the second test set, the hyperparameters of SVM, RF, and DNN models were iteratively optimized using the Sparrow Search Algorithm (SSA). The optimal hyperparameter values for the SVM model were determined as follows: c = 30, gamma = 0.635358571651844. The optimal hyperparameter values for the RF model were: n_estimators = 4, max_features = 2. The optimal hyperparameter values for the DNN model were: learning rate = 0.00912545405185615, number of iterations = 78, batch size = 13, number of neurons in the first hidden layer = 53, number of neurons in the second hidden layer = 37, and number of neurons in the third hidden layer = 85.
[0204] By setting the SVM model, RF model and DNN model through the hyperparameter optimal solution, the SSA-SVM model, SSA-RF model and SSA-DNN model for fast formation pressure calculation are obtained.
[0205] The performance of the SSA-SVM model, SSA-RF model, and SSA-DNN model was evaluated using the second prediction set, and the SSA-DNN model, which can quickly calculate formation pressure, was determined as the formation pressure prediction model.
[0206] This invention uses the optimal hyperparameters found by SSA to reconfigure and train the model, and then performs a final performance evaluation on an independent prediction set. By comparing the performance of SSA-SVM, SSA-RF, and SSA-DNN, the best model (SSA-RF for temperature prediction and SSA-DNN for pressure prediction) is selected as the final prediction model.
[0207] This invention establishes an optimal machine learning model for learning the variation patterns of well logging data, enabling predictive analysis of formation temperature and pressure distribution, as detailed below:
[0208] Formation temperature and pressure distribution are crucial factors influencing the thickness of the stable zone of natural gas hydrates. Different regions typically exhibit varying temperatures and pressures, and both temperature and pressure gradients change with depth, resulting in different temperatures and pressures at different depths. Well logging data offers unique advantages such as high vertical resolution and continuous measurement, leading to its widespread application in formation pore pressure prediction. Therefore, artificial intelligence models can be established to correlate well logging curves with formation temperature and pressure, enabling rapid determination of formation temperature and pressure distributions.
[0209] Partial logging data from well DK-9 was selected for this project. The logging curves include natural gamma ray (GR), spontaneous potential (SP), sonic transit time (AC), density (DEN), and resistivity (RT) logging data, such as... Figure 2 As shown. Formation pore pressure data. Through actual measurement of sound wave time difference Acoustic time difference on the normal trend line and density logging data The calculation is as follows:
[0210] ;
[0211] Temperature logging curves in shallow formations are typically higher than the stable temperature, while the opposite is true in deeper formations. This difference is due to the circulation of drilling fluid during drilling. Even so, an inflection point in the temperature curve appears at the bottom of the permafrost. Below the permafrost layer, the temperature log shows a steady increase. Within permafrost, the temperature log has a small range (2.74–4.95°C). The fluctuations in the temperature curve within the permafrost zone are more pronounced than those below the permafrost zone. This fluctuation can also be observed in the stable temperature data of permafrost. This suggests that the temperature within the permafrost layer may be influenced by lithology or ice saturation. The relationship between velocity and depth is not significant. This indicates that temperature has little effect on formation velocity. With increasing depth, resistivity logging values first decrease and then increase.
[0212] For strata less than 300 m deep, the resistivity of sandstone and mudstone exhibits a strong correlation with depth. Based on stable temperature data, the temperature of this stratum is approximately -1.55 °C at 30 m and approximately 6.11 °C at 300 m. The resistivity of mudstone at 30 m is 10 times that at 300 m. The rate of increase in resistivity is high in permafrost, while it is low in strata deeper than 150 m. In permafrost, water in pores and fractures begins to freeze, causing a sharp decrease in the conductivity of the stratum. Although stratum resistivity is influenced by lithology, temperature is the most significant factor affecting the resistivity of permafrost.
[0213] By plotting a scatter plot matrix of well logging data (such as...) Figure 3(as shown in a) and correlation heatmaps (such as...) Figure 3 As shown in Figure b), the logging curves for sonic transit time, density, natural gamma, and spontaneous potential are positively correlated with the temperature and pressure of the formation. The spontaneous potential has the highest correlation with temperature and pressure, while resistivity has a negative correlation.
[0214] Example 1: In formation pressure prediction:
[0215] First, the data is divided into training, testing, and prediction sets in a ratio of 0.8, 0.1, and 0.1, respectively. The training set is used to train the machine learning model, the testing set is used to calculate the fit index of the SSA model and optimize the model parameters, and the prediction set is used for on-site prediction.
[0216] The SVM, RF, and DNN models are coupled into the SSA optimization algorithm, with a population size of 30 and a maximum number of iterations of 30. For the SVM model, c ∈ [0.01, 30] and gamma ∈ [0.01, 100]; for the RF model, n_estimators ∈ [1, 100] and max_features ∈ [1, 5]; for the DNN model, the learning rate η ∈ [0.001 0.01], the maximum number of iterations Epoch ∈ [10, 100], and the neural network has three hidden layers with the number of neurons num ∈ [1, 100]. The batch size for the DNN model is [1, 100], and the optimization algorithm is Adam.
[0217] The change in the fit index during the SSA optimization of hyperparameters for SVM, RF, and DNN models is as follows: Figure 4 As shown in Figure a, the vertical axis represents the Fitness Value, and the horizontal axis represents the number of iterations. The SVM model's hyperparameters reached their minimum value of 0.16474086297267665 after one iteration, with optimal variables c = 30 and gamma = 0.635358571651844. The RF model's hyperparameters underwent two adjustments, with a final value of 0.08097, optimal variables n_estimators = 4, and max_features = 2. The DNN model's hyperparameters reached their minimum value of 2.29264 × 10 after three adjustments. -5 The optimal learning rate is 0.00912545405185615, the number of iterations is 78, the batch size is 13, the number of neurons in the first hidden layer is 53, the number of neurons in the second hidden layer is 37, and the number of neurons in the third hidden layer is 85.
[0218] The prediction set data is input into the optimized SVM, RF, and DNN models, namely SSA-SVM, SSA-RF, and SSA-DNN, and the prediction results are as follows. Figure 4As shown in Figure b, the SSA-DNN model has the best prediction performance, followed by the SSA-RF model, and the SSA-SVM model has the worst performance.
[0219] Furthermore, by analyzing the contribution of the input parameters, we can obtain (e.g.) Figure 5 As shown in the figure, the spontaneous potential curve contributes the most to the characteristic parameters, close to 40%, followed by resistivity at 28%, while sonic transit time and density logging contribute less than 10%.
[0220] Table 1 shows the RMSE and R values of the prediction results from the SSA-SVM, SSA-RF, and SSA-DNN models. Among the three machine learning models, the SSA-DNN model has the lowest RMSE, followed by SSA-RF, and the SSA-SVM model has the highest. The correlation coefficient of the SSA-SVM method is the lowest at 0.8182, while the correlation coefficients of the SSA-DNN and SSA-RF methods reach over 0.95. Considering both the correlation coefficient R and RMSE, the SSA-DNN model is the best.
[0221] Table 1. RMSE and R of formation pressure predictions and monitoring data:
[0222] Evaluation indicators SSA-SVM SSA-RF SSA-DNN RMSE 1.3312 0.5974 0.4116 R 0.8182 0.9679 0.9521
[0223] Therefore, the present invention uses the SSA-DNN model for predicting formation pressure.
[0224] Example 2: In formation temperature prediction:
[0225] First, the data is divided into training, testing, and prediction sets in a ratio of 0.8, 0.1, and 0.1, respectively. The training set is used to train the machine learning model, the testing set is used to calculate the fit index of the SSA model and optimize the model parameters, and the prediction set is used for on-site prediction.
[0226] The SVM, RF, and DNN models are coupled into the SSA optimization algorithm, with a population size of 30 and a maximum number of iterations of 30. For the SVM model, c ∈ [0.01, 30] and gamma ∈ [0.01, 100]; for the RF model, n_estimators ∈ [1, 100] and max_features ∈ [1, 5]; for the DNN model, the learning rate η ∈ [0.001 0.01], the maximum number of iterations Epoch ∈ [10, 100], and the neural network has three hidden layers with the number of neurons num ∈ [1, 100]. The batch size for the DNN model is [1, 100], and the optimization algorithm is Adam.
[0227] The change in the fit index during the SSA optimization of hyperparameters for SVM, RF, and DNN models is as follows: Figure 6As shown in Figure a, the vertical axis represents the Fitness Value, and the horizontal axis represents the number of iterations. The SVM model's hyperparameters reached their minimum value of 0.1579015526581468 after two adjustments, with optimal variables c = 30 and gamma = 1.0833601483892072. The RF model's hyperparameters underwent six adjustments, reaching a final value of 0.042629321431993814, with optimal variables n_estimators = 3 and max_features = 1. The DNN model's hyperparameters reached their minimum value of 1.31 × 10⁻⁶ after two adjustments. -4 The optimal learning rate is 0.0070915492375424735, the number of iterations is 45, the batch size is 10, the number of neurons in the first hidden layer is 24, the number of neurons in the second hidden layer is 54, and the number of neurons in the third hidden layer is 18.
[0228] The prediction set data is input into the optimized SVM, RF, and DNN models, namely SSA-SVM, SSA-RF, and SSA-DNN, and the prediction results are as follows. Figure 6 As shown in Figure b, the SSA-RF model has the best prediction performance, followed by the SSA-DNN model, and the SSA-SVM model has the worst performance.
[0229] Furthermore, by analyzing the contribution of the input parameters, it can be concluded that (e.g.) Figure 7 As shown in the figure, the contribution of the spontaneous potential curve is the highest among the characteristic parameters, reaching 28%, followed by the sonic transit time at 25%, while the contributions of natural gamma, resistivity and density logging are not much different, at about 15%.
[0230] Table 2 shows the RMSE and R values of the prediction results for SSA-SVM, SSA-RF, and SSA-DNN models. Among the three machine learning models, SSA-RF has the lowest RMSE, followed by SSA-DNN, with SSA-SVM having the highest. The correlation coefficient is lowest for SSA-SVM at 0.8505, while the correlation coefficient between SSA-DNN and SSA-RF is approximately 0.95. Considering both the correlation coefficient (R) and RMSE, the SSA-RF model is the best.
[0231] Table 2. RMSE and R of formation temperature prediction model results and monitoring data:
[0232] Evaluation indicators SSA-SVM SSA-RF SSA-DNN RMSE 2.6425 0.9121 1.4561 R 0.8505 0.9642 0.9499
[0233] Therefore, the present invention uses the SSA-RF model for predicting formation temperature.
[0234] This invention achieves high reliability and generalization representativeness in performance metrics (such as accuracy and error) by conducting final testing on a prediction set that was not involved in training or optimization. This ensures that the final model delivered to the user is rigorously selected, optimally performing, and stable, providing quality assurance for field applications. This "multi-model competition, best-of-breed selection" strategy also guarantees the optimality of the solution.
[0235] This invention constructs a complete analysis process that includes data correlation analysis, multi-model training, SSA optimization, and performance comparison screening. Through final evaluation on the first and second prediction sets, it ensures that the selected optimal model has strong generalization ability and can be reliably applied to new and unseen well section data, providing a powerful tool for real-time drilling decision-making and reservoir evaluation.
[0236] The above embodiments are merely exemplary embodiments of this application and are not intended to limit this application. The scope of protection of this application is defined by the claims. Those skilled in the art can make various modifications or equivalent substitutions to this application within its substance and scope of protection, and such modifications or equivalent substitutions should also be considered to fall within the scope of protection of this application.
Claims
1. A machine learning analysis method for formation temperature and pressure based on the sparrow search algorithm, characterized in that, Includes the following steps: Acquire well logging curves, formation temperature data, and formation pressure data; By analyzing the scatter plot matrix and correlation heat map of well logging data, the correlation between well logging curves and formation temperature and formation pore pressure was determined. Based on the aforementioned correlation, a machine learning model for rapidly calculating formation temperature is established using well logging curves and formation temperature data to obtain a formation temperature prediction model. The sparrow search algorithm is then used to optimize the parameters of the formation temperature prediction model. Based on the aforementioned correlation, a learning model for rapidly calculating formation pressure is established using well logging curves and formation pressure data, resulting in a formation pressure prediction model. The sparrow search algorithm is then used to optimize the parameters of the formation pressure prediction model.
2. The formation temperature and pressure machine learning analysis method based on the sparrow search algorithm optimization according to claim 1, characterized in that: The logging curves include natural gamma (GR), spontaneous potential (SP), acoustic transit time (AC), density (DEN), and resistivity (RT) logging data.
3. The formation temperature and pressure machine learning analysis method based on the sparrow search algorithm optimization according to claim 2, characterized in that: The method for obtaining the scatter plot matrix of the well logging data includes: The parameters are paired up in pairs from natural gamma ray (GR) logging data, spontaneous potential (SP) logging data, sonic transit time (AC) logging data, density (DEN) logging data, resistivity (RT) logging data, formation temperature data, and formation pressure data. Plot scatter plots between pairs of parameters, and organize all scatter plots into a matrix to obtain the well logging data scatter plot matrix.
4. The formation temperature and pressure machine learning analysis method based on the sparrow search algorithm optimization according to claim 3, characterized in that: The method for obtaining the correlation heatmap includes: The parameters are paired up in pairs from natural gamma ray (GR) logging data, spontaneous potential (SP) logging data, sonic transit time (AC) logging data, density (DEN) logging data, resistivity (RT) logging data, formation temperature data, and formation pressure data. Calculate the Pearson correlation coefficients between each pair of paired parameters, organize all Pearson correlation coefficients into a matrix, and display the magnitude of the correlation coefficients using color mapping to obtain a correlation heatmap.
5. The formation temperature and pressure machine learning analysis method based on the sparrow search algorithm optimization according to claim 4, characterized in that: The correlation between the logging curves and formation temperature and formation pore pressure includes: The logging curves for sonic transit time, density, spontaneous gamma, and spontaneous potential are positively correlated with formation temperature and pressure. Spontaneous potential has the highest correlation with temperature and pressure, while resistivity has a negative correlation.
6. The formation temperature and pressure machine learning analysis method based on the sparrow search algorithm optimization according to claim 5, characterized in that: Methods for establishing machine learning models for rapidly calculating formation temperature include: The logging curves and formation temperature data were divided into a first training set, a first test set, and a first prediction set according to a ratio of 0.8, 0.1, and 0.1, respectively. In the first training set, support vector machine (SVM), random forest (RF), and neural network (DNN) models were trained to obtain SVM, RF, and DNN models for quickly calculating formation temperature.
7. The formation temperature and pressure machine learning analysis method based on the sparrow search algorithm optimization according to claim 6, characterized in that: Methods for establishing machine learning models for quickly calculating formation pressure include: Well logging curves and formation temperature data were divided into a second training set, a second test set, and a second prediction set according to ratios of 0.8, 0.1, and 0.
1. In the second training set, support vector machine (SVM), random forest (RF), and neural network (DNN) models were trained to obtain SVM, RF, and DNN models for quickly calculating formation pressure.
8. The formation temperature and pressure machine learning analysis method based on the sparrow search algorithm optimization according to claim 7, characterized in that: The algorithm flow of the sparrow search algorithm includes: Step 1: Establish a population X consisting of n sparrows. The expression for population X is: ; Where d is the number of hyperparameters to be optimized. Let n be the position of the nth sparrow in dimension d; Step 2: Set fitness value The fitness value represents an individual sparrow's ability to find food. The expression is: ; in, For the fitness function, Let be the fitness value of the nth sparrow. Let n be the position vector of the nth sparrow; Step 3: Based on population X and fitness value The location update formula for the discoverer is set as follows: ; in, For the number of iterations, The maximum number of iterations, , They were respectively in the second sequence During the nth iteration, the 1st The sparrow that was the discoverer was in the first The position of the dimension It is a random number in [0,1]. This is the warning value, and its range is [0,1]. The safe value is [0.5, 1], Q is a random number that follows a normal distribution, and L is a 1×d matrix with all elements being 1; Step 4: Based on population X and fitness value The location update formula for discoverers is set as follows: ; in, In the first In the next iteration, the sparrow, as the discoverer, is in the best position. Let A be the worst possible position for the sparrow that discovers the sparrow, and let A be a 1×d matrix where each element is randomly assigned a value of 1 or -1. ; Step 5: Set the number of scout sparrows to 10% to 20% of the total population. Their initial positions are randomly generated within the population. The behavioral expression for scout alerts is: ; in, Let t be the current globally optimal sparrow position in the t-th iteration, β be a control parameter, a random number following a standard normal distribution, K be a uniform random number with a value range of [-1, 1], and ε be a small constant to avoid the denominator being zero; The fitness value of the sparrow acting as a scout. The sparrow in the best position in the whole game fitness value, Sparrow in the worst position globally The fitness value.
9. The formation temperature and pressure machine learning analysis method based on the sparrow search algorithm optimization according to claim 8, characterized in that: Methods for optimizing formation temperature prediction model parameters using the sparrow search algorithm include: The SVM, RF, and DNN models for rapidly calculating formation temperature are coupled into the Sparrow Search Algorithm (SSA). The population size is set to 30, the maximum number of iterations is 30, and the hyperparameters of the SVM model are set as follows: penalty parameter c∈[0.01,30], RBF kernel function parameter gamma∈[0.01, 100]. The hyperparameters of the RF model are set as follows: number of decision trees n_estimators∈[1, 100], number of randomly selected features in each decision tree max_features∈[1, 5]. The hyperparameters of the DNN model are set as follows: learning rate η∈[0.001 0.01], maximum number of iterations Epoch∈[10, 100], number of neurons in the three hidden layers of the neural network num∈[1, 100], and batch size is [1, 100]. In the first test set, the hyperparameters of SVM, RF, and DNN models were iteratively optimized using the Sparrow Search Algorithm (SSA). The optimal hyperparameter values for the SVM model were determined as follows: c = 30, gamma = 1.0833601483892072. The optimal hyperparameter values for the RF model were: n_estimators = 3, max_features = 1. The optimal hyperparameter values for the DNN model were: learning rate = 0.0070915492375424735, number of iterations = 45, batch size = 10, number of neurons in the first hidden layer = 24, number of neurons in the second hidden layer = 54, and number of neurons in the third hidden layer = 18. By setting the SVM model, RF model and DNN model through the optimal solution of hyperparameters, we obtain the SSA-SVM model, SSA-RF model and SSA-DNN model for fast formation temperature calculation. The performance of the SSA-SVM model, SSA-RF model, and SSA-DNN model was evaluated using the first prediction set, and the SSA-RF model, which can quickly calculate formation temperature, was determined as the formation temperature prediction model.
10. The formation temperature and pressure machine learning analysis method based on the sparrow search algorithm optimization according to claim 9, characterized in that: Methods for optimizing formation pressure prediction model parameters using the sparrow search algorithm include: The SVM, RF, and DNN models for rapidly calculating formation pressure are coupled into the Sparrow Search Algorithm (SSA). The population size is set to 30, the maximum number of iterations is 30, and the hyperparameters of the SVM model are set as follows: penalty parameter c∈[0.01,30], RBF kernel function parameter gamma∈[0.01, 100]. The hyperparameters of the RF model are set as follows: number of decision trees n_estimators∈[1, 100], number of randomly selected features in each decision tree max_features∈[1, 5]. The hyperparameters of the DNN model are set as follows: learning rate η∈[0.001 0.01], maximum number of iterations Epoch∈[10, 100], number of neurons in the three hidden layers of the neural network num∈[1, 100], and batch size is [1, 100]. In the second test set, the hyperparameters of SVM, RF, and DNN models were iteratively optimized using the Sparrow Search Algorithm (SSA). The optimal hyperparameter values for the SVM model were determined as follows: c = 30, gamma = 0.635358571651844. The optimal hyperparameter values for the RF model were: n_estimators = 4, max_features = 2. The optimal hyperparameter values for the DNN model were: learning rate = 0.00912545405185615, number of iterations = 78, batch size = 13, number of neurons in the first hidden layer = 53, number of neurons in the second hidden layer = 37, and number of neurons in the third hidden layer = 85. By setting the SVM model, RF model and DNN model through the hyperparameter optimal solution, the SSA-SVM model, SSA-RF model and SSA-DNN model for fast formation pressure calculation are obtained. The performance of the SSA-SVM model, SSA-RF model, and SSA-DNN model was evaluated using the second prediction set, and the SSA-DNN model, which can quickly calculate formation pressure, was determined as the formation pressure prediction model.
Citation Information
Patent Citations
Formation temperature prediction method and device and computing equipment
CN118094339A
Inductance material electromagnetic performance prediction method and system based on machine learning
CN120126630A
Method and device for predicting temperature and pressure in heterogeneous stratum
CN120257695A
Oil and gas well yield prediction method and device based on sparrow search algorithm
CN120258181A