Energy demand quantity prediction method and device, equipment, storage medium and product

By iteratively optimizing the model parameters of the initial prediction model, the problem of low accuracy of small and medium-sized sample data for coal demand prediction is solved, and higher prediction accuracy and accuracy are achieved.

CN119990409APending Publication Date: 2025-05-13SHENZHEN POWER SUPPLY BUREAU
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411994627.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In the coal demand forecast of prior art, the prediction accuracy of small sample data is relatively low.

Method used

By constructing an initial prediction model and using sample energy data to iteratively optimize the model parameters, an energy demand prediction model is obtained to improve the prediction accuracy.

Benefits of technology

The prediction accuracy of the energy demand prediction model for small sample data is improved, and the prediction accuracy of large sample data is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119990409A_ABST
    Figure CN119990409A_ABST
Patent Text Reader

Abstract

The invention relates to an energy demand quantity prediction method and device, equipment, a storage medium and a product. The method comprises the following steps: acquiring to-be-tested energy data; the to-be-tested energy data comprises original data influencing the coal demand quantity; the energy demand prediction model is adopted to process the to-be-measured energy data, and an energy demand prediction result of the to-be-measured energy data is obtained; the energy demand prediction model is obtained by carrying out iterative optimization on model parameters of the initial prediction model by adopting sample energy data; the sample energy data comprises historical energy data influencing the coal demand quantity. By adopting the method, the prediction precision of small sample data can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to an energy demand prediction method, device, equipment, storage medium and product. Background Art

[0002] Scientific and accurate forecast of coal demand is a prerequisite for formulating coal development strategies and plans.

[0003] In the related art, when predicting coal demand, training data is usually used to train a prediction model built based on empirical values ​​of model parameters to obtain a final demand prediction model, and the demand model is used to predict coal demand.

[0004] However, when predicting coal demand in related technologies, there is a technical problem of low prediction accuracy for small sample data. Summary of the invention

[0005] Based on this, it is necessary to provide an energy demand prediction method, device, equipment, storage medium and product to address the above-mentioned technical problems, which can improve the prediction accuracy of small sample data.

[0006] In a first aspect, an embodiment of the present application provides an energy demand prediction method, comprising:

[0007] Obtaining energy data to be measured; the energy data to be measured includes raw data that affects coal demand;

[0008] The energy demand prediction model is used to process the energy data to be tested to obtain the energy demand prediction result of the energy data to be tested; the energy demand prediction model is obtained by iteratively optimizing the model parameters of the initial prediction model using sample energy data; the sample energy data includes historical energy data that affects coal demand.

[0009] In one embodiment, the sample energy data includes sample input variable data and sample output variable data; the initial prediction model is constructed based on the sample input variable data; and the training process of the energy demand prediction model includes:

[0010] Iteratively optimize the model parameters in the initial prediction model according to the sample input variable data and the sample output variable data to obtain a candidate prediction model;

[0011] According to the sample input variable data and the sample output variable data, the candidate prediction model is trained and tested to obtain the energy demand prediction model.

[0012] In one embodiment, the model parameters in the initial prediction model are iteratively optimized according to the sample input variable data and the sample output variable data to obtain the candidate prediction model, including:

[0013] Randomly initialize the positions of the population, each position represents a set of model parameters in the initial prediction model;

[0014] According to the sample input variable data, sample output variable data and the preset fitness function, the fitness of each individual in the population is determined, and the optimal fitness is selected as the global optimal solution;

[0015] Iteratively update the position of each individual and the global optimal solution;

[0016] When the maximum number of iterations is reached, the current global optimal solution is output, and the individual optimal position corresponding to the current global optimal solution is determined as the optimal model parameter of the initial prediction model;

[0017] Substitute the optimal model parameters into the initial prediction model to obtain the candidate prediction model.

[0018] In one embodiment, determining the fitness of each individual in the population according to the sample input variable data, the sample output variable data and a preset fitness function includes:

[0019] Input the sample input variable data into the initial prediction model to obtain the prediction data output by the initial prediction model;

[0020] The predicted data and sample output variable data are input into the fitness function to obtain the fitness of each individual.

[0021] In one embodiment, the candidate prediction model is trained and tested according to the sample input variable data and the sample output variable data to obtain the energy demand prediction model, including:

[0022] Obtain a training data set and a test data set according to sample input variable data and sample output variable data;

[0023] Using the training data set, the candidate prediction model is trained to obtain a trained candidate prediction model;

[0024] The trained candidate prediction model is tested using the test data set to obtain the energy demand prediction model.

[0025] In one embodiment, the test data set includes test input variable data and test output variable data; the trained candidate prediction model is tested using the test data set to obtain an energy demand prediction model, including:

