Regional natural gas long-term demand combined prediction method and device

By classifying and clustering the historical natural gas data in each region, combining the support vector regression model and BP neural network, the applicable prediction model types are determined, which solves the problems of inconsistent and low efficiency of long-term prediction models of natural gas consumption in the existing technology, and achieves efficient and accurate natural gas demand prediction.

CN119692636APending Publication Date: 2025-03-25RICHFIT INFORMATION TECH +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311237059.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-25
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The prior art is difficult to unify and optimize the long-term prediction model of natural gas consumption among various regions, resulting in low prediction efficiency and accuracy.

Method used

A combined prediction method for regional natural gas long-term demand is proposed. By obtaining historical natural gas data from each region, using the elbow method and K-means clustering algorithm for classification and clustering, the support vector regression model and BP neural network are trained respectively, and the applicable prediction model type is determined based on regional characteristics, and the prediction model is combined to improve prediction accuracy.

Benefits of technology

Accurate prediction of natural gas demand in each region is achieved, the prediction efficiency and accuracy of the model are improved, and the prediction models suitable for different types of regions are improved in universality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119692636A_ABST
    Figure CN119692636A_ABST
Patent Text Reader

Abstract

The invention relates to a regional natural gas long-term demand combined prediction method and device, and the method comprises the steps: obtaining a preset number of years of historical natural gas data of each region in a preset region, and dividing the data into a training set and a test set according to a preset proportion; based on the regional feature data, determining a regional classification number by adopting an elbow method; dividing all regions in the preset region by using a K-means clustering algorithm to obtain a region division result; determining a prediction model type suitable for each type of region according to the region division result, the first model test result and the second model test result; and training the support vector regression model based on the historical natural gas data of the regions of which the prediction model types are the support vector regression model, and training the BP neural network based on the historical natural gas data of the regions of which the prediction model types are the BP neural network to obtain a combined prediction model. According to the method, respective applicable prediction models are selected according to classification features, so that the universality is better while the accuracy of the models is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method and a device for combined prediction of regional long-term natural gas demand. Background Art

[0002] In recent years, many scholars have conducted extensive research on the long-term prediction model of natural gas consumption from the perspective of influencing factors and prediction algorithms. The research results have reached a significant conclusion that the factors affecting regional natural gas consumption include gross domestic product (GDP), proportion of gas users, natural gas prices, urbanization rate, industrial structure, energy consumption structure, temperature, etc. However, due to the different economic conditions, development potential, geographical location, and resource conditions of various regions in the region, the main influencing factors of each region are not exactly the same, and a single model is often not necessarily applicable to all regions. Summary of the invention

[0003] In order to provide a regional natural gas demand forecasting method applicable to various regions in the region, realize the unification of methods and model optimization for long-term demand forecasting of the natural gas market, and improve the model forecasting efficiency and accuracy, the present invention proposes a regional natural gas long-term demand combined forecasting method and device. The technical solution proposed by the present invention is as follows:

[0004] In a first aspect, the present invention provides a method for combined forecasting of regional long-term natural gas demand, comprising:

[0005] Acquire historical natural gas data of a preset number of years in each region within a preset area, and divide the historical natural gas data into a training set and a test set according to a preset ratio; wherein the historical natural gas data includes regional characteristic data related to natural gas demand forecasting;

[0006] Based on the regional characteristic data, the number of regional classifications within the preset area is determined by using the elbow method;

[0007] Based on the historical natural gas data and the number of regional classifications, all regions in the preset area are divided using a K-means clustering algorithm to obtain a regional division result;

[0008] Use the training sets of all regions to train the pre-built support vector regression model and BP neural network respectively to obtain the corresponding first initial model and second initial model;

[0009] For each region, use its test set to test the first initial model and the second initial model respectively, and obtain corresponding first model test results and second model test results;

[0010] Determine the type of prediction model applicable to each type of region according to the regional division result, the first model test result and the second model test result;

[0011] Based on the historical natural gas data of all regions where the prediction model type is the support vector regression model, the support vector regression model is trained, and based on the historical natural gas data of all regions where the prediction model type is the BP neural network, the BP neural network is trained to obtain a combined prediction model;

[0012] The combined forecasting model is used to forecast the long-term regional natural gas demand.

[0013] In one or some embodiments, based on the historical natural gas data and the number of regional classifications, all regions in the preset area are divided using a K-means clustering algorithm to obtain a regional division result, including:

[0014] Performing qualitative and quantitative evaluation on each indicator in the historical natural gas data to obtain first characteristic dimension data and second characteristic dimension data;

[0015] According to the first feature dimension data and the second feature dimension data, the historical natural gas data is encoded using one-hot encoding to obtain encoded data;

[0016] Based on the encoded data and the number of regional classifications, all regions in the preset area are divided using a K-means clustering algorithm to obtain a regional division result.

[0017] In one or some embodiments, based on the historical natural gas data and the number of regional classifications, all regions in the preset area are divided using a K-means clustering algorithm to obtain a regional division result, including:

[0018] Based on the historical natural gas data and the number of regional classifications, all regions in the preset area are clustered using a K-means clustering algorithm to obtain a clustering result;

[0019] According to the clustering result, key feature data is obtained from the regional feature data;

[0020] According to the key feature data, all regions in the preset area are divided to obtain a region division result.

[0021] In one or some embodiments, the key characteristic data includes GDP and natural gas consumption; and the regional division results obtained by dividing all regions in the preset area according to the key characteristic data include:

[0022] According to the GDP and natural gas consumption, all regions in the preset area are divided to obtain regional division results.

[0023] In one or some embodiments, the step of obtaining historical natural gas data of a preset number of years in each region within a preset area and dividing the historical natural gas data into a training set and a test set according to a preset ratio includes:

[0024] The historical natural gas data of a preset number of years in each region within a preset area is obtained, the annual quantity ratio of the training set and the test set is set to the preset ratio, and the training set and the test set are obtained by time series division.

[0025] In one or some embodiments, the combined prediction model includes a first prediction model, and the first prediction model is trained in the following manner, including:

[0026] Input the training sets of all regions whose prediction model type is support vector regression model into the support vector regression model, and optimize the model parameters by the objective function of the following formula to obtain a first prediction model;

[0027]

[0028] Among them, ξ i and The value of is:

[0029]

[0030]

[0031] In the formula, ξ i and represents the slack variable; c represents the penalty factor; f(x)=ωx+b represents the model function; ω represents the weight vector; y represents the actual demand; x represents the sample data in the training set; b represents the threshold; ε represents the maximum allowable error; f(x)+ε, f(x)-ε represent the upper and lower edges of the isolation zone respectively; i=1,2,...,l; l represents the number of samples in the training set.

[0032] In one or some embodiments, the combined prediction model includes a second prediction model, and the second prediction model is trained in the following manner:

[0033] Input the training sets of all regions whose prediction model type is BP neural network into the BP neural network as follows to obtain the model output results:

[0034]

[0035] O=HW o +b o

