Hydrogen-doped natural gas compression factor prediction method
Through XGBoost-based machine learning model and Shapley value feature importance analysis, the calculation complexity and inexplicability of hydrogen-doped natural gas compression factor prediction are solved, and fast and accurate prediction and efficient operation are achieved under different conditions, suitable for performance Limited microcontrollers.
Patent Information
- Application Number
- CN202411067058.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-12-06
AI Technical Summary
The prior art has problems of computational complexity, low accuracy and unexplainability when calculating the compression factor of hydrogen-doped natural gas, especially in the fact that it is difficult to accurately predict under different temperature and pressure conditions, and the traditional method is time-consuming and not suitable for limited performance. Run on the microcontroller.
Using XGBoost-based machine learning model combined with Shapley value feature importance analysis, an interpretable hydrogen-doped natural gas compression factor prediction method is constructed, and through data preprocessing, model training and feature importance analysis, rapid and accurate compression factor prediction is achieved.
It reduces the computational complexity and space occupancy, improves prediction accuracy, overcomes the poor adaptability of traditional models and the uninterpretation of deep learning models, and realizes efficient operation on devices with limited performance, and has high practical value.
Smart Images

Figure CN119092003A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of natural gas compression factor prediction methods, and in particular to a method for predicting the compression factor of hydrogen-blended natural gas. Background Art
[0002] my country has entered a stage of rapid development of the natural gas industry, and the use of natural gas has increased at a rate of about 25% per year. As demand continues to grow, the trade handover of natural gas between upstream suppliers and downstream users has become a key task. In the transaction process, it is inevitable that there are various factors that affect the accuracy of flow measurement. Among them, the calculation accuracy of the compression factor is one of the key factors that directly affect the accuracy of the measurement results. At present, the measurement methods used in the trade settlement of pipeline gas in the world are divided into three types: volume measurement, energy measurement and mass measurement. Among them, volume measurement is more commonly used in practice, and it is based on the volume of gas under standard conditions. The physical parameter of the compression factor plays an important role in the process of volume conversion. Its slight difference may lead to obvious deviations in the measurement results, and long-term billing accumulated errors will bring serious economic losses. Therefore, accurately determining the compression factor in the process of natural gas extraction, storage, transportation and trade has become an important prerequisite for improving the accuracy of flow measurement results.
[0003] In addition, in recent years, hydrogen (H 2 ) is a recognized clean energy and has received more and more attention and application. 2 It is mixed into natural gas in a certain proportion and then transported through natural gas pipelines or networks to achieve H 2 An effective way to transport large quantities of goods. 2 With methane (CH 4 ) have huge differences in physical properties. Under standard conditions, the density difference between the two is more than 8 times, and the presence of non-hydrocarbon gases in natural gas will affect its properties, such as compression factor, density, enthalpy and other parameters. Compared with conventional natural gas, hydrogen-blended natural gas has H 2 The mole fraction has an important influence on the calculation of the natural gas compression factor. Therefore, obtaining the accurate compression factor of hydrogen-blended natural gas is of great significance for the transportation of natural gas mixed with hydrogen.
[0004] The compression factor (usually expressed as Z) of hydrogen blended natural gas (HBNG) is a dimensionless parameter used to describe the volume difference between real gas and ideal gas at the same temperature and pressure. For hydrogen blended natural gas, its compression factor is affected by many factors, including temperature, pressure, hydrogen concentration and the composition of the natural gas itself. In 2004, Meng Xiangshi and others from the School of Automation of Tianjin University used the comparative state RK equation to calculate the compression factor, analyzed the relationship between the compression factor and the comparative temperature Tr and the comparative pressure Pr, and obtained the isotherm cluster of the compression factor with respect to Pr as follows: Figure 1 shown.
[0005] In 2011, Guan Hongxiang and others from the CNOOC Research Center collected measured data on the compression factor of ultra-high-pressure natural gas and compared it with the SK chart. Using the curve fitting method, they derived a numerical calculation formula for the compression factor of natural gas under high-pressure conditions, and applied it to the calculation of high-pressure gas well pressure. The accuracy of the calculation result is much higher than the value obtained by the default algorithm in the PipeSim software, which makes up for the large error in solving the compression factor of natural gas using the standard calculation model under ultra-high pressure conditions, and is of great significance to improving the accuracy of gas production measurement in high-pressure oil and gas fields. In July 2013, Chen Wei from the School of Petroleum Engineering of Xi'an Shiyou University studied the measured data of gas production in a well area of a gas field and found that the composition and formation temperature of the natural gas produced by the gas wells in the gas field were relatively uniform and stable, and the compression factor mainly depended on the local formation pressure; therefore, the composition and formation temperature of the local gas production were regarded as constants and replaced by the average value, and the empirical formula of the compression factor with respect to the formation pressure was established using the fitting method. In 2014, Liang Guangchuan and others from the School of Petroleum Engineering at Southwest Petroleum University used VisualBasic 6.0 as a development tool, and used 113 experimental values of compression factors of acidic lean gas collected on site to compare and evaluate the calculation results of five gas component-based compression factor algorithms, including AGA8-92DC, Piper-Mahmoud, and DAK, through programming. The analysis results recommended the most applicable compression factor algorithm for different temperature and pressure intervals and whether the natural gas contains sulfide components, which has a certain reference value and guiding role in the calculation of compression factor of acidic lean gas.
[0006] From the current research results published: 1. The most accurate and reliable way to determine the gas compression factor is of course direct experimental measurement. The gas to be tested is loaded into a high-pressure PVT experimental device, the volume and pressure of the gas are measured under constant temperature conditions, and the gas compression factor under different pressures is directly calculated using the definition of the compression coefficient. The experimental measurement method has high accuracy, but its disadvantages are also obvious. The operation process is cumbersome, requires expensive professional equipment and is very time-consuming. Such conditions are often not available at the site where natural gas metering is actually required.
[0007] 2. Although the exploration of natural gas compression factor prediction methods has been ongoing, and many empirical formulas and state equations applicable to different conditions have been developed, the algorithms involve a large number of high-precision floating-point operations, and there are problems such as high computational overhead, complex process steps, and diverse use conditions.
[0008] 3. The energy compression factor prediction method using machine learning models is a typical black box model, which is trained end-to-end, has strong uncertainty and uncontrollability, and poor interpretability. Summary of the invention
[0009] In order to solve the problems existing in the prior art, the present invention provides a method for predicting the compression factor of hydrogen-blended natural gas, which solves the problem that the present invention intends to find a machine learning-based method that can be applied to the prediction of the compression factor of hydrogen-blended natural gas under different temperature, pressure and other conditions to reduce its time complexity and space occupancy so that it can run on a microcontroller with limited performance and storage space.
[0010] The specific technical solutions of the present invention are as follows:
[0011] A method for predicting the compression factor of hydrogen-blended natural gas comprises the following steps:
[0012] Step S1: data preprocessing;
[0013] Step S2: constructing a prediction model for the compression factor of hydrogen-blended natural gas based on XGBoost;
[0014] Step S3: Construct a feature importance analysis model based on Shapley value.
[0015] Preferably, step S1 includes the following sub-steps:
[0016] Sub-step S11: using temperature, pressure, hydrogen doping ratio, and methane ratio as input data, and cleaning the data to achieve data format integration, data alignment, outlier removal, and missing value filling; Sub-step S12: dividing the cleaned data into training sets and test sets.
[0017] Preferably, step S2 includes the following sub-steps:
[0018] Sub-step S21: using the divided training data as input data to train random forest, neural network, and XGBoost machine learning models;
[0019] Sub-step S22: Evaluate the model through test data and optimize the model.
[0020] Preferably, S3 includes the following sub-steps:
[0021] Sub-step S31: using the Shapley value method for the preferred model;
[0022] Sub-step S32: Perform interpretability analysis using its feature importance graph and dependency graph to achieve the purpose of building an interpretable machine learning.
[0023] The beneficial effects of the method for predicting the compression factor of hydrogen-blended natural gas of the present invention are as follows:
[0024] 1. The method of the present invention overcomes the poor adaptability of traditional models and the "black box" characteristics of deep learning models, which are highly uncertain, lacking credibility and interpretability.
[0025] 2. The present invention can fully capture the component information characteristics and accurately predict the compression factor of hydrogen-blended natural gas. At the same time, the method based on Shapley value reveals the contribution of each feature in the prediction model to the prediction results.
[0026] 3. On the one hand, the method of the present invention advances the basic research on the prediction of the compression factor of hydrogen-blended natural gas. On the other hand, due to its relatively low computational burden, high prediction accuracy and interpretable characteristics of the model, the method also has high practical value. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 FIG. 5 is an isotherm cluster diagram of the compressibility factor of the present invention with respect to the comparative pressure Pr.
[0028] Figure 2 It is a model flow chart of the present invention.
[0029] Figure 3 It is a schematic diagram of the XGboost structure of the present invention.
[0030] FIG. 4 is a graph showing the predictive performance of different models of the present invention.
[0031] FIG. 4( a ) is a diagram of a random forest model of the present invention.
[0032] FIG4( b ) is a diagram of the XGBoost model of the present invention.
[0033] FIG4( c ) is a diagram of a neural network model of the present invention.
[0034] Figure 5 It is a graph of average Shapley values of temperature, pressure, methane ratio and hydrogen blending ratio of the present invention.
[0035] Figure 6 This is the dependency diagram of the present invention. DETAILED DESCRIPTION
[0036] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0037] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.
[0038] A method for predicting the compression factor of hydrogen-blended natural gas comprises the following steps:
[0039] Step S1: data preprocessing;
[0040] Step S2: constructing a prediction model for the compression factor of hydrogen-blended natural gas based on XGBoost;
[0041] Step S3: Construct a feature importance analysis model based on Shapley value.
[0042] Step S1 of this embodiment includes the following sub-steps:
[0043] Sub-step S11: using temperature, pressure, hydrogen doping ratio, and methane ratio as input data, and cleaning the data to achieve data format integration, data alignment, outlier removal, and missing value filling;
[0044] Sub-step S12: Divide the cleaned data into a training set and a test set.
[0045] Step S2 of this embodiment includes the following sub-steps:
[0046] Sub-step S21: using the divided training data as input data to train random forest, neural network, and XGBoost machine learning models;
[0047] Sub-step S22: Evaluate the model through test data and optimize the model.
[0048] S3 of this embodiment includes the following sub-steps:
[0049] Sub-step S31: using the Shapley value method for the preferred model;
[0050] Sub-step S32: Perform interpretability analysis using its feature importance graph and dependency graph to achieve the purpose of building an interpretable machine learning.
[0051] When implementing this embodiment, the present invention intends to find a machine learning-based method that can be applied to the prediction of the compression factor of hydrogen-blended natural gas under different temperature, pressure and other conditions, so as to reduce its time complexity and space occupancy, so that it can run on a microcontroller with limited performance and storage space. The present invention has the following contributions in this field: 1. Innovatively explores the technology of predicting the compression factor of hydrogen-blended natural gas based on the temperature T, pressure P and component information of pipeline natural gas, and constructs three hydrogen-blended natural gas compression factor prediction models based on traditional machine learning algorithms. A fast and accurate calculation of the compression factor of hydrogen-blended natural gas is achieved. 2. A model-based prediction result is achieved, which explains the degree of influence of different sample characteristics on the compression factor and improves the black box unexplainability of traditional machine learning models.
[0052] The model was established by applying random forest, XGBoost, neural network and ShapleyValue. The method takes into account the high efficiency and accuracy required for the prediction of the compression factor of hydrogen-blended natural gas.
[0053] The implementation of the present invention is mainly divided into two parts: constructing a prediction model for the compression factor of hydrogen-blended natural gas; and constructing a feature importance analysis model based on Shapley values.
[0054] (1) Data preprocessing
[0055] Temperature, pressure, hydrogen ratio, and methane ratio are used as input data, and the data is cleaned to achieve data format integration, data alignment, outlier removal, and missing value filling. At the same time, the cleaned data is divided into training sets and test sets.
[0056] (2) Model construction and interpretability analysis
[0057] The divided training data is used as input data to train random forest, neural network, and XGBoost machine learning models, and the models are evaluated and optimized through test data. The Shapley value method is used for the optimized model, and the interpretability analysis is performed using its feature importance graph and dependency graph to achieve the purpose of building an interpretable machine learning model.
[0058] Prediction model of compression factor of hydrogen-blended natural gas based on XGBoost
[0059] The XGBoost ensemble model uses the sum of the predicted values of each tree for a sample as the output value of the sample. The function is defined as follows:
[0060]
[0061] F = {f(x) = w q(x)}(q:R m →T,w∈R T ) (2)
[0062] in, ——model prediction value;
[0063] x i ——the i-th sample;
[0064] f k ——kth tree model;
[0065] F – space of decision tree;
[0066] m – number of features;
[0067] T – the number of leaf nodes in each tree;
[0068] q——The structure of each tree maps the score of each sample to the corresponding leaf node, that is, q represents the model of the tree, inputs a sample, maps the sample to the leaf node according to the model, and outputs the predicted score;
[0069] w q(x) ——The scores of all leaf nodes of tree q form a set;
[0070] Define the objective function:
[0071]
[0072] The first term on the right is the loss function term, that is, the training error, which is a differentiable convex function. The second term is the regularization penalty term, that is, the sum of the complexity of each tree. The purpose is to control the complexity of the model and prevent overfitting.
[0073]
[0074] T——is the number of leaf nodes in the tree.
[0075] γ——The penalty term of L1 regularization. The more leaves there are, the greater the penalty.
[0076] λ——one is the L2 modulus square of the score w of the leaf node on the tree (L2 regularization of w is equivalent to adding L2 smoothing to the score of each leaf node in order to avoid overfitting);
[0077] Our goal is to obtain the corresponding model f when L(φ) is minimized k Since the optimization parameter in the XGBoost model is the model f k , is not a specific value, so it cannot be optimized in Euclidean space using traditional optimization methods. Instead, we use additive training to learn the model. Each time, we keep the original model unchanged and add a new function f t (x i ) into the model, as follows:
[0078]
[0079] The predicted value is added to a new function f in each iteration t (x i ), the purpose is to reduce the objective function as much as possible. For the square error (used for regression), equation (8) is transformed into the following form:
[0080]
[0081] The core goal of using Taylor's formula for approximate expansion is to simplify the target function and extract the constant term. The basic Taylor formula expansion is as follows:
[0082]
[0083] Then we can get the objective function expansion formula as follows:
[0084]
[0085] I j ={i|q(x i )=j}(9)g i —— First-order derivative;
[0086] h i —— Second-order derivative;
[0087] Defined as the instance set of leaf node j, rewriting formula (13) converts the iteration about the tree model into the iteration about the leaf nodes of the tree.
[0088]
[0089] At this point our goal is to find the score W of the leaf node j of each tree j , find W j Then, the W of each tree j Add them together to get the final predicted score. To get the optimal W jThe value of W is to minimize our objective function. j Find the partial derivative and set it to 0 to find the current for:
[0090]
[0091] definition have to:
[0092]
[0093] G——The sum of all g in a leaf area after the tree is divided, which is the first-order derivative;
[0094] H——is the sum of all h in a leaf area after the tree is divided, which is the second-order derivative;
[0095] One of the important problems in tree learning is to find the best node partitioning, and the purpose of node partitioning is to find a tree with the optimal structure. A tree is generated by splitting a node into two, and then continuously splitting to form a whole tree. Assume that I L and I R is the left and right nodes after a node is split, I is equal to I L and I R The union of .
[0096] Use the optimal split point partitioning algorithm (greedy algorithm):
[0097] Continuously enumerate the structures of different trees, and then use the scoring function to find a tree with the optimal structure, then add it to the model, and repeat this operation. The specific steps are: select a feature split, calculate the minimum loss function, and then select another feature split to get another minimum loss function. After enumeration, find the one with the best effect, split the tree, and you will get a sapling.
[0098] Starting from the tree depth 0, each node traverses all the features, such as density, viscosity, etc. Then, for a certain feature, first sort according to the value in the feature, then linearly scan the feature to determine the best split point, and finally after all the features are split, we choose the gain L split The highest division method, the loss function after segmentation is defined as follows:
[0099]
[0100] - Do not divide the available scores;
[0101] ——left subtree score;
[0102] ——right subtree score;
[0103] Feature importance analysis based on Shapley value
[0104] For hydrogen-blended natural gas, its compression factor is affected by many factors, including temperature, pressure, hydrogen concentration, and the composition of the natural gas itself. The Shapley value is used to measure the contribution of each factor to the compression factor prediction result. For a sample in the historical data X of the compression factor influencing factors Then the jth influencing factor Shapley value The definition is as follows: P means there are p influencing factors in total, see the top line x i Representation
[0105]
[0106] Where: S is the jth influencing factor excluded from xi The subset of factors that remain afterward;
[0107] |S| is the number of influencing factors in S;
[0108] val(S) is a characteristic function, which indicates the degree of influence of the influencing factors in S on the compression factor prediction result through "collaboration". Its value can be calculated by the output of the influencing factors in S on the compression factor prediction model of the influencing factors not included in S:
[0109]
[0110] In the formula, the integral summation operation is performed for each influencing factor in the sample that is not included in S.
[0111] The Shapley value has the properties of validity, symmetry, redundancy and additivity, and the Shapley value that satisfies these four properties exists and is unique. In the problem of tracing the source of compression factor prediction results, the four properties of the Shapley value can be expressed as follows.
[0112] (1) Validity. A sample x i The sum of the Shapley values of all influencing factors in is equal to the difference between the compression factor prediction result based on this sample and the average compression factor prediction result based on all data sets:
[0113]
[0114] (2) Symmetry. If a sample x i There are two influencing factors and If the subsets composed of these two influencing factors and any other identical influencing factors have the same influence on the compression factor, then the Shapley values of these two influencing factors are also the same, that is, for the subset of influencing factors of the compression factor If equation (9) is satisfied, then
[0115]
[0116] (3) Redundancy. If an influencing factor does not contribute to the compression factor prediction results in all influencing factor subsets, the Shapley value of the influencing factor is 0, that is, for all factors except influencing factor x i j A subset of factors affecting the compression factor If the formula x is satisfied, then
[0117]
[0118] (4) Additivity. If multiple compression factor prediction models are trained using the same data set, the average of all model prediction results is used as the final compression factor prediction result. Additivity ensures that the Shapley average calculated based on each prediction model is the contribution of the influencing factor to the final prediction result.
[0119] The four characteristics of the Shapley value can ensure that the contribution of each influencing factor to the compression factor prediction result is fairly distributed among the influencing factors of the compression factor, thereby reflecting the impact of each influencing factor on the compression factor prediction result. The calculation process is as follows:
[0120] (1) Set the initial number of iterations m = 1.
[0121] (2) Randomly select a data sample Z from the data set D.
[0122] (3) x i Randomly arrange the p influencing factors in and generate a new order:
[0123]
[0124] Where: x i,o For sample x i The results after the influencing factors in are re-arranged according to the new order, is the jth influencing factor
[0125] (4) Sort the influencing factors in the randomly selected sample z according to the new arrangement order:
[0126] z o ={z (1) ,z(2) ,…,z (j) ,…,z (p)}(20)
[0127] Where: z o is the result of re-arranging the influencing factors in the randomly selected sample z according to the new arrangement order, z (j) is the jth influencing factor.
[0128] (5) According to x i,o and z o Build Included and Excluded The two new samples are shown in formula (21) and (22) respectively.
[0129]
[0130] Include New sample
[0131] Not included New sample
[0132] (6) Based on the two new samples generated in step 5) and the trained compression factor prediction model Calculate the influencing factors of the mth iteration Contribution to the compression factor prediction results As shown in formula (23)
[0133]
[0134] (7) Let m = m + 1. If m ≤ M, then loop through steps 2) to 6. After M iterations, calculate the influencing factors after M iterations. The average value of the contribution to the compression factor prediction result is obtained The Shapley value of is shown in formula (24):
[0135]
[0136] The Shapley value indicates the degree of influence of the influencing factor on the compression factor prediction result. The larger the absolute value of the Shapley value, the greater the influence of the influencing factor on the prediction result. The average absolute value of the Shapley value of each influencing factor in all samples (represented by n) of the data set D can measure the influence of the influencing factor on the compression factor prediction result, as shown in formula (25).
[0137]
[0138] I jThe influence of influencing factors on the compression factor prediction results;
[0139] The key technical points of the present invention include three aspects:
[0140] (1) We innovatively explored the technology of predicting the compression factor of hydrogen-blended natural gas based on the temperature T, pressure P, and component information of pipeline natural gas, and constructed three prediction models for the compression factor of hydrogen-blended natural gas based on traditional machine learning algorithms. This achieved rapid and accurate calculation of the compression factor of hydrogen-blended natural gas.
[0141] (2) It breaks the constraints of traditional statistical model prediction methods, such as large input data dimensions, high computational overhead, difficulty in dynamic updating, and low prediction accuracy, and realizes innovative applications based on data-driven models.
[0142] (3) Compared with the traditional empirical model, the present invention proposes a model interpretability method based on the Shaply algorithm, which realizes the importance ranking of the input features of the hydrogen-blended natural gas compression factor calculation model and completes the analysis of the degree of influence of the model input features on the output results.
[0143] Solution Examples
[0144] In order to verify the feasibility of this method, 252 sets of sample data sets collected from a natural gas pipeline are used for example analysis. The pipeline natural gas consists of three components: nitrogen, methane, and hydrogen. The data set contains a temperature gradient of 20°C (-10°C-110°C), a pressure gradient of 2MPa (2MPa-12MPa), a methane percentage (45%-85%), a hydrogen percentage (5%-50%), and a compression factor.
[0145] By comparing the prediction performance of different models, it can be found that the present invention can achieve relatively accurate prediction of the compression factor of hydrogen-blended natural gas.
[0146] Table 1 Prediction results of different models
[0147]
[0148] (2) Feature importance analysis based on Shapley value
[0149] The weather condition characteristics of the dataset are shown in Table 1, where different numbers represent different regions.
[0150] Table 2 Weather condition characteristics of the dataset
[0151]
[0152] like Figure 5 As shown in the figure, the variables are sorted according to their average SHAP values, and the order of the variables is temperature, methane ratio, hydrogen ratio, and pressure. Figure 5 It can be seen that the model has 4 input parameters, among which temperature T has the greatest influence on the compressibility factor, and pressure P has the least influence.
[0153] Figure 6 It shows the relationship between a single feature and the model prediction result. The horizontal axis is the feature value, and the vertical axis is the corresponding shap value. The overall trend in the figure shows that as the temperature increases, the shap value increases from negative to positive, indicating that when the temperature value is small, the temperature is negatively correlated with the output. As the temperature value increases, the temperature and the output become positively correlated.
[0154] Explanation: In general, the compressibility factor of a gas decreases as the temperature increases. This is because high temperatures increase the kinetic energy of the gas molecules, causing them to behave more like an ideal gas, meaning the molecules interact less and their volume is closer to that predicted for an ideal gas.
[0155] However, for hydrogen-blended natural gas, the presence of hydrogen changes this trend. Hydrogen is a light gas and its molecular interactions are weaker than other components in natural gas, such as methane. Therefore, the compressibility factor of hydrogen-blended natural gas may be more complexly affected as the hydrogen concentration increases. In some cases, the presence of hydrogen may cause the compressibility factor to increase with increasing temperature, depending on the specific composition and conditions.
[0156] Through the above analysis and comparison, it can be concluded that the established model can relatively accurately predict the compression factor of hydrogen-blended natural gas, and at the same time can fully explore the influence of input characteristics on the compression factor of hydrogen-blended natural gas.
Claims
1. A method for predicting the compression factor of hydrogen-blended natural gas, characterized in that: The following steps are involved: Step S1: data preprocessing; Step S2: constructing a prediction model for the compression factor of hydrogen-blended natural gas based on XGBoost; Step S3: Construct a feature importance analysis model based on Shapley value.
2. The method for predicting the compression factor of hydrogen-blended natural gas according to claim 1, characterized in that: The step S1 comprises the following sub-steps: Sub-step S11: using temperature, pressure, hydrogen doping ratio, and methane ratio as input data, and cleaning the data to achieve data format integration, data alignment, outlier removal, and missing value filling; Sub-step S12: Divide the cleaned data into a training set and a test set.
3. The method for predicting the compression factor of hydrogen-blended natural gas according to claim 1, characterized in that: The step S2 comprises the following sub-steps: Sub-step S21: using the divided training data as input data to train random forest, neural network, and XGBoost machine learning models; Sub-step S22: Evaluate the model through test data and optimize the model.
4. The method for predicting the compression factor of hydrogen-blended natural gas according to claim 1, characterized in that: The S3 comprises the following sub-steps: Sub-step S31: using the Shapley value method for the preferred model; Sub-step S32: Perform interpretability analysis using its feature importance graph and dependency graph to achieve the purpose of building an interpretable machine learning.