[0026] Inputting the test input variable data into the trained candidate prediction model to obtain the prediction data output by the trained candidate prediction model;

[0027] Inputting the prediction data and the test output variable data into a plurality of preset prediction accuracy evaluation functions to obtain a plurality of evaluation index values;

[0028] If the values ​​of each evaluation index meet the corresponding preset index value range, the trained candidate prediction model is determined as the energy demand prediction model.

[0029] In a second aspect, the embodiment of the present application further provides an energy demand prediction device, comprising:

[0030] A data acquisition module is used to acquire energy data to be measured; the energy data to be measured includes original data that affects coal demand;

[0031] The demand prediction module is used to process the energy data to be tested using the energy demand prediction model to obtain the energy demand prediction results of the energy data to be tested; the energy demand prediction model is obtained by iteratively optimizing the model parameters of the initial prediction model using sample energy data; the sample energy data includes historical energy data that affects coal demand.

[0032] In a third aspect, an embodiment of the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method in any one of the embodiments of the first aspect above are implemented.

[0033] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method in any one of the embodiments of the first aspect above.

[0034] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method in any one of the embodiments of the first aspect above.

[0035] The energy demand prediction method, device, equipment, storage medium and product provided in the embodiment of the present application first obtain the energy data to be measured, and then use the energy demand prediction model to process the energy data to be measured to obtain the energy demand prediction result of the energy data to be measured; wherein, the energy data to be measured includes the original data that affects the coal demand, and the energy demand prediction model is obtained by iteratively optimizing the model parameters of the initial prediction model using sample energy data, and the sample energy data includes historical energy data that affects the coal demand. In this method, before performing energy demand, an initial prediction model that can perform energy demand prediction is first constructed, and an energy demand prediction model is obtained based on the initial prediction model. In order to improve the suitability and accuracy of the model parameters in the energy demand prediction model, the model parameters of the initial prediction model are iteratively optimized using sample energy data, which is equivalent to fully tuning the model parameters through the sample energy data, thereby improving the prediction performance of the energy demand prediction model, thereby improving the prediction accuracy of the energy demand prediction model for small sample data. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 An application environment diagram of an energy demand prediction method in an embodiment;

[0038] Figure 2 A schematic diagram of a flow chart of an energy demand prediction method in one embodiment;

[0039] Figure 3 A schematic diagram of a process for training an energy demand prediction model in one embodiment;

[0040] Figure 4 A schematic diagram of a process for iteratively optimizing model parameters in one embodiment;

[0041] Figure 5 A schematic diagram of a process for training and testing a candidate prediction model in one embodiment;

[0042] Figure 6 is a flow chart of an energy demand prediction method in another embodiment;

[0043] Figure 7 A schematic diagram of the structure of an energy demand prediction device in one embodiment;

[0044] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0046] The technical background of the embodiments of the present application is first described below.

[0047] The resource endowment of coal determines the cost advantage and strategic position of coal-fired power. Scientific and accurate forecasting of coal demand is the premise for formulating coal development strategy and planning.

[0048] In the related technology, coal demand forecasting methods are roughly divided into three categories: traditional forecasting models, single intelligent algorithm forecasting models and combined optimization intelligent algorithm models. Among them, the traditional forecasting models mainly include: traditional time series methods, elasticity coefficient methods and error correction methods. As for the traditional time series method, by analyzing the main characteristics of coal consumption, the autoregressive moving average model, gray model and combined forecasting model are used to predict the total coal consumption demand. In terms of the elasticity coefficient method, the energy consumption elasticity coefficient is used to study and predict the coal consumption during 2010-2020. The results show that the total annual coal consumption during the study period reached 2.42 billion tons to 2.67 billion tons and 3.01 billion tons to 3.29 billion tons. In terms of the error correction method, the gray model is first used to predict the coal demand, and then the hidden Markov chain is used to correct the prediction results. The results show that the prediction accuracy is effectively improved. Single intelligent algorithm models include: ANN (artificial neural network), SVM (support vector machine), wavelet analysis, genetic algorithm, etc. Coal consumption and coal emissions from 2014 to 2020 are predicted by adopting BP (back propagation) neural network, using coal consumption and coal emission data from 1994 to 2013. The prediction results show that coal consumption and carbon emissions continue to increase. Single prediction models often have certain limitations, with great differences in performance in different data sets and poor stability. The combined prediction optimization model mainly uses intelligent algorithms to optimize parameters and improve the algorithm framework of traditional and deep learning algorithms, and establishes a new combined prediction model. By using the least squares support vector machine model optimized by the gravitational search algorithm for short-term wind power load forecasting, it is shown that this method is superior to a single least squares support vector machine model and a BP neural network model. The quadratic Renyi entropy and principal component analysis method are also used to extract the main features of the training data, and then the least squares support vector machine model is established. This method has good prediction results under different weather conditions and reduces the calculation time by 70%. However, this model has high requirements on data scale and is not suitable for small sample prediction. Traditional prediction models have high requirements on sample size and are insensitive to uncertainty factors and abnormal data. Therefore, when encountering small sample data, the prediction accuracy is low. For some existing single intelligent algorithm prediction models, the gray system prediction parameters have a greater impact on the prediction error, which is not suitable for the prediction of internal mechanisms. The application scope of neural networks is limited, and it is difficult to accurately analyze various performance indicators. The training time of support vector machines is long and they are prone to fall into local extreme values.