[0036] In the formula, O represents the model output result; H represents the output of the hidden layer; represents the hidden layer activation function; X represents the sample data in the training set; W h represents the weight between the input layer and the hidden layer; W o represents the weight between the hidden layer and the output layer; b h represents the bias of the hidden layer; b o represents the bias of the output layer;

[0037] Determine a loss function according to the model output result and the actual demand, optimize the model parameters of the BP neural network based on the loss function, and obtain an optimized model;

[0038] The optimized model is tested using a test set, and the accuracy is determined according to a preset accuracy function;

[0039] If the accuracy rate does not reach the preset threshold, the process of optimizing the model parameters is repeated, and the learning rate and batch size parameters are adjusted until the accuracy rate reaches the preset threshold, and the training is stopped to obtain the second prediction model.

[0040] In one or some embodiments, the method further comprises:

[0041] According to the constraints, the following Lagrangian function is constructed:

[0042]

[0043] Where L represents the Lagrangian function; α i and α i * represents the Lagrange multiplier;

[0044] The model parameters of the support vector regression model are optimized through the objective function as follows:

[0045]

[0046] In one or some embodiments, before obtaining historical natural gas data of a preset number of years in each region within a preset area and dividing the historical natural gas data into a training set and a test set according to a preset ratio, the method further includes:

[0047] Invalid, repeated, and redundant data in the historical natural gas data are removed, and missing values ​​are filled to obtain preprocessed natural gas data.

[0048] In one or some embodiments, the missing values ​​in the historical natural gas data are filled in the following manner:

[0049] The following formula is used to fill the missing values ​​in the historical natural gas data so that each interpolation abscissa x iSubstituting the following formula, the polynomial has i terms left, and the Newton interpolation polynomial controlling the i term is equal to f(x i ):

[0050]

[0051] In the formula, represents the Newton interpolation polynomial; f[x0,x1,...,x n ] represents the difference quotient,

[0052] In a second aspect, the present invention provides a regional natural gas long-term demand combined forecasting device, comprising:

[0053] A partitioning module, used to obtain historical natural gas data of a preset number of years in each region within a preset area, and to partition the historical natural gas data into a training set and a test set according to a preset ratio; wherein the historical natural gas data includes regional characteristic data related to natural gas demand forecasting;

[0054] A classification module, used for determining the number of regional classifications within the preset area by using an elbow method based on the regional characteristic data;

[0055] A clustering module, for dividing all regions in the preset area by using a K-means clustering algorithm based on the historical natural gas data and the number of regional classifications to obtain a regional division result;

[0056] A first training module is used to use the training sets of all regions to respectively train the pre-built support vector regression model and BP neural network to obtain the corresponding first initial model and second initial model;

[0057] A testing module, for testing the first initial model and the second initial model respectively using the test set of each region to obtain corresponding first model test results and second model test results;

[0058] A selection module, used to determine the type of prediction model applicable to each type of region according to the region division result, the first model test result and the second model test result;

[0059] A second training module is used to train the support vector regression model based on the historical natural gas data of all regions where the prediction model type is the support vector regression model, and to train the BP neural network based on the historical natural gas data of all regions where the prediction model type is the BP neural network, so as to obtain a combined prediction model;

[0060] The forecasting module is used to forecast the long-term regional natural gas demand by using the combined forecasting model.

[0061] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for combined forecasting of regional natural gas long-term demand as described in the first aspect.

[0062] In a fourth aspect, the present invention provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0063] Memory, used to store computer programs;

[0064] The processor is used to implement the regional natural gas long-term demand combination forecasting method as described in the first aspect when executing the program stored in the memory.

[0065] Based on the above technical solution, the beneficial effects of the present invention compared with the prior art are as follows:

[0066] The method for combined prediction of regional natural gas long-term demand provided by the embodiment of the present invention is to determine the number of regional classifications in a preset area by the elbow method based on regional characteristic data, so as to classify the regions in the region according to regional characteristics; secondly, based on historical natural gas data and the determined number of regional classifications, all regions in the preset area are divided by the K-means clustering algorithm to obtain regional division results, so as to realize regional division in the preset area; then, the support vector regression model and the BP neural network are trained respectively by using the training sets of all regions, and the first model test results and the second model test results are tested, and the type of prediction model applicable to each type of region is determined according to the regional division results, the first model test results and the second model test results. The method classifies the regions in the region based on regional characteristics, and adopts applicable prediction models for different types of regions. Moreover, since the number of samples in the training set is at the annual level, the present invention adjusts and optimizes the model parameters under a certain time span, thereby improving the combined prediction effect. For the regions suitable for BP neural network after clustering, putting their training sets into BP model for training is equivalent to optimizing the initial value, obtaining the corresponding prediction model for this type of region, and improving the accuracy of the prediction results of the retrained BP neural network; for the regions suitable for support vector regression model after clustering, putting their training sets into support vector regression model for training is equivalent to optimizing the initial value, obtaining the corresponding prediction model for this type of region, and improving the accuracy of the prediction results of the retrained support vector regression model. The prediction models of all regions are combined to obtain a combined prediction model, and the classification features are used to select the applicable prediction models instead of the weighted combination of models, avoiding the problem of different model weights in different regions, ensuring the accuracy of the model while improving the versatility. In addition, the combined prediction model can be used to predict the natural gas demand in each region in parallel, improving the prediction efficiency.

[0067] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0068] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0070] Figure 1 It is a flow chart of a method for combined prediction of regional natural gas long-term demand provided by an embodiment of the present invention;

[0071] Figure 2 It is a schematic diagram of the structure of a BP neural network provided by an embodiment of the present invention;

[0072] Figure 3 It is a schematic diagram of the flow of the BP neural network algorithm provided by an embodiment of the present invention;

[0073] Figure 4 is a schematic diagram of the result of determining the number of regional classifications using the elbow method provided by an embodiment of the present invention;

[0074] Figure 5 This is a prediction result diagram of the support vector regression model for region F provided by an embodiment of the present invention;

[0075] Figure 6 This is a comparison diagram of the prediction results errors between the SVR model and the BP neural network provided by the embodiment of the present invention;

[0076] Figure 7 It is a schematic diagram of the structure of a combined forecasting device for regional natural gas long-term demand;

[0077] Figure 8 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention; DETAILED DESCRIPTION

[0078] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0079] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0080] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0081] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0082] In recent years, many scholars have conducted extensive research on the long-term prediction model of natural gas consumption from the perspective of influencing factors and prediction algorithms. The research results have reached a significant conclusion that the factors affecting regional natural gas consumption include gross domestic product (GDP), proportion of gas users, natural gas prices, urbanization rate, industrial structure, energy consumption structure, temperature, etc. However, due to the different economic conditions, development potential, geographical location, and resource conditions of various regions, the main influencing factors of each region are not exactly the same, and a single model is often not necessarily applicable to all regions.

