A daily natural gas load forecasting method
By using VMD decomposition and an improved Transformer model, the nonlinearity and complexity of natural gas load data are addressed, enabling accurate prediction of daily natural gas load data and providing efficient prediction for multiple regions.
Patent Information
- Application Number
- CN202311283186.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-07
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2043-10-07
AI Technical Summary
Existing natural gas consumption prediction models struggle to handle nonlinear characteristics, especially in subtropical or tropical regions. Traditional models are inadequate for short-term predictions, artificial intelligence models lack generalization ability and interpretability, and hybrid models suffer from low optimization efficiency.
Variational Mode Decomposition (VMD) is used to decompose natural gas load data. A feature matching degree maximization optimization algorithm is designed to optimize the number of decompositions, and an improved Transformer model is constructed to predict subsequences. By combining feature selection and data reconstruction, accurate prediction of daily natural gas load data can be achieved.
Under conditions of high-complexity load data, the prediction accuracy is improved through decomposition and feature optimization, making it applicable to natural gas load prediction in different regions and reducing the training complexity and time of deep learning algorithms.
Smart Images

Figure CN117251705B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of time series analysis and energy, and specifically relates to a method for predicting daily natural gas load. Background Technology
[0002] As global climate change impacts the human environment, more and more countries are prioritizing the development of low-carbon and green energy. Natural gas, as a clean energy source, plays a crucial supporting role in clean energy systems. The increasing consumption of natural gas necessitates gas companies to accurately and timely predict consumption over different time periods. Models for predicting natural gas consumption are mainly categorized into three types: traditional models, artificial intelligence models, and hybrid models. Traditional models struggle to handle the nonlinear characteristics of natural gas consumption and can only make long-term predictions, not short-term ones. Artificial intelligence models improve the ability to handle nonlinear data, but their generalization ability and interpretability still need improvement. Single algorithms inevitably have limitations when dealing with specific problems; therefore, hybrid models combine different algorithms for optimization, compensating for the shortcomings of individual prediction algorithms. Currently, commonly used sequence decomposition methods include wavelet transform (WT), empirical mode decomposition (EMD), and VMD. Compared to other models, VMD effectively avoids prediction delays. The Transformer model, proposed by Google in 2017, demonstrates powerful modeling capabilities for time series data in the field of NLP, and is increasingly being used by scholars for time series data prediction. Summary of the Invention
[0003] To address the aforementioned technical problems, this invention provides a daily natural gas load forecasting method. This method encompasses the design of a natural gas historical load data and feature selection preprocessing module, a natural gas load data decomposition and feature selection module, and a natural gas load data forecasting module. It can perform data preprocessing and in-depth feature mining even with high load data complexity, and predict the forecast values for each decomposed subsequence separately, thereby achieving accurate forecasting of daily natural gas load data.
[0004] To achieve the above objectives, the present invention adopts the following technical solution:
[0005] A method for predicting daily natural gas load includes the following steps:
[0006] Step (1): Design a preprocessing module for historical natural gas load data and characteristic data, complete the processing of outliers, missing values, and duplicate values in load and characteristic data, perform stationarity and randomness tests, and complete data normalization, including:
[0007] Step (1.1) involves processing outliers, missing values, and duplicate values in the data. This includes first removing detected duplicate values, calculating the standard deviation σ of the natural gas load data, then detecting and deleting outliers according to the 3σ principle, and finally using interpolation to fill missing values by taking the average of the previous and next values.
[0008] Step (1.2) tests the stationarity and randomness of the natural gas load data. The ADF test is used to test the stationarity of the data. If the result is greater than 0, it is determined to be a non-stationary sequence. The Q statistic is constructed to test the randomness of the natural gas load data. If the test result is less than 0.05, it is determined to be a non-pure random sequence, proving that the natural gas load data has significance for analysis and prediction.
[0009] Step (1.3) normalizes the natural gas load data and feature data by using maximum and minimum value normalization to map data of different dimensions to the range [0-1], thereby accelerating the subsequent neural network training speed.
[0010] Step (2): Design a natural gas decomposition and feature selection module to decompose the preprocessed natural gas load data into multiple different subsequences, optimize the number of decompositions, and then perform feature selection on each subsequence, including:
[0011] Step (2.1) uses variational mode decomposition to decompose the natural gas load data into multiple different subsequences before analysis and prediction, thereby reducing the complexity of the natural gas load data;
[0012] Step (2.2) Design a feature matching degree maximization optimization algorithm to optimize the number of subsequences. The original natural gas data is looped from 2 to the number of features, decomposed and the feature matching degree is calculated respectively. After the loop ends, the feature matching degree is compared and the maximum value is taken as the optimization result.
[0013] Step (2.3) calculates the Pearson correlation coefficient by combining the decomposed subsequences with the feature data. The results are considered to be related features if the result is greater than 0.3.
[0014] Step (3): Design a natural gas load data prediction module. First, predict different subsequences, reconstruct the prediction results into signals, and finally obtain the natural gas load data prediction results for the second day, including:
[0015] Step (3.1) Construct an improved Transformer model to predict the subsequences. Replace the original Decoder module of the Transformer model with a fully connected layer to obtain the Transformer prediction model. Train the Transformer prediction model according to the decomposed subsequences and predict each subsequence.
[0016] Step (3.2) reconstructs the prediction results of each subsequence to obtain the final prediction result of the natural gas load for the second day, thereby achieving accurate prediction of the daily natural gas load data.
[0017] Furthermore, it provides natural gas load data applicable to different cities, regions, and enterprises.
[0018] The advantages of this invention compared to the prior art are as follows:
[0019] (1) Most current optimization schemes for the number of decompositions are based on heuristic search algorithms, which have low optimization efficiency and are not suitable for prediction algorithms. The feature matching degree maximization optimization algorithm designed in this invention can make the number of features of each decomposed subsequence as small as possible and close to one, which is beneficial to improving the training speed and accuracy of subsequent deep learning algorithms.
[0020] (2) When a city or region is located in the subtropical or even tropical regions, the natural gas load data is not strongly correlated with temperature, making it difficult to assess influencing factors. The load data exhibits nonlinear and unstable characteristics, making effective data analysis and feature mining challenging. Existing studies have largely focused on data from temperate regions that are highly correlated with temperature, achieving relatively high prediction accuracy. However, when these algorithms are applied to subtropical or tropical regions, the accuracy drops significantly. The method of this invention reduces the complexity of the original data by decomposing it and designs an improved Transformer model to enhance the long-term dependency modeling capability of subsequences, ultimately achieving high prediction accuracy for different regions.
[0021] In summary, this invention first preprocesses historical natural gas load data, then decomposes the original sequence using mode decomposition, and designs an algorithm to optimize the number of decompositions to achieve analysis and feature mining of highly complex data. Furthermore, an improved Transformer model is designed to predict subsequences and synthesize signals, thereby achieving accurate prediction of natural gas load data for the second day. Attached Figure Description
[0022] Figure 1 This is a block diagram of a daily natural gas load forecasting method according to the present invention;
[0023] Figure 2 Here is a flowchart of the VMD algorithm;
[0024] Figure 3 Flowchart of the algorithm for maximizing feature matching degree;
[0025] Figure 4 This is a structural diagram of the Transformer model. Detailed Implementation
[0026] The present invention will now be described in further detail with reference to the accompanying drawings.
[0027] like Figure 1 As shown, this invention relates to a daily natural gas load forecasting method, including the design of a natural gas historical load data and feature selection preprocessing module 1, the design of a natural gas load data decomposition and feature selection module 2, and the design of a natural gas load data forecasting module 3. This method can preprocess and deeply mine the load data when the load data is highly complex, and predict the predicted values of each decomposed subsequence, thereby achieving accurate forecasting of daily natural gas load data.
[0028] like Figure 1 As shown, a daily natural gas load forecasting method of the present invention includes the following steps:
[0029] Step (1) Design a natural gas historical load data and characteristic data preprocessing module 1, which completes the processing of outliers, missing values, and duplicate values in load and characteristic data, performs stationarity and randomness tests, and completes data normalization. The specific implementation is as follows:
[0030] ① To address the issue that the quality of natural gas load data collected by sensors cannot be directly analyzed, outliers, missing values, and duplicate values in the data are processed. First, the detected duplicate values are removed, and the standard deviation σ of the natural gas load data is calculated. Then, outliers are detected and deleted according to the 3σ principle. Finally, the missing values are processed using an interpolation imputation method, and the mean of the previous and subsequent values is used for imputation.
[0031] ② The stationarity and randomness of the natural gas load data are tested. The ADF test is used to test the stationarity of the data. If the result is greater than 0, it is determined to be a non-stationary sequence. The Q statistic follows a chi-square distribution with s degrees of freedom. The Q statistic is constructed to test the randomness of the natural gas load data. If the test result is less than 0.05, it is determined to be a non-purely random sequence, proving that the data has analytical and predictive significance.
[0032] ③ Normalize the natural gas load data and feature data by using maximum and minimum value normalization to map data of different dimensions to the range [0-1], thereby accelerating the subsequent neural network training speed;
[0033]
[0034] Where x is the load data, and min and max are the maximum and minimum values in the load data, respectively. * It is the load data after normalization.
[0035] Step (2) Design natural gas decomposition and feature selection module 2, which decomposes the raw natural gas data into multiple different subsequences, optimizes the number of decompositions, and then performs feature selection on each subsequence. The specific implementation is as follows:
[0036] ① To address the high complexity and nonlinear instability of natural gas load data, Variational Mode Decomposition (VMD) is employed to decompose the natural gas load data into multiple distinct subsequences before analysis and prediction. This effectively reduces data complexity. The VMD algorithm flow is as follows: Figure 2 As shown. The core idea of VMD is to construct and solve a variational problem. First, a variational problem is constructed, assuming that the natural gas load data is decomposed into multiple components, and the component sequence is a modal component with a center frequency and a finite bandwidth. At the same time, the sum of the estimated bandwidths of each mode is minimized, and the constraint condition is that the sum of all modes is equal to the original signal. The constrained variational problem is transformed into an unconstrained variational problem by introducing the Lagrange multiplication operator. The modal components and the center frequency are continuously updated until the convergence condition is met, thus decomposing the natural gas load data into multiple modes.
[0037] ② The number of sequences in the VMD decomposition is manually selected. Therefore, a feature matching degree maximization optimization algorithm is designed to optimize the number of natural gas decomposition sequences. The algorithm flow is as follows: Figure 3 As shown in the diagram. First, the features affecting natural gas load are selected, and the number of decomposition sequences is initialized to 2. The load data is decomposed, and the Pearson correlation coefficient between the subsequences and each feature is calculated and normalized to widen the gap between the maximum and minimum values. Then, the feature matching degree is calculated based on the proportion of the maximum correlation coefficient in the subsequence to the sum of all correlation coefficients. The number of decompositions is increased from 2 to the number of features. The above feature matching degree calculation is performed in sequence. The number of decompositions corresponding to the maximum feature matching degree is the number of decomposition sequences after optimization.
[0038]
[0039]
[0040]
[0041] Among them, u i It is a subsequence obtained by decomposing the load data, Y j It is feature data, ρ ij It is the Pearson correlation coefficient between the subsequence and the feature, P k Here, is the feature matching score for each sequence, m is the number of features, n is the amount of data contained in each feature, i is the index of the subsequence, q is the index of the data in the subsequence, and j is the index of the feature. This represents the q-th data point in the i-th subsequence. This represents the average value of the i-th subsequence. This represents the q-th data point of the j-th feature group. Let z represent the average value of the j-th feature group, where softmax is the normalization exponential function. ij is the Pearson correlation coefficient between the i-th subsequence and the j-th feature after normalization, Max() is the maximum value function, and k is the number of subsequences decomposed from the natural gas load data.
[0042] ③ Calculate the Pearson correlation coefficient by combining the decomposed subsequences with the feature data. The results greater than 0.3 are considered as relevant features.
[0043] Step (3) Design natural gas load data prediction module 3. First, predict different subsequences, reconstruct the prediction results into signals, and finally obtain the natural gas load data prediction results for the second day. The specific implementation is as follows:
[0044] ① Construct an improved Transformer model to predict subsequences. Replace the original Decoder module of the Transformer model with a fully connected layer to obtain a Transformer prediction model. Train the Transformer prediction model according to the decomposed subsequences and predict each subsequence.
[0045] The structure of the Transformer model is as follows: Figure 4 As shown, the first layer is the location encoding layer, which divides the natural gas load data into different input sequences and adds location information. Next is the encoder, which performs multi-head attention calculation to generate a tensor with dimensions (window size, batch size, vector dimension). Then, it goes through residual connections, layer normalization, and feedforward connections. At the same time, the tensor is randomly deactivated. Finally, the decoder consists of a fully connected layer to generate the final prediction result.
[0046] Compared to traditional recurrent neural networks and convolutional neural networks, the Transformer model proposes a novel positional encoding mechanism to capture the time-series information between input data. The principle is to add sine and cosine functions of different frequencies as positional codes to the normalized input sequence. The positional encoding formula is shown below:
[0047]
[0048]
[0049] Where pos is the length of the index sequence, i is the index of the dimension, and d model It is the word vector dimension, and PE represents the position of the sequence.
[0050] Self-attention can be viewed as establishing interaction relationships between different forms of input vectors in a linear projection space. The core process involves calculating attention weights using the query matrix Q and the key-value matrix K, and then applying these weights to the value matrix V to obtain the output. For the inputs Q, K, and V, the formula for calculating the output vector is as follows:
[0051]
[0052] Where T represents the transpose of the matrix, d k The word embedding dimension is represented by , and Attention() represents the attention calculation value.
[0053] Multi-head attention mechanisms involve performing multiple sets of self-attention processing on the original input sequence, and then concatenating the results of each set of self-attention. The calculation formula is as follows:
[0054]
[0055] MultiHead(Q,K,V)=Concat(head1,head2,...,head h W O
[0056] Among them, head i This represents the value of the attention for the i-th group. Let Q, K, and V represent the linear transformation matrices corresponding to the i-th attention group, respectively. MultiHead() represents the output value of the multi-head attention mechanism, and Concat() represents concatenating multiple attention groups. W O This represents the linear transformation matrix during the splicing process.
[0057] The encoder mainly consists of multi-head attention, residual connections and layer normalization, and feedforward connections. Multi-head attention avoids introducing future information. Residual connections are mainly used to solve the training problems of multi-layer networks. Layer normalization makes the mean and variance of the inputs of neurons in each layer consistent, accelerating convergence. The feedforward connection is a two-layer fully connected layer. The activation function of the first layer is ReLU, and no activation function is used in the second layer. A linear layer is used instead of the original decoder structure to directly output the predicted value of natural gas consumption. This reduces the number of training parameters by about half, and to some extent avoids overfitting and reduces the cumulative error of prediction.
[0058] ② The prediction results of each subsequence are reconstructed to obtain the final prediction result of the natural gas load for the second day, thereby achieving accurate prediction of the daily natural gas load data.
[0059] In summary, this invention includes the design of a natural gas historical load data and feature selection preprocessing module, a natural gas load data decomposition and feature selection module, and a natural gas load data prediction module. It can perform data preprocessing and in-depth feature mining even when the load data is highly complex, and predict the predicted values of each decomposed subsequence, thereby achieving accurate prediction of daily natural gas load data.
[0060] The contents not described in detail in this specification are existing technologies known to those skilled in the art.
[0061] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A daily natural gas load forecasting method, characterized by, The feature matching degree maximization optimization algorithm is adopted to make the number of features of each decomposed sub-sequence as small as possible and close to one; by decomposing the original data to reduce its data complexity, and designing an improved Transformer model to improve the long-term dependence modeling capability of the sub-sequence, including the following steps: Step (1), design a natural gas historical load data and feature data preprocessing module, complete the load, feature data outlier, missing value, repeated value processing, perform stationarity and randomness test, and complete data normalization, including: Step (1.1) processing of outliers, missing values, and repeated values of data includes first eliminating detected repeated values, calculating the standard deviation of natural gas load data Then, according to the principle of 3 Outliers are detected and deleted, and finally, the interpolation filling method is used to process the missing values, and the mean of the previous and subsequent values is filled in. Step (1.2) Test the stationarity and randomness of natural gas load data, use ADF test method to test the stationarity of the data, if the result is greater than 0, it is determined as a non-stationary sequence, construct Q statistics to test the randomness of natural gas load data, if the test result is less than 0.05, it is determined as a non-random sequence, which proves that the natural gas load data has the significance of analysis and prediction; Step (1.3) Normalize the natural gas load data and feature data, use the maximum and minimum normalization method to map the data of different dimensions to the range of [0-1], and speed up the subsequent neural network training speed; Step (2), design a natural gas decomposition and feature selection module, decompose the preprocessed natural gas load data into multiple different sub-sequences, and optimize the decomposition number, then select the features of each sub-sequence, including: Step (2.1) Decompose the natural gas load data using variational mode decomposition, and then analyze and predict the decomposed sub-sequences to reduce the complexity of the natural gas load data; Step (2.2) Design a feature matching degree maximization optimization algorithm to optimize the number of sub-sequences, cycle the natural gas original data from 2 to the range of feature number, decompose and calculate the feature matching degree respectively, compare the feature matching degrees after the cycle ends, and take the maximum value as the optimization result; Step (2.3) Calculate the Pearson correlation coefficient of the decomposed sub-sequences combined with the feature data, and the correlation features are the results greater than 0.3; Step (3), design a natural gas load data prediction module, first predict different sub-sequences, reconstruct the prediction results, and finally get the prediction results of the second day's natural gas load data, including: Step (3.1) Construct an improved Transformer model to predict the sub-sequences, replace the original Decoder module of the Transformer model with a fully connected layer to form a Transformer prediction model, and train the Transformer prediction model according to the decomposed sub-sequences, and predict each sub-sequence; Step (3.2) Reconstruct the prediction results of each sub-sequence to get the final prediction results of the second day's natural gas load, and realize the accurate prediction of daily natural gas load data.
2. The daily natural gas load forecasting method of claim 1, wherein, It is suitable for natural gas load data of different cities, regions and enterprises.
Citation Information
Patent Citations
Short-term natural gas load forecasting method based on optimized empirical mode decomposition
CN109359778A
Transformer-based power load prediction method
CN113592185A
Power load prediction method based on VMD-IPSO-GRU
CN116611305A