[0049] Based on this, the present application provides an energy demand prediction method. Before performing energy demand prediction, an initial prediction model capable of performing energy demand prediction is first constructed, and an energy demand prediction model is obtained based on the initial prediction model. In order to improve the suitability and accuracy of the model parameters in the energy demand prediction model, the model parameters of the initial prediction model are iteratively optimized using sample energy data, which is equivalent to fully tuning the model parameters through sample energy data. This improves the prediction performance of the energy demand prediction model, thereby improving the prediction accuracy of the energy demand prediction model for small sample data. Of course, the technical solution provided in the embodiments of the present application is not limited to solving only the above-mentioned problems, and there are other technical effects. For details, please refer to the following embodiment description.

[0050] It should be noted that the beneficial effects brought about by the embodiments of the present application or the technical problems solved are not limited to this one, but may also include other implicit or related problems. For details, please refer to the description of the following embodiments.

[0051] The following describes the application environment of the energy demand prediction method provided in the embodiment of the present application, which can be applied to: Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, and tablet computers. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0052] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0053] In an exemplary embodiment, Figure 2 As shown, a method for predicting energy demand is provided. Figure 1 The server in the example is used to illustrate, including the following steps 201 to 202. Among them:

[0054] S201, obtaining energy data to be measured; the energy data to be measured includes original data that affects coal demand.

[0055] Among them, the energy data to be tested include the original data that affect the demand for coal, including per capita GDP, per capita carbon dioxide emissions, energy intensity, industrial structure, urbanization rate, energy structure, fossil energy consumption, population size and thermal power generation.

[0056] In one embodiment, the energy data to be measured is input by the user through the terminal. For example, when the user needs to predict the coal demand, the user inputs the energy data to be measured in the visual interface corresponding to the energy demand prediction application, so that the server processes the energy data to be measured to obtain the energy demand prediction result.

[0057] In another embodiment, the energy data to be measured is obtained from a database. Exemplarily, before triggering a request for prediction of coal demand, the user uploads and stores the energy data to be measured in a database. The server can obtain energy data corresponding to the data identifier from the database based on the data identifier, and the energy data corresponding to the data identifier is the energy data to be measured. The data identifier is carried in the request for prediction of coal demand triggered by the user.

[0058] S202, using an energy demand prediction model to process the energy data to be tested to obtain an energy demand prediction result of the energy data to be tested; the energy demand prediction model is obtained by iteratively optimizing the model parameters of the initial prediction model using sample energy data; the sample energy data includes historical energy data that affects coal demand.

[0059] In the embodiment of the present application, the energy demand prediction model is obtained by iteratively optimizing the model parameters of the initial prediction model using sample energy data; the sample energy data includes historical energy data that affects coal demand. Among them, the sample energy data includes sample input variable data and sample output variable data. The sample input variable data includes sample per capita GDP (10,000 yuan), sample per capita carbon dioxide emissions (10,000 tons of standard coal), sample energy intensity (%), sample industrial structure (%), sample urbanization rate (%), sample energy structure (%), sample fossil energy consumption (10,000 tons of standard coal), sample population (10 million) and sample thermal power generation (100 million kilowatt-hours), etc. The sample output variable data includes sample coal consumption (10,000 tons of standard coal). In order to improve the data quality of the sample energy data, thereby improving the prediction accuracy of the energy demand prediction model, the sample energy data in the embodiment of the present application is obtained through correlation test and Granger causality test, and irrelevant variables are eliminated.

[0060] The initial prediction model is constructed based on the sample input variable data. For example, let the training sample set be , Enter the variables for the sample, is the output variable corresponding to the sample. First, construct the learning mechanism function of LS-SVM, as shown in the following formula:

[0061] (1)

[0062] Among them, φ is the sample input variable, φ(x) is the mapping of the sample input variable from the original space to the high-dimensional feature space, so that the nonlinear regression problem in the input sample is transformed into a linear fitting problem in the high-dimensional space. is the weight vector and b is the bias value.

[0063] Construct the structural risk function as shown in the following formula:

[0064] (2)