[0083] The inventor found in his work that the commonly used prediction models include multiple linear regression model, time series model, gray model and variant, long short-term memory network (LSTM), support vector regression model, BP neural network and other machine learning models. Each model has different characteristics, different data information and methods, and each has its own advantages and disadvantages. The appropriate model should be selected according to the different usage scenarios. The multiple linear regression model can calculate the result as long as the standard statistical method is adopted. The method is simple and easy to use, but the selection of factors is only a speculation, which limits the analysis in some cases. While predicting the trend of change, the time series model pays attention to the influence of seasonal and cyclical changes on specific time points, making the prediction results more accurate, but only using time as an analysis factor, without considering the influence of other factors. The gray prediction model is an effective tool for processing small sample prediction problems. When processing less eigenvalue data, it does not require the sample space of the data to be large enough, and can solve the problems of few historical data, integrity of the sequence and low reliability, but it is only suitable for medium- and short-term predictions, and is only suitable for predictions of approximate exponential growth. The long short-term memory network (LSTM) is a variant of the traditional RNN (recurrent neural network). Compared with the classic RNN, it improves the long-term dependency problem in the RNN. By introducing the gating unit, it can effectively capture the association between long sequences and alleviate the gradient disappearance or explosion phenomenon. However, due to the relatively complex internal structure, the calculation is time-consuming. For the annual natural gas consumption forecast, it is affected by many factors, has a certain volatility, and the amount of historical data is small. The above models are limited by their own characteristics and have low prediction accuracy. At the same time, different regions have different gas consumption structure characteristics, and it is difficult to find a model that is applicable to all regions, which cannot meet the inventor's expectations. After further research and development, the inventor made the present invention.

[0084] Embodiment 1

[0085] In order to overcome the above shortcomings, the present invention provides a regional natural gas long-term demand combination forecasting method, and the technical solution is a regional natural gas long-term demand combination forecasting method based on clustering improvement. This method classifies the regions in the region based on regional characteristics, adopts applicable forecasting models for each region according to the characteristics of different types of regions, and adjusts and optimizes the model parameters under a certain time span to improve the combined forecasting effect; selects the applicable models for each region based on classification characteristics rather than the weighted combination of models, avoiding the problem of different weights of models in different regions, ensuring the accuracy of the model while improving versatility.

[0086] The embodiment of the present invention provides a method for combining regional natural gas long-term demand forecasting, referring to Figure 1 As shown, including:

[0087] S101, obtaining historical natural gas data of a preset number of years in each region within a preset area, and dividing the historical natural gas data into a training set and a test set according to a preset ratio; wherein the historical natural gas data includes regional characteristic data related to natural gas demand forecasting;

[0088] Acquire regional historical natural gas data, including historical natural gas consumption and regional characteristic data related to natural gas demand forecast. The present invention downloads historical natural gas consumption and related regional characteristic data from platforms such as local statistical bureaus and energy bureaus to observe the changing trend and dependency of historical natural gas consumption. The integrity, accuracy and availability of data are the key to prediction. In order to ensure the accuracy of the results, this paper collects as much relevant regional characteristic data as possible from official and authoritative channels: GDP-related characteristics (total GDP, primary industry GDP, secondary industry GDP, tertiary industry GDP, per capita GDP), population-related characteristics (total population, urban population, gas-using population, urbanization rate, population density), energy consumption-related characteristics (total energy consumption, natural gas consumption, electricity consumption, energy consumption structure), energy price-related characteristics (natural gas price, electricity price).

[0089] S102, based on the regional characteristic data, using the elbow method to determine the number of regional categories in the preset area;

[0090] The idea of ​​the elbow classification method is that as the number of clusters K increases, the sample division will become more refined, the degree of aggregation of each cluster will gradually increase, and the sum of squared errors (SSE) will gradually decrease. When the number of clusters does not reach the optimal number K, the increase in K will greatly increase the degree of aggregation of each cluster, so the decrease in SSE will be large. When K reaches the optimal number, the return of the degree of aggregation obtained by increasing K will rapidly decrease, so the decrease in SSE will drop sharply, and then tend to be flat as the K value continues to increase. Therefore, the K value corresponding to the elbow is determined to be the actual number of clusters of the data. The sum of squared errors (SSE) is determined by the following formula:

[0091]

[0092] Among them, C i is the i-th cluster, p is C i The sample points in m i It is C i The centroid of a cluster is the mean of all samples in a cluster.

[0093] The specific method is to let K start from 1 until it reaches the preset number threshold, cluster each K value and record the corresponding SSE, and then draw a reference Figure 4The relationship between K and SSE is shown in the figure. Finally, K corresponding to the elbow is selected as the optimal cluster number to obtain the number of regional classifications. Figure 3 For example, the determined K value, i.e. the number of regional classifications, is 2.

[0094] S103, based on the historical natural gas data and the number of regional classifications, using a K-means clustering algorithm to divide all regions in the preset area to obtain a regional division result;

[0095] The regions in the prediction area are classified according to regional characteristics, and the similarity between regions is calculated using the K-means clustering algorithm. Specifically, based on the regional characteristic data collected in step S101 and the number of regional classifications determined in step S102, the K-means clustering algorithm is used to calculate the similarity between regions.

[0096] The K-means algorithm is the most widely used clustering algorithm with high accuracy. It uses distance as the similarity evaluation index and uses Euclidean distance as the similarity measure by default, that is, the closer the distance between two objects, the greater their similarity, so that objects with high similarity are classified into the same cluster.

[0097] Assume that a given data sample X contains n objects X = {X1, X2, X3, ..., X n}, where each object has attributes of m dimensions. First, initialize k cluster centers {C1, C2, C3, ..., C k}, 1<k≤n, then, the Euclidean distance from each object to each cluster center is calculated as shown in the following formula:

[0098]

[0099] In the above formula, X i represents the i-th object 1≤i≤n, C j represents the jth cluster center 1≤j≤k, X it represents the tth attribute of the ith object, 1≤t≤m, C jt represents the tth attribute of the jth cluster center. Compare the distance from each object to each cluster center in turn, assign the object to the cluster closest to the cluster center, and obtain k clusters {S1, S2, S3, ..., S k}.

[0100] The K-means algorithm defines the prototype of the cluster with the center. The cluster center is the mean of all objects in the cluster in each dimension. The calculation formula is as follows:

[0101]

[0102] In the above formula, Cl represents the center of the lth cluster, 1≤l≤k, |S l | represents the number of objects in the lth cluster, B w represents the wth object in the lth cluster, 1≤w≤|S l |

[0103] When performing clustering calculations, the present invention does not directly expand all the data of a region into a vector for direct clustering, but first performs qualitative division of the data. Each region contains multiple features and many years of historical data, which includes the time series characteristics of the data. Each indicator is qualitatively characterized from the numerical value and the change trend. The numerical value is divided into three categories according to the interval: small, medium, and large. The trend change is evaluated according to four indicators: slow rise, rapid rise, stable, and fluctuating. After the indicator data of each region is divided according to the qualitative indicators, these disordered and discrete attribute features are further encoded using unique hot encoding, and then the K-means specific clustering analysis stated above is performed on each region in the region, and the appropriate prediction model for each region is determined according to the regional classification results. In an optional embodiment, the above step S103 is described in which all regions in the preset region are divided using the K-means clustering algorithm based on the historical natural gas data and the number of regional classifications to obtain regional division results, including:

[0104] S1031, performing qualitative evaluation and quantitative evaluation on each indicator in the historical natural gas data to obtain first characteristic dimension data and second characteristic dimension data;

[0105] Historical natural gas data include the following indicators: GDP-related characteristics (total GDP, primary industry GDP, secondary industry GDP, tertiary industry GDP, per capita GDP), population-related characteristics (total population, urban population, gas-using population, urbanization rate, population density), energy consumption-related characteristics (total energy consumption, natural gas consumption, electricity consumption, energy consumption structure), energy price-related characteristics (natural gas price, electricity price). Each indicator is qualitatively and quantitatively divided. Taking total GDP as an example, the value size is divided into three categories of high, medium and low according to the interval to obtain the first characteristic dimension data; the trend is divided into four indicators of rapid rise, slow rise, fluctuation and stability to obtain the second characteristic dimension data.

[0106] S1032. Encode the historical natural gas data using one-hot encoding according to the first feature dimension data and the second feature dimension data to obtain encoded data;

[0107] Taking total GDP as an example, the value size is divided into three characteristics: high, medium, and low according to the interval: high=>100, medium=>010, low=>001; the change trend of GDP is divided into four characteristics: rapid increase, slow increase, some fluctuation, and stable: rapid increase=>10000, slow increase=>0100, some fluctuation=>0010, stable=>0001. Therefore, if the characteristics of a city's total GDP are "high" and "rapid increase", the unique hot encoding result of this city's total GDP is [1, 0, 0, 1, 0, 0, 0, 0].

[0108] In machine learning algorithms such as clustering, the calculation of distance or similarity between features is very important. Commonly used distance or similarity calculations are similarity calculations in Euclidean space. The calculation of cosine similarity is based on Euclidean space. Taking the energy structure type as an example, it is a discrete feature. The energy structure is quantitatively divided into three types: stable, fluctuating and unstable. When one-hot encoding is not used, the values ​​are expressed as: x1=1, x2=2, x3=3. Then, d(x1.x2)=1, d(x2,x3)=1, d(x1,x3)=2, and the calculated distances between energy structure types are different. Performing one-hot encoding, we get x1=(1,0,0)1, x2=(0,1,0), x3=(0,0,1). The distances between the two energy structure types are The distances between the two energy structure types are the same. After one-hot encoding, the present invention expands the values ​​of discrete features to the Euclidean space, and a certain value of the discrete feature corresponds to a certain point in the Euclidean space.

[0109] S1033. Based on the encoded data and the number of regional classifications, all regions in the preset area are divided using a K-means clustering algorithm to obtain a regional division result.

[0110] S104, using the training sets of all regions to respectively train the pre-built support vector regression model and BP neural network to obtain the corresponding first initial model and second initial model;

[0111] The support vector regression model creates an "interval band" on both sides of the linear function. For all samples falling into the interval band, no loss is calculated. Only samples outside the interval band are included in the loss function. The model is optimized by maximizing the width of the interval band and minimizing the total loss. When processing data in high-dimensional space, it has high accuracy and robustness. When dealing with nonlinear problems, the data is mapped to the high-dimensional space through the kernel function, making the data easier to separate. By controlling the number of support vectors, the overfitting problem can be effectively avoided. For small sample data sets, it has good generalization ability. In general, SVR is a powerful regression analysis method that can effectively deal with nonlinear problems and small sample data sets, which is very consistent with the application scenario of regional natural gas demand forecasting. BP neural network is a multi-layer feedforward neural network based on error back propagation. It takes the square of the network error as the objective function and uses the gradient descent method to calculate the minimum value of the objective function. It can self-learn and adapt well, has excellent nonlinear mapping capabilities, and a flexible network structure with multi-dimensional features. It can accurately capture the trend of changes and improve the prediction accuracy. It is widely used in the research and application of power and natural gas load forecasting. Therefore, the present invention selects support vector regression model and BP neural network to predict regional natural gas demand.

[0112] The training sets of all regions are input into the pre-constructed support vector regression model and BP neural network, and the pre-constructed support vector regression model and BP neural network are trained respectively to obtain the corresponding first initial model and second initial model.

[0113] S105: for each region, use its test set to test the first initial model and the second initial model respectively, and obtain corresponding first model test results and second model test results;

[0114] After obtaining the first initial model and the second initial model, the first initial model is tested using the test set of each region to obtain the test results of the first model in each region; the second initial model is tested using the test set of each region to obtain the test results of the second model in each region.

[0115] S106, determining the type of prediction model applicable to each type of region according to the region division result, the first model test result and the second model test result;

[0116] The preset area is divided into at least two types of regions through the above step S102. By comparing the regional division results with the first model test results and the second model test results obtained by the support vector regression model and the BP neural network, the model applicable to each type of region can be determined. The mean absolute percentage error (MAPE) of the first model test result and the second model test result is determined by comparing the MAPE of different types of regions to determine the type of prediction model applicable to different types of regions. Due to the different energy structures, economic development and policy planning in various regions, it is impossible to establish an accurate natural gas consumption prediction model. The present invention uses the K-means clustering model to divide the various regions in the region from the characteristics of macroeconomics, energy structure, natural gas consumption, etc. Among them, the natural gas consumption in regions with high economic levels, complete industrial systems, and stable energy structures has steadily increased, and is more suitable for support vector regression models, while regions with other characteristics are more suitable for BP neural networks.

[0117] S107, training the support vector regression model based on the historical natural gas data of all regions where the prediction model type is the support vector regression model, and training the BP neural network based on the historical natural gas data of all regions where the prediction model type is the BP neural network, to obtain a combined prediction model;

[0118] Based on the historical natural gas data of all regions where the prediction model type is a support vector regression model, the support vector regression model is trained to obtain a first prediction model; based on the historical natural gas data of all regions where the prediction model type is a support vector regression model, the support vector regression model is trained to obtain a second prediction model, and the first prediction model is combined with the second prediction model to obtain a combined prediction model for the region.

[0119] S108. Predicting the long-term regional natural gas demand using the combined prediction model.

[0120] The present invention is applicable to the fields of demand forecasting and natural gas, and in particular, to a method and system for combined forecasting of regional natural gas long-term demand based on clustering improvement. Due to different energy structures, economic development and policy planning in different regions, it is impossible to establish an accurate natural gas consumption forecasting model. The improvement of the present invention is embodied in that the number of regional classifications is first determined by the elbow method. Then, the K-means clustering algorithm is used to divide the various regions in the region from the characteristics of macroeconomics, energy structure, natural gas consumption, etc. to obtain regional division results. According to the regional division results, the first model test results and the second model test results, the type of forecasting model applicable to each type of region is determined respectively. The method for combined forecasting of regional natural gas long-term demand provided by the present invention is used to more generally predict the long-term demand for regional natural gas, adopt the same forecasting model to realize the forecast of natural gas demand in the same type of region, realize the unification of methods and model optimization for the long-term demand forecasting of the natural gas market, improve the model forecasting efficiency and accuracy, and provide effective support for guaranteeing the natural gas load in various regions.

[0121] The method for combined prediction of regional natural gas long-term demand provided by the embodiment of the present invention is to determine the number of regional classifications in a preset area by the elbow method based on regional characteristic data, so as to classify the regions in the region according to regional characteristics; secondly, based on historical natural gas data and the determined number of regional classifications, all regions in the preset area are divided by the K-means clustering algorithm to obtain regional division results, so as to realize regional division in the preset area; then, the support vector regression model and the BP neural network are trained respectively by using the training sets of all regions, and the first model test results and the second model test results are tested, and the type of prediction model applicable to each type of region is determined according to the regional division results, the first model test results and the second model test results. The method classifies the regions in the region based on regional characteristics, and adopts applicable prediction models for different types of regions. Moreover, since the number of samples in the training set is at the annual level, the present invention adjusts and optimizes the model parameters under a certain time span, thereby improving the combined prediction effect. For the regions suitable for BP neural network after clustering, putting their training sets into BP model for training is equivalent to optimizing the initial value, obtaining the corresponding prediction model for this type of region, and improving the accuracy of the prediction results of the retrained BP neural network; for the regions suitable for support vector regression model after clustering, putting their training sets into support vector regression model for training is equivalent to optimizing the initial value, obtaining the corresponding prediction model for this type of region, and improving the accuracy of the prediction results of the retrained support vector regression model. The prediction models of all regions are combined to obtain a combined prediction model, and the classification features are used to select the applicable prediction models instead of the weighted combination of models, avoiding the problem of different model weights in different regions, ensuring the accuracy of the model while improving the versatility. In addition, the combined prediction model can be used to predict the natural gas demand in each region in parallel, improving the prediction efficiency.

[0122] In an optional embodiment, before obtaining historical natural gas data of various regions in a preset area in step S101 and dividing the historical natural gas data into a training set and a test set according to a preset ratio, the method further includes:

[0123] Invalid, repeated, and redundant data in the historical natural gas data are removed, and missing values ​​are filled to obtain preprocessed natural gas data.

[0124] Preprocess the regional characteristic data. The quality of data preprocessing will affect the effect of the entire model. Preprocessing first cleans the data, checks and deletes invalid, duplicate, and redundant data to avoid bias and errors introduced by the existence of erroneous data in subsequent research, and ensure the accuracy and reliability of the data. For outliers, determine the cause of the occurrence. If it is noise data, directly eliminate it. If it is abnormal behavior, conduct further in-depth analysis. Secondly, perform data integration and transformation. Specifically, all data are integrated and stored in a relational database, tables are established according to logic, the data type of each feature is defined, the same type of features are converted into a unified unit, and simple calculations are performed on numerical data, such as total and population per capita values, cumulative annual values ​​of various values, etc. For ordinal data, use serial number coding; for fixed type data, use unique hot coding. After category conversion, all data are converted to numerical types.

[0125] In an optional embodiment, for missing data, since the amount of characteristic data collected by the present invention is not large enough, part of the missing data may cause deviations in the model results, increasing uncertainty, so the missing values ​​need to be filled. The missing values ​​in the historical natural gas data are filled in the following way:

[0126] The following formula is used to fill the missing values ​​in the historical natural gas data so that each interpolation abscissa x i Substituting the following formula, the polynomial has i terms left, and the Newton interpolation polynomial controlling the i term is equal to f(x i ):

[0127]

[0128] In the formula, represents the Newton interpolation polynomial; f[x0,x1,...,x n ] represents the difference quotient,

[0129] In an optional embodiment, the step S101 of obtaining historical natural gas data of a preset number of years for each region in a preset area and dividing the historical natural gas data into a training set and a test set according to a preset ratio includes:

[0130] S1011. Obtain historical natural gas data of a preset number of years in each region within a preset area, set the annual quantity ratio of the training set and the test set to the preset ratio, and obtain the training set and the test set according to time series division.

[0131] Since natural gas consumption has a certain time series correlation, historical natural gas consumption has an impact on future natural gas consumption. Therefore, the present invention cannot divide the training set and the test set by random division. Instead, the data at the end of the time period should be used as the test set. Taking the data from 2011 to 2020 as an example, the training set and the test set are divided in a ratio of 8:2. The data from 2011 to 2018 is used as the training set, and the data from 2019 to 2020 is used as the test set.

[0132] In an optional embodiment, the above step S103 divides all regions in the preset area based on the historical natural gas data and the number of regional classifications using a K-means clustering algorithm to obtain a regional division result, including:

[0133] S1031, based on the historical natural gas data and the number of regional classifications, clustering all regions in the preset area using a K-means clustering algorithm to obtain a clustering result;

[0134] The clustering algorithm analyzes the similarities between regions from the perspectives of values, trends, structures, etc., sets the number of clusters to the number of regional classifications obtained in the above step S102, and performs clustering to obtain clustering results.

[0135] S1032, acquiring key feature data from the regional feature data according to the clustering result;

[0136] The output results of the clustering model will show the importance ranking of each predictor variable. The feature data of the top predictor variables in importance ranking are obtained from the clustering results to obtain the key feature data.

[0137] S1033. Divide all regions in the preset area according to the key feature data to obtain a region division result.

[0138] According to the values ​​of the key feature data of each region, the preset region is divided into regions, and the number of divided region types is the number of region classifications determined in the above step S102. A region type has a higher key feature data, and a region type has a lower key feature data.

[0139] In an optional embodiment, the key characteristic data includes GDP and natural gas consumption; the above S1033, dividing all regions in the preset area according to the key characteristic data to obtain a regional division result, includes:

[0140] According to the GDP and natural gas consumption, all regions in the preset area are divided to obtain regional division results.

[0141] All regions within the preset area are classified according to GDP and natural gas consumption. Those regions with GDP at the top of the preset area and natural gas consumption at a level of long-term stable growth or rapid growth are Type I, and the others are Type II.

[0142] In an optional embodiment, the combined prediction model includes a first prediction model, and the first prediction model is trained in the following manner, including:

[0143] S201, inputting the training sets of all regions whose prediction model type is support vector regression model into the support vector regression model, optimizing the model parameters by the objective function of the following formula, and obtaining a first prediction model;

[0144]

[0145] Among them, ξ i and The value of is:

[0146]

[0147]

[0148] In the formula, ξ i and represents the slack variable; c represents the penalty factor; f(x)=ωx+b represents the model function; ω represents the weight vector; y represents the actual demand; x represents the sample data in the training set; b represents the threshold; ε represents the maximum allowable error; f(x)+ε, f(x)-ε represent the upper and lower edges of the isolation zone respectively; i=1,2,...,l; l represents the number of samples in the training set.

[0149] In an optional embodiment, the method further includes:

[0150] In order to minimize the objective function, according to the constraints, the following Lagrangian function is constructed:

[0151]

[0152] Where L represents the Lagrangian function; α i and α i * represents the Lagrange multiplier; the original problem can be transformed into:

[0153]

[0154] The model parameters of the support vector regression model are optimized through the objective function as follows:

[0155]

[0156] For ω, b, ξ i , Find the partial derivative and set it to 0:

[0157]

[0158] Find the regression model coefficients ω,b.

[0159] The process of training the support vector regression model to obtain the first initial model in the above step S104 is similar to the method of training to obtain the first prediction model, which will not be repeated here.

[0160] Reference Figure 2 The BP neural network structure is shown in Figure 1. The calculation process of the BP neural network is shown in Figure 1. Figure 3 As shown, it consists of a forward calculation signal propagation process and a reverse calculation error propagation process. In the forward propagation process, the input pattern is processed layer by layer from the input layer through the hidden unit layer and transferred to the output layer. The state of each layer of neurons only affects the state of the next layer of neurons. If the expected output cannot be obtained in the output layer, reverse propagation is entered to return the error signal along the original connection path, and the error signal is minimized by modifying the weights of each neuron. In an optional embodiment, the combined prediction model includes a second prediction model, which is trained in the following manner:

[0161] S301, input the training sets of all regions whose prediction model type is BP neural network into the BP neural network of the following formula to obtain the model output result:

[0162]

[0163] O=HW o +b o

[0164] In the formula, O represents the model output result; H represents the output of the hidden layer; represents the hidden layer activation function; X represents the sample data in the training set; W h represents the weight between the input layer and the hidden layer; W o represents the weight between the hidden layer and the output layer; b h represents the bias of the hidden layer; b o represents the bias of the output layer;

[0165] S302, determining a loss function according to the model output result and the actual demand, optimizing the model parameters of the BP neural network based on the loss function, and obtaining an optimized model;

[0166] S303, testing the optimized model using a test set, and determining the accuracy according to a preset accuracy function;

[0167] S304: If the accuracy rate does not reach the preset threshold, repeat the process of optimizing the model parameters, and adjust the learning rate and batch size parameters until the accuracy rate reaches the preset threshold, stop training, and obtain a second prediction model.

[0168] If the accuracy rate does not reach the preset threshold, the above steps S302-S303 are repeated until the accuracy rate reaches the preset threshold, and the training is stopped to obtain the second prediction model. The present invention adjusts the learning rate and batch_size according to the change trend of the loss function Loss and the accuracy function Acc, uses the optimizer instead of the gradient descent, optimizes the BP neural network effect, and improves the accuracy rate and training efficiency. Batch_size refers to the number of data samples used for training at a time.

[0169] The process of training the BP neural network to obtain the second initial model in the above step S104 is similar to the method of training to obtain the second prediction model, which will not be repeated here.

[0170] In order to more clearly illustrate the regional natural gas long-term demand combination forecasting method provided by the embodiment of the present invention and verify the accuracy of the method, the regional natural gas long-term demand combination forecasting method is applied to a certain region.

[0171] The present invention is applied to the prediction of regional natural gas long-term demand. A certain region is selected as an implementation example to establish a regional natural gas long-term demand prediction model. The economic foundation, population status, and energy situation of different regions in the region have different influencing factors on natural gas demand. Therefore, the clustering model K-means algorithm is selected to mine the similarities of natural gas consumption, economic development status, population and other data between regions, and the regions in the region are divided into several categories with similar characteristics. For different types of regions, the prediction models suitable for each are selected, which can not only reduce the complicated training of selecting different models for each region, but also improve the accuracy of the prediction results.

[0172] The present invention mainly predicts the annual natural gas consumption in different areas of the region. The data sample is small. In the past 10 years, the natural gas consumption in different areas of the region has shown different degrees of approximate exponential laws. Therefore, the support vector regression model is more applicable.

[0173] Step 1: The experimental data were downloaded from the regional energy bureau and regional energy bureaus. In view of the availability of data, the historical natural gas data of 11 key areas in the region for 10 years from 2011 to 2020 were selected, including annual natural gas consumption, oil consumption, electricity consumption, GDP, population, urbanization rate and other data. The 11 areas are A, B, C, D, E, F, G, H, I, J, and K.

[0174] Step 2: The prediction process uses a ratio of 8:2 to divide the training set and the test set. Since natural gas consumption has a certain temporal correlation, historical natural gas consumption has an impact on future natural gas consumption. Therefore, the present invention cannot use a random division method to divide the training set and the test set, but uses the data at the end of the time period as the test set, that is, the data from 2011 to 2018 as the training set and the data from 2019 to 2020 as the test set.

[0175] Step 3: Use the elbow method to determine the number of classification groups K for K-means clustering, and draw the error square sum SSE graph corresponding to different K values ​​for reference Figure 4 As shown in the figure, the results show that the inflection point occurs when the K value is 2, so this clustering should be divided into 2 categories.

[0176] Step 4: The clustering algorithm analyzes the similarities between regions from the perspectives of values, trends, and structures. The number of clusters is set to 2. The results show that the most important predictive variables are GDP and natural gas consumption. The clustering results integrate multiple data indicators and calculate the distance of data from a high-dimensional space. The rules of clustering are difficult to describe specifically using general rules, but some rules can still be obtained from the features with higher contribution rates. The clustering results are shown in Table 1 below. The four regions of F, G, I, and K are classified into one category. From the data analysis, the GDP of these four regions is at the forefront of the region, and the natural gas consumption is at a level of long-term stable growth or rapid growth, that is, this type of region has a high economic level, various industrial systems are well developed, the energy use structure is relatively stable, and there is a long-term stable demand for natural gas. In contrast, other regions have lower economic development, imperfect industrial development, and the use of natural gas is easily affected by various factors, and natural gas consumption is prone to large fluctuations.

[0177] Step 5: Use the training sets of these 11 regions to train the support vector regression model and obtain the first initial model. Input the test sets of each region into the first initial model respectively, and predict the annual consumption of the 11 regions in the region from 2019 to 2020 based on the first initial model. The comparison between the predicted values ​​and the actual values ​​is shown in Table 2 and Figure 6As shown. Among them, the average MAPE values ​​of F, G, I, and K are below 10%, and the results are relatively accurate; the average MAPE values ​​of other regions are between 10% and 20%, and the prediction effect is average. Taking the F region with better prediction effect as an example, the actual and predicted values ​​of natural gas consumption from 2011 to 2020 are shown as follows: Figure 5 shown.

[0178] area category A II B II C II D II E II F I G I H II I I J II K I

[0179] Table 1

[0180]

[0181] Table 2

[0182] Step 6: Use the training sets of these 11 regions (including historical natural gas consumption data, macroeconomic data, energy consumption data, etc.) to train the BP neural network and obtain the second initial model. Input the test set of each region into the second initial model respectively, and predict the annual consumption of the 11 regions in the region from 2019 to 2020 based on the second initial model. The comparison between the predicted value and the true value is shown in Table 3. Among them, the average MAPE of the 7 regions A, B, C, D, E, H, and J is below 5%, with extremely high accuracy; the MAPE of the 4 regions F, G, I, and K is between 5% and 12%, with a high accuracy.