[0065] in, It is used to control the complexity of the model. C is the regularization parameter, also known as the penalty factor, which indicates the degree of penalty for samples exceeding the error. is the empirical risk coefficient, which can be expressed as a quadratic expression.

[0066] According to the principle of structural risk minimization, the regression problem is described as a constrained optimization problem as shown in the following formula:

[0067] (3)

[0068] (4)

[0069] in, is the error slack variable, .

[0070] By using Lagrange multipliers and dual transformation method to transform the above optimization problem, we can obtain the following Lagrange function, that is, the unconstrained optimization problem:

[0071] (5)

[0072] According to the Karush Kuhn Tucker (KKT) conditions, the linear equations of the regression model coefficients are obtained:

[0073] (6)

[0074] in, Include elements; .

[0075] Use the RBF function as the kernel function of the LSSVM model, that is:

[0076] (7)

[0077] Among them, σ is the kernel width parameter.

[0078] The initial prediction model is constructed as:

[0079] (8)

[0080] in, and b are obtained by the least squares method; C and σ are the model parameters of the initial prediction model.

[0081] After the initial prediction model is determined, the model parameters of the initial prediction model are iteratively optimized according to the sample energy data. For example, the model parameters of the initial prediction model can be iteratively optimized using the Sparrow Search Algorithm (SSA). In the embodiment of the present application, the regularization parameters and kernel function parameters are not determined based on empirical values, but are obtained by iterative optimization of the sample energy data. In this way, the performance of the energy demand prediction model is improved by fully tuning the model parameters, thereby improving the prediction accuracy of small sample data, and at the same time, the accuracy of the prediction results of large sample data is also high.

[0082] Furthermore, after obtaining the optimized model parameters, the optimized model parameters are substituted into the initial prediction model, and the initial prediction model with the optimized model parameters substituted into it is trained and tested to obtain an energy demand prediction model.

[0083] Based on the energy demand prediction model obtained through the above training and testing, the energy data to be tested is processed, that is, the energy data to be tested is input into the energy demand prediction model to obtain the prediction result output by the energy demand prediction model, which is the energy demand prediction result of the energy data to be tested.

[0084] The energy demand prediction method provided in the embodiment of the present application first obtains the energy data to be measured, and then uses the energy demand prediction model to process the energy data to be measured to obtain the energy demand prediction result of the energy data to be measured; wherein, the energy data to be measured includes the original data that affects the coal demand, and the energy demand prediction model is obtained by iteratively optimizing the model parameters of the initial prediction model using sample energy data, and the sample energy data includes historical energy data that affects the coal demand. In this method, before performing energy demand, an initial prediction model that can perform energy demand prediction is first constructed, and an energy demand prediction model is obtained based on the initial prediction model. In order to improve the suitability and accuracy of the model parameters in the energy demand prediction model, the model parameters of the initial prediction model are iteratively optimized using sample energy data, which is equivalent to fully tuning the model parameters through the sample energy data, thereby improving the prediction performance of the energy demand prediction model, thereby improving the prediction accuracy of the energy demand prediction model for small sample data.

[0085] Based on the above embodiment, an embodiment is provided to illustrate the process of training the energy demand prediction model.

[0086] In an exemplary embodiment, Figure 3 As shown, the sample energy data includes sample input variable data and sample output variable data; the initial prediction model is constructed based on the sample input variable data; the training process of the energy demand prediction model includes:

[0087] S301, iteratively optimizing the model parameters in the initial prediction model according to the sample input variable data and the sample output variable data to obtain a candidate prediction model.

[0088] In the embodiment of the present application, the SSA algorithm can be used to iteratively optimize the model parameters in the initial prediction model in combination with the sample input variable data and the sample output variable data. For example, the sample input variable data is input into the initial prediction model to obtain the prediction result output by the initial prediction model, and then the prediction result and the sample output variable data are input into the pre-constructed objective function, and the fitness of each individual in the population of the SSA algorithm is calculated, and then the optimal fitness is selected as the optimal solution, and the position and speed of each individual are updated, and the optimal solution is iteratively updated until the maximum number of iterations is reached to obtain the optimized model parameters.

[0089] Furthermore, after obtaining the optimized model parameters, the optimized model parameters are substituted into the above-mentioned initial prediction model to obtain a candidate prediction model.

[0090] S302: training and testing candidate prediction models according to sample input variable data and sample output variable data to obtain an energy demand prediction model.

[0091] In the embodiment of the present application, after obtaining the candidate prediction model, the sample input variable data and the sample output variable data are used to train and test the candidate prediction model to obtain the energy demand prediction model. For example, the sample input variable data and the sample output variable data are divided into a training data set and a test data set according to a preset ratio, and then the candidate prediction model is trained using the training data set, and then the trained candidate prediction model is further tested using the test data set to obtain the energy demand prediction model.