[0183]

[0184] Table 3

[0185] Compared with the results of the support vector regression model, it can be seen that the overall effect of the BP neural network is better than that of the support vector regression model, but in the four regions of F, G, I, and K, the effect of the support vector regression model is better than that of the BP neural network, as shown in Table 4 and Figure 6 ,Table 4 shows the MAPE (mean absolute percentage error) of BP neural network and support vector regression model (SVR model).

[0186]

[0187] Table 4

[0188] Step 7: Comparing the regional division results with the support vector regression model and BP prediction results, it was found that the natural gas consumption in Category I regions with high economic levels, complete industrial systems, and stable energy structures has been growing steadily, which is almost consistent with the regions where more accurate results were obtained when the support vector regression model was used to predict natural gas consumption. The regions included in Category II are consistent with the regions where accurate results were obtained when the BP neural network was used to predict natural gas consumption. The support vector regression model is suitable for regions with high economic levels, complete industrial systems, and stable energy structures, while the BP neural network is suitable for other regions. After the regions are divided into two categories, the relevant data of the regions included in Category II are re-entered into the BP neural network for training, and the natural gas demand forecast values ​​for each region during the period of 2021-2025 are obtained as shown in Table 5 below:

[0189]

[0190] Table 5

[0191] In order to solve the problem that accurate natural gas consumption prediction models cannot be established due to different energy structures, economic development and policy planning in different regions, the present invention designs a combined SVR model-BP neural network model based on clustering algorithm improvement, and takes a certain region as an example to perform long-term prediction of regional natural gas consumption. The K-means clustering model is used to divide the 11 regions in the region into two categories based on the characteristics of macroeconomics, energy structure, and natural gas consumption. Among them, the natural gas consumption in regions with high economic levels, complete industrial systems, and stable energy structures has steadily increased, and is more suitable for support vector regression models, while regions with other characteristics are more suitable for BP neural networks. The natural gas demand forecasts of each region use two models, support vector regression model and BP neural network, respectively, and the mean absolute percentage error (MAPE) is 11% and 6% respectively. The overall effect of BP neural network is better than that of support vector regression model; the regional characteristic data suitable for BP neural network model after clustering is put into BP neural network training, which is equivalent to optimizing the initial value, so that the accuracy of the retrained BP neural network prediction result is improved to 4.5%, and the average absolute percentage error of the overall model test result is less than 8%, and the prediction effect is satisfactory. The long-term prediction of natural gas consumption requires annual historical data as training data, and the amount of data is small. As time goes by, the accuracy of the model will improve. At the same time, with the development of artificial intelligence technology, the accuracy of long-term natural gas demand forecasts and the reliability of model methods will continue to improve.

[0192] Embodiment 2

[0193] The embodiment of the present invention provides a regional natural gas long-term demand combined forecasting device, referring to Figure 7 As shown, including:

[0194] A division module 401 is used to obtain historical natural gas data of a preset number of years in each region in a preset area, and divide the historical natural gas data into a training set and a test set according to a preset ratio; wherein the historical natural gas data includes regional characteristic data related to natural gas demand forecasting;

[0195] A classification module 402, configured to determine the number of regional classifications within the preset area by using an elbow method based on the regional characteristic data;

[0196] A clustering module 403 is used to divide all regions in the preset area by using a K-means clustering algorithm based on the historical natural gas data and the number of regional classifications to obtain a regional division result;

[0197] A first training module 404 is used to use the training sets of all regions to respectively train the pre-built support vector regression model and BP neural network to obtain the corresponding first initial model and second initial model;

[0198] A testing module 405 is used to test the first initial model and the second initial model respectively for each region using its test set to obtain corresponding first model test results and second model test results;

[0199] A selection module 406, configured to determine a prediction model type applicable to each type of region according to the region division result, the first model test result and the second model test result;

[0200] A second training module 407 is used to train the support vector regression model based on the historical natural gas data of all regions where the prediction model type is the support vector regression model, and to train the BP neural network based on the historical natural gas data of all regions where the prediction model type is the BP neural network, so as to obtain a combined prediction model;

[0201] The prediction module 408 is used to predict the long-term regional natural gas demand using the combined prediction model.

[0202] The implementation principle and technical effect of the regional natural gas long-term demand combined forecasting device provided in the embodiment of the present invention are similar to those of any of the aforementioned method embodiments, and will not be repeated here.

[0203] Embodiment 3

[0204] The present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the regional natural gas long-term demand combination forecasting method as described in any one of the aforementioned method embodiments.

[0205] The computer-readable storage medium may be included in the device / apparatus described in the above embodiment; or it may exist independently without being assembled into the device / apparatus. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present invention is implemented.

[0206] According to an embodiment of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0207] Embodiment 4

[0208] An embodiment of the present invention provides an electronic device, referring to Figure 8 As shown, it includes a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112 and the memory 113 communicate with each other through the communication bus 114.

[0209] Memory 113, used for storing computer programs;

[0210] The processor 111 is used to implement the regional natural gas long-term demand combination forecasting method as described in any one of the above method embodiments when executing the program stored in the memory 113.

[0211] The implementation principle and technical effect of the electronic device provided by the embodiment of the present invention are similar to those of any of the aforementioned method embodiments, and will not be repeated here.

[0212] The above-mentioned memory 113 can be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. The memory 113 has a storage space for program codes for executing any method steps in the above-mentioned method. For example, the storage space for program codes may include various program codes for implementing various steps in the above method respectively. These program codes can be read from or written into one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. Such computer program products are usually portable or fixed storage units. The storage unit may have a storage segment or storage space arranged similarly to the memory 113 in the above-mentioned electronic device. The program code can be compressed, for example, in an appropriate form. Generally, the storage unit includes a program for executing the method steps according to an embodiment of the present invention, that is, a code that can be read by, for example, a processor 111, and when these codes are run by an electronic device, the electronic device performs the various steps in the method described above.

[0213] In this document, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. The orientation or position relationship indicated by the terms "upper", "lower", etc. is based on the orientation or position relationship shown in the accompanying drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0214] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict. The present invention is not limited to any single aspect, any single embodiment, or any combination and / or permutation of these aspects and / or embodiments. Each aspect and / or embodiment of the present invention can be used alone, or in combination with one or more other aspects and / or other embodiments.