[0092] The energy demand prediction method provided in the embodiment of the present application first iteratively optimizes the model parameters in the initial prediction model according to the sample input variable data and the sample output variable data to obtain a candidate prediction model, and then trains and tests the candidate prediction model according to the sample input variable data and the sample output variable data to obtain an energy demand prediction model. In this method, an optional way to quickly train the parameters of the energy demand model is provided; first, the model parameters in the initial prediction model are iteratively optimized through the sample input variable data and the sample output variable data in the sample energy data to obtain a candidate prediction model, thereby improving the accuracy of the model parameters, and then the candidate prediction model obtained after the model parameter optimization is trained and tested to improve the prediction performance of the candidate prediction model, so that the predicted value of the candidate prediction model is closer to the true value, thereby obtaining an energy demand prediction model with better prediction performance.

[0093] Based on the above embodiment, an embodiment is provided to illustrate the process of iteratively optimizing model parameters.

[0094] In an exemplary embodiment, Figure 4 As shown, according to the sample input variable data and the sample output variable data, the model parameters in the initial prediction model are iteratively optimized to obtain a candidate prediction model, including:

[0095] S401, randomly initialize the positions of the population, each position representing a set of model parameters in an initial prediction model.

[0096] In the embodiment of the present application, before initializing the population, parameters are set. The parameters include the number of search agents SAN, the maximum number of iterations Mite, the number of variables dim, the upper bound and the lower bound Belongs to variables. For example, SAN=50;Mite=300;dim=2;ub=[100000;100000]; =[1;1].

[0097] After setting the basic parameters, a random population is generated as the beginning of the iteration using the following formula, and the initial value of the iteration is set to 1.

[0098] (9)

[0099] S402, determining the fitness of each individual in the population according to the sample input variable data, the sample output variable data and a preset fitness function, and selecting the optimal fitness as the global optimal solution.

[0100] Exemplarily, the sample input variable data is input into the initial prediction model to obtain the prediction data output by the initial prediction model; the prediction data and the sample output variable data are input into the fitness function to obtain the fitness of each individual.

[0101] Among them, the fitness function is based on the mean absolute percentage error principle to calculate the error between the actual value and the predicted value, as shown in the following formula:

[0102] (10)

[0103] in, Output variable data for the sample; The prediction data output by the initial prediction model.

[0104] After calculating the fitness of all individuals, sort the fitnesses and select the best fitness as the global optimal solution.

[0105] S403, iteratively update the position of each individual and the global optimal solution.

[0106] The position of the individual with the best fitness is set as variable F, and it needs to be set in each iteration. After identifying variable F, the leader and follower update their own positions to obtain the global optimal value. Iteratively update the positions of the discoverer, follower, and warning person in the population and determine whether the sparrow performs anti-predator behavior.

[0107] S404, when the maximum number of iterations is reached, the current global optimal solution is output, and the individual optimal position corresponding to the current global optimal solution is determined as the optimal model parameter of the initial prediction model.

[0108] The best individual position and the best fitness can be obtained in each iteration. When the maximum number of iterations is reached, the iteration ends, and then all fitness values ​​are sorted and the optimal value is selected. At the same time, the best individual position corresponding to the selected optimal value is obtained, and the best individual position is the optimal model parameter of the initial prediction model.

[0109] S405, substituting the optimal model parameters into the initial prediction model to obtain a candidate prediction model.

[0110] After obtaining the optimal model parameters, the optimal model parameters are input into the initial prediction model to obtain a candidate prediction model.

[0111] The accuracy of the energy demand prediction model mainly depends on the regularization parameter and kernel function parameter in the model parameters. The regularization parameter is used to adjust the confidence range and the ratio of empirical risk. If the regularization parameter is too large, the error penalty in model training will also be too large, which will easily cause the model to "overfit". If the regularization parameter is too small, it will reduce the complexity of the model. The kernel function parameter will affect the distribution complexity of sample data in the high-dimensional feature space. If the kernel function parameter is too large, the model complexity will be reduced, and it will also easily cause the model to fall into the situation of "overfitting". If the kernel function parameter is too small, the model fitting curve will tend to be smooth.

[0112] The energy demand prediction method provided in the embodiment of the present application first randomly initializes the position of the population, determines the fitness of each individual in the population according to the sample input variable data, the sample output variable data and the preset fitness function, and selects the optimal fitness as the global optimal solution, and then iteratively updates the position of each individual and the global optimal solution, outputs the current global optimal solution when the maximum number of iterations is reached, and determines the individual optimal position corresponding to the current global optimal solution as the optimal model parameter of the initial prediction model, and finally substitutes the optimal model parameter into the initial prediction model to obtain a candidate prediction model, wherein each position represents a set of model parameters in the initial prediction model. In this method, the fitness of each individual in the population is determined by the sample input variable data and the sample output variable data, combined with the fitness function, and the individual position is iteratively updated based on the optimal fitness, and the global optimal solution is iteratively updated at the same time, until the iteration ends, and the optimal model parameters are obtained, so that the optimal model parameters are input into the initial prediction model to obtain a candidate prediction model, which provides a data basis for determining the energy demand prediction model.

[0113] Based on the above embodiment, an embodiment is provided to illustrate the process of training and testing the candidate prediction model.

[0114] In an exemplary embodiment, Figure 5 As shown, according to the sample input variable data and the sample output variable data, the candidate prediction model is trained and tested to obtain the energy demand prediction model, including:

[0115] S501, obtaining a training data set and a test data set according to sample input variable data and sample output variable data.

[0116] In the embodiment of the present application, the sample input variable data and the sample output variable data can be classified based on a preset ratio to obtain a training data set and a test data set. For example, the prediction ratio is 8:2, where the training data set accounts for 80% and the test data set accounts for 20%.

[0117] S502, using the training data set to perform model training on the candidate prediction model to obtain a trained candidate prediction model.

[0118] The training data set includes training input variable data and training output variable data.

[0119] The training input variable data is input into the candidate prediction model to obtain the prediction result output by the candidate prediction model, and then the prediction loss value of the candidate prediction model is calculated according to the prediction result, the training output variable data and the preset loss function. Based on the prediction loss value, the model parameters of the candidate prediction model are continuously adjusted until the training is completed. If the prediction loss value is less than the preset threshold, the iteration is stopped to obtain the trained candidate prediction model.

[0120] S503, using a test data set to test the trained candidate prediction model to obtain an energy demand prediction model.

[0121] Exemplarily, the test input variable data is input into the trained candidate prediction model to obtain the prediction data output by the trained candidate prediction model; the prediction data and the test output variable data are input into multiple preset prediction accuracy evaluation functions to obtain multiple evaluation index values; if each evaluation index value satisfies the corresponding preset index value range, the candidate prediction model is determined as an energy demand prediction model.

[0122] Among them, the prediction accuracy evaluation functions include the following three:

[0123] (11)

[0124] (12)

[0125] (13)

[0126] Where n is the length of the test dataset, It is the dimensionless test output variable data; The prediction data output by the trained candidate prediction model.

[0127] MAE and RMSE are indicators for evaluating the actual error and residual sum of squares, respectively, and their ranges are [0, +∞). The closer the value is to 0, the higher the accuracy of the model. The range of is (-∞,1], and the closer its value is to 1, the better the predicted value fits the true value.

[0128] After calculating each evaluation index value based on the above formula, each evaluation index value is compared with the corresponding preset index value range. If each evaluation index value satisfies the corresponding preset index value range, the trained candidate prediction model is determined as the energy demand prediction model. If there is an evaluation index value that does not meet the corresponding preset index value range, other sample data are used to continue training the candidate prediction model until all evaluation index values ​​meet the corresponding preset index value range to obtain the energy demand prediction model.

[0129] The energy demand prediction method provided in the embodiment of the present application first obtains a training data set and a test data set based on the sample input variable data and the sample output variable data, and then uses the training data set to perform model training on the candidate prediction model to obtain the trained candidate prediction model, and then uses the test data set to test the trained candidate prediction model to obtain the energy demand prediction model. In this method, the training data set and the test data set for training and testing the candidate prediction model are obtained from the sample input variable data and the sample output variable data, so as to train the candidate prediction model based on the training data set, and after the training is completed, the trained candidate prediction model is tested with the test data set to obtain the energy demand prediction model, so as to avoid overfitting of the energy demand prediction model during the training process, thereby obtaining a more reliable prediction result.

[0130] In addition, in an exemplary embodiment, the present application also provides an energy demand prediction method, such as Figure 6 As shown, the following steps may be included:

[0131] S601, iteratively optimize the model parameters in the initial prediction model according to the sample input variable data and the sample output variable data to obtain a candidate prediction model.

[0132] Optionally, the position of the population is randomly initialized, each position representing a set of model parameters in an initial prediction model; the fitness of each individual in the population is determined based on sample input variable data, sample output variable data and a preset fitness function, and the optimal fitness is selected as the global optimal solution; the position of each individual and the global optimal solution are iteratively updated; when the maximum number of iterations is reached, the current global optimal solution is output, and the individual optimal position corresponding to the current global optimal solution is determined as the optimal model parameters of the initial prediction model; the optimal model parameters are substituted into the initial prediction model to obtain a candidate prediction model.

[0133] S602, obtaining a training data set and a test data set according to the sample input variable data and the sample output variable data.