[0215] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A method for combined forecasting of regional long-term natural gas demand, characterized in that: include: Acquire historical natural gas data of a preset number of years in each region within a preset area, and divide the historical natural gas data into a training set and a test set according to a preset ratio; wherein the historical natural gas data includes regional characteristic data related to natural gas demand forecasting; Based on the regional characteristic data, the number of regional classifications within the preset area is determined by using the elbow method; Based on the historical natural gas data and the number of regional classifications, all regions in the preset area are divided using a K-means clustering algorithm to obtain a regional division result; Use the training sets of all regions to train the pre-built support vector regression model and BP neural network respectively to obtain the corresponding first initial model and second initial model; For each region, use its test set to test the first initial model and the second initial model respectively, and obtain corresponding first model test results and second model test results; Determine the type of prediction model applicable to each type of region according to the regional division result, the first model test result and the second model test result; Based on the historical natural gas data of all regions where the prediction model type is the support vector regression model, the support vector regression model is trained, and based on the historical natural gas data of all regions where the prediction model type is the BP neural network, the BP neural network is trained to obtain a combined prediction model; The combined forecasting model is used to forecast the long-term regional natural gas demand.

2. The method for combined forecasting of regional natural gas long-term demand according to claim 1, characterized in that: Based on the historical natural gas data and the number of regional classifications, the K-means clustering algorithm is used to divide all regions in the preset area to obtain regional division results, including: Performing qualitative and quantitative evaluation on each indicator in the historical natural gas data to obtain first characteristic dimension data and second characteristic dimension data; According to the first feature dimension data and the second feature dimension data, the historical natural gas data is encoded using one-hot encoding to obtain encoded data; Based on the encoded data and the number of regional classifications, all regions in the preset area are divided using a K-means clustering algorithm to obtain a regional division result.

3. The method for combined forecasting of regional natural gas long-term demand according to claim 1, characterized in that: Based on the historical natural gas data and the number of regional classifications, the K-means clustering algorithm is used to divide all regions in the preset area to obtain regional division results, including: Based on the historical natural gas data and the number of regional classifications, all regions in the preset area are clustered using a K-means clustering algorithm to obtain a clustering result; According to the clustering result, key feature data is obtained from the regional feature data; According to the key feature data, all regions in the preset area are divided to obtain a region division result.

4. The method for combined forecasting of regional long-term natural gas demand according to claim 3, characterized in that: The key characteristic data include GDP and natural gas consumption; and the regional division results obtained by dividing all regions in the preset area according to the key characteristic data include: According to the GDP and natural gas consumption, all regions in the preset area are divided to obtain regional division results.

5. The method for combined forecasting of regional natural gas long-term demand according to claim 1, characterized in that: The step of obtaining historical natural gas data of a preset number of years in each region within a preset area and dividing the historical natural gas data into a training set and a test set according to a preset ratio includes: The historical natural gas data of a preset number of years in each region within a preset area is obtained, the annual quantity ratio of the training set and the test set is set to the preset ratio, and the training set and the test set are obtained by time series division.

6. The method for combined forecasting of regional long-term natural gas demand according to claim 1, characterized in that: The combined prediction model includes a first prediction model, and the first prediction model is trained in the following manner, including: Input the training sets of all regions whose prediction model type is support vector regression model into the support vector regression model, and optimize the model parameters by the objective function of the following formula to obtain a first prediction model; Among them, ξ i and The value of is: In the formula, ξ i and represents the slack variable; c represents the penalty factor; f(x)=ωx+b represents the model function; ω represents the weight vector; y represents the actual demand; x represents the sample data in the training set; b represents the threshold; ε represents the maximum allowable error; f(x)+ε, f(x)-ε represent the upper and lower edges of the isolation zone respectively; i=1,2,...,l; l represents the number of samples in the training set.

7. The method for combined forecasting of regional long-term natural gas demand according to claim 1, characterized in that: The combined prediction model includes a second prediction model, and the second prediction model is trained in the following manner: The training sets of all regions whose prediction model type is BP neural network are input into the BP neural network as follows to obtain the model output results: O=HW o +b o In the formula, O represents the model output result; H represents the output of the hidden layer; represents the hidden layer activation function; X represents the sample data in the training set; W h Represents the weight between the input layer and the hidden layer; W o represents the weight between the hidden layer and the output layer; b h represents the bias of the hidden layer; b o represents the bias of the output layer; Determine a loss function according to the model output result and the actual demand, optimize the model parameters of the BP neural network based on the loss function, and obtain an optimized model; The optimized model is tested using a test set, and the accuracy is determined according to a preset accuracy function; If the accuracy rate does not reach the preset threshold, the process of optimizing the model parameters is repeated, and the learning rate and batch size parameters are adjusted until the accuracy rate reaches the preset threshold, and the training is stopped to obtain the second prediction model.

8. The method for combined forecasting of regional long-term natural gas demand according to claim 7, characterized in that: The method further comprises: According to the constraints, the following Lagrangian function is constructed: Where L represents the Lagrangian function; α i and α i * represents the Lagrange multiplier; The model parameters of the support vector regression model are optimized through the objective function as follows:

9. The method for combined forecasting of regional long-term natural gas demand according to claim 1, characterized in that: Before obtaining historical natural gas data of a preset number of years in each region within a preset area and dividing the historical natural gas data into a training set and a test set according to a preset ratio, the method further includes: Invalid, repeated, and redundant data in the historical natural gas data are removed, and missing values ​​are filled to obtain preprocessed natural gas data.

10. The method for combined forecasting of regional long-term natural gas demand according to claim 9, characterized in that: The missing values ​​in the historical natural gas data are filled in the following way: The following formula is used to fill the missing values ​​in the historical natural gas data so that each interpolation abscissa x i Substituting the following formula, the polynomial has i terms left, and the Newton interpolation polynomial controlling the i term is equal to f(x i ): In the formula, represents the Newton interpolation polynomial; f[x0,x1,...,x n ] represents the difference quotient, 11. A combined forecasting device for regional natural gas long-term demand, characterized in that: include: A partitioning module, used to obtain historical natural gas data of a preset number of years in each region within a preset area, and to partition the historical natural gas data into a training set and a test set according to a preset ratio; wherein the historical natural gas data includes regional characteristic data related to natural gas demand forecasting; A classification module, used for determining the number of regional classifications within the preset area by using an elbow method based on the regional characteristic data; A clustering module, for dividing all regions in the preset area by using a K-means clustering algorithm based on the historical natural gas data and the number of regional classifications to obtain a regional division result; A first training module is used to use the training sets of all regions to respectively train the pre-built support vector regression model and BP neural network to obtain the corresponding first initial model and second initial model; A testing module, for testing the first initial model and the second initial model respectively using the test set of each region to obtain corresponding first model test results and second model test results; A selection module, used to determine the type of prediction model applicable to each type of region according to the region division result, the first model test result and the second model test result; A second training module is used to train the support vector regression model based on the historical natural gas data of all regions where the prediction model type is the support vector regression model, and to train the BP neural network based on the historical natural gas data of all regions where the prediction model type is the BP neural network, so as to obtain a combined prediction model; The forecasting module is used to forecast the long-term regional natural gas demand by using the combined forecasting model.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for combined forecasting of regional natural gas long-term demand is implemented as described in any one of claims 1-10.

13. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; The processor is used to implement the regional natural gas long-term demand combination forecasting method as described in any one of claims 1-10 when executing the program stored in the memory.

Citation Information

Cited By

  • Material monitoring method and system, electronic equipment and computer storage medium

    CN121706018A