[0134] S603, using the training data set to perform model training on the candidate prediction model to obtain a trained candidate prediction model.

[0135] S604, using a test data set to test the trained candidate prediction model to obtain an energy demand prediction model.

[0136] Optionally, the test input variable data is input into the trained candidate prediction model to obtain the prediction data output by the trained candidate prediction model; the prediction data and the test output variable data are input into multiple preset prediction accuracy evaluation functions to obtain multiple evaluation index values; if each evaluation index value satisfies the corresponding preset index value range, the trained candidate prediction model is determined as the energy demand prediction model.

[0137] S605, obtaining energy data to be tested.

[0138] Among them, the energy data to be measured includes the original data that affects the demand for coal.

[0139] S606, using the energy demand prediction model to process the energy data to be measured, and obtaining energy demand prediction results for the energy data to be measured.

[0140] In this embodiment, after iterative optimization of the model parameters, the prediction accuracy of the model is improved, which is suitable for small sample prediction. In terms of prediction effect, this method is more suitable for the prediction requirements in the medium and long-term planning of the power system.

[0141] The above process of S601-S606 can refer to the description of the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0142] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0143] Based on the same inventive concept, the embodiment of the present application also provides an energy demand prediction device for implementing the energy demand prediction method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more energy demand prediction device embodiments provided below can refer to the limitations of the energy demand prediction method above, and will not be repeated here.

[0144] In an exemplary embodiment, Figure 7 As shown, an energy demand prediction device 1 is provided, comprising: a data acquisition module 10 and a demand prediction module 20, wherein:

[0145] The data acquisition module 10 is used to acquire the energy data to be measured; the energy data to be measured includes the original data that affects the coal demand;

[0146] The demand prediction module 20 is used to process the energy data to be tested using the energy demand prediction model to obtain the energy demand prediction result of the energy data to be tested; the energy demand prediction model is obtained by iteratively optimizing the model parameters of the initial prediction model using sample energy data; the sample energy data includes historical energy data that affects coal demand.

[0147] In one embodiment, the energy demand prediction device 1 further includes:

[0148] A parameter optimization module is used to iteratively optimize the model parameters in the initial prediction model according to the sample input variable data and the sample output variable data to obtain a candidate prediction model;

[0149] The model training module is used to train and test the candidate prediction model according to the sample input variable data and the sample output variable data to obtain the energy demand prediction model.

[0150] In one embodiment, the parameter optimization module is further used to:

[0151] The positions of the population are randomly initialized, and each position represents a set of model parameters in the initial prediction model; the fitness of each individual in the population is determined according to the sample input variable data, the sample output variable data and the preset fitness function, and the optimal fitness is selected as the global optimal solution; the position of each individual and the global optimal solution are iteratively updated; when the maximum number of iterations is reached, the current global optimal solution is output, and the individual optimal position corresponding to the current global optimal solution is determined as the optimal model parameters of the initial prediction model; the optimal model parameters are substituted into the initial prediction model to obtain a candidate prediction model.

[0152] In one embodiment, the parameter optimization module is further used to:

[0153] The sample input variable data is input into the initial prediction model to obtain the prediction data output by the initial prediction model; the prediction data and the sample output variable data are input into the fitness function to obtain the fitness of each individual.

[0154] In one embodiment, the model training module is further used to:

[0155] According to the sample input variable data and the sample output variable data, a training data set and a test data set are obtained; the training data set is used to train the candidate prediction model to obtain the trained candidate prediction model; the test data set is used to test the trained candidate prediction model to obtain the energy demand prediction model.

[0156] In one embodiment, the model training module is further used to:

[0157] The test input variable data is input into the trained candidate prediction model to obtain the prediction data output by the trained candidate prediction model; the prediction data and the test output variable data are input into multiple preset prediction accuracy evaluation functions to obtain multiple evaluation index values; if each evaluation index value satisfies the corresponding preset index value range, the trained candidate prediction model is determined as the energy demand prediction model.

[0158] Each module in the above energy demand prediction device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0159] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 8As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store energy demand forecast data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an energy demand forecasting method is implemented.

[0160] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0161] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0162] Obtaining energy data to be measured; the energy data to be measured includes raw data that affects coal demand;

[0163] The energy demand prediction model is used to process the energy data to be tested to obtain the energy demand prediction result of the energy data to be tested; the energy demand prediction model is obtained by iteratively optimizing the model parameters of the initial prediction model using sample energy data; the sample energy data includes historical energy data that affects coal demand.

[0164] The implementation principles and technical effects of each step implemented by the processor in the embodiment of the present application are similar to the principles of the above-mentioned energy demand prediction method, and will not be repeated here.

[0165] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0166] Obtaining energy data to be measured; the energy data to be measured includes raw data that affects coal demand;

[0167] The energy demand prediction model is used to process the energy data to be tested to obtain the energy demand prediction result of the energy data to be tested; the energy demand prediction model is obtained by iteratively optimizing the model parameters of the initial prediction model using sample energy data; the sample energy data includes historical energy data that affects coal demand.

[0168] The implementation principles and technical effects of the various steps implemented when the computer program in the embodiment of the present application is executed by the processor are similar to the principles of the above-mentioned energy demand prediction method, and will not be repeated here.

[0169] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0170] Obtaining energy data to be measured; the energy data to be measured includes raw data that affects coal demand;

[0171] The energy demand prediction model is used to process the energy data to be tested to obtain the energy demand prediction result of the energy data to be tested; the energy demand prediction model is obtained by iteratively optimizing the model parameters of the initial prediction model using sample energy data; the sample energy data includes historical energy data that affects coal demand.

[0172] The implementation principles and technical effects of the various steps implemented when the computer program in the embodiment of the present application is executed by the processor are similar to the principles of the above-mentioned energy demand prediction method, and will not be repeated here.

[0173] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0174] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0175] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0176] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for predicting energy demand, characterized in that: The method comprises: Acquire energy data to be measured; the energy data to be measured includes original data affecting coal demand; The energy data to be measured is processed using an energy demand prediction model to obtain an energy demand prediction result of the energy data to be measured; the energy demand prediction model is obtained by iteratively optimizing the model parameters of an initial prediction model using sample energy data; the sample energy data includes historical energy data that affects coal demand.

2. The method according to claim 1, characterized in that The sample energy data includes sample input variable data and sample output variable data; the initial prediction model is constructed based on the sample input variable data; the training process of the energy demand prediction model includes: Iteratively optimizing the model parameters in the initial prediction model according to the sample input variable data and the sample output variable data to obtain a candidate prediction model; The candidate prediction model is trained and tested according to the sample input variable data and the sample output variable data to obtain the energy demand prediction model.

3. The method according to claim 2, characterized in that The iterative optimization of the model parameters in the initial prediction model according to the sample input variable data and the sample output variable data to obtain a candidate prediction model includes: Randomly initialize the positions of the population, each position representing a set of model parameters in the initial prediction model; Determining the fitness of each individual in the population according to the sample input variable data, the sample output variable data and a preset fitness function, and selecting the optimal fitness as the global optimal solution; Iteratively updating the position of each individual and the global optimal solution; When the maximum number of iterations is reached, the current global optimal solution is output, and the individual optimal position corresponding to the current global optimal solution is determined as the optimal model parameter of the initial prediction model; Substitute the optimal model parameters into the initial prediction model to obtain the candidate prediction model.

4. The method according to claim 3, characterized in that The step of determining the fitness of each individual in the population according to the sample input variable data, the sample output variable data and a preset fitness function comprises: Inputting the sample input variable data into the initial prediction model to obtain prediction data output by the initial prediction model; The predicted data and the sample output variable data are input into the fitness function to obtain the fitness of each individual.

5. The method according to claim 2, characterized in that: The step of training and testing the candidate prediction model according to the sample input variable data and the sample output variable data to obtain the energy demand prediction model includes: Acquire a training data set and a test data set according to the sample input variable data and the sample output variable data; Using the training data set, performing model training on the candidate prediction model to obtain a trained candidate prediction model; The trained candidate prediction model is tested using the test data set to obtain the energy demand prediction model.

6. The method according to claim 5, characterized in that The test data set includes test input variable data and test output variable data; The method of using the test data set to test the trained candidate prediction model to obtain the energy demand prediction model includes: Inputting the test input variable data into the trained candidate prediction model to obtain prediction data output by the trained candidate prediction model; Inputting the prediction data and the test output variable data into a plurality of preset prediction accuracy evaluation functions to obtain a plurality of evaluation index values; If all the evaluation index values ​​satisfy the corresponding preset index value range, the trained candidate prediction model is determined as the energy demand prediction model.

7. An energy demand prediction device, characterized in that: The device comprises: A data acquisition module is used to acquire energy data to be measured; the energy data to be measured includes original data that affects coal demand; The demand prediction module is used to process the energy data to be measured using an energy demand prediction model to obtain an energy demand prediction result of the energy data to be measured; the energy demand prediction model is obtained by iteratively optimizing the model parameters of the initial prediction model using sample energy data; the sample energy data includes historical energy data that affects coal demand.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Energy load demand prediction method and device, computer equipment, readable storage medium and program product

    CN118839932A

  • Cotton yarn evenness prediction model construction method

    CN119204145A

  • Micro-grid energy-saving scheme generation method and system based on energy storage optimization scheduling

    CN119209504A