Carbon emission prediction system, method and computer program product
By adopting long-term memory network and attention mechanism in carbon emission prediction and optimizing hyperparameters with sparrow search algorithm, the gradient disappearance problem of traditional RNNs in long-term series prediction is solved, and the accuracy and model performance of carbon emission prediction are improved. .
Patent Information
- Application Number
- CN202411181156.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-27
AI Technical Summary
Traditional carbon emission prediction methods are prone to gradient disappearance problems when using recurrent neural network RNN, which is difficult to deal with long-term prediction tasks, and are not suitable for long-term prediction needs of carbon emissions.
A long-term and short-term memory network algorithm is used to establish a carbon emission prediction model in combination with attention mechanism, and hyperparameters are optimized through the sparrow search algorithm to improve prediction accuracy and fitness.
Improve the accuracy of carbon emission prediction, make the model more suitable for processing long-time series data, enhances the flexibility and interpretability of the model, and improves prediction performance through optimal hyperparameters.
Smart Images

Figure CN119204721A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of carbon emission prediction, and in particular to a carbon emission prediction system, method and computer program product. Background Art
[0002] In recent years, global warming has been recognized as one of the most pressing challenges to the world's environmental problems, and carbon emissions are considered to be the most important factor affecting global temperature changes. Therefore, it is of great significance to predict and control carbon emissions.
[0003] Traditional carbon emission prediction methods often use recurrent neural networks (RNNs) for prediction. Recurrent neural networks (RNNs) are prone to the problem of gradient vanishing when processing long sequences, making them difficult to train and not good at handling long-term time series prediction tasks. Carbon emission predictions often require predictions on long time series. Summary of the invention
[0004] The purpose of the present invention is to provide a carbon emission prediction system, method and computer program product to address the defects of the prior art.
[0005] A carbon emission prediction system, comprising:
[0006] A carbon emission prediction model building module is used to build a carbon emission prediction model using a long short-term memory network algorithm, and train the carbon emission prediction model based on historical carbon emission data to be predicted;
[0007] The carbon emission prediction module is used to input the current carbon emission data to be predicted into the trained carbon emission prediction model to obtain carbon emission prediction data.
[0008] Furthermore, it also includes a data collection module, which is used to collect historical carbon emission data to be predicted and pre-process the historical carbon emission data.
[0009] Furthermore, the specific method for preprocessing the carbon emission historical data is as follows:
[0010] For missing values of historical carbon emission data, linear interpolation method is used to fill in the data;
[0011] For outliers in historical carbon emission data, data horizontal comparison method and data vertical comparison method are used to fill and remove data;
[0012] Finally, the historical data of carbon emissions is normalized, and the formula is as follows:
[0013]
[0014] Among them, x *is the normalized historical data of carbon emissions, x is the historical data of carbon emissions, and x min is the minimum value of historical carbon emission data, x max This is the maximum value of historical carbon emissions data.
[0015] Furthermore, in the carbon emission prediction model establishment module, the specific method of establishing the carbon emission prediction model using the long short-term memory network algorithm is as follows:
[0016] h t+1 =o t ·tanh(c t+n );
[0017]
[0018] i t =σ(W i [h t ,x t ]+b i )
[0019] f t =σ(W f [h t ,x t ]+b f )
[0020] o t =σ(W o [h t ,x t ]+b o )
[0021] Among them, x t is the historical carbon emission data at time t, h t+1 is the historical data of carbon emissions x t The carbon emission prediction data of the adjacent time step, the input of the carbon emission prediction model is the carbon emission historical data set X = {x1, x2, x3, …, x t}, the output of the carbon emission prediction model is the carbon emission prediction data set H = {h2,h3,h4,…,h t+1}, the time step is two adjacent x t or two h t The length of time between t+n is the historical data of carbon emissions x t Carbon emission data separated by n time steps predicts long-term values, is to calculate the carbon emission data to predict the long-term value c t+n The middle value, W i , W f , W o , W cThey are respectively the input gate i in the long short-term memory network algorithm t 、Forget gate t , output gate o t and the median The weight matrix, b i , b f , b o , b c They are respectively the input gate i in the long short-term memory network algorithm t 、Forget gate t , output gate o t and the median The bias vector of , σ represents the Sigmoid function, and tanh represents the hyperbolic tangent function.
[0022] Furthermore, the carbon emission prediction model building module is also used to optimize the carbon emission prediction model using the attention mechanism. The specific method is as follows:
[0023] For each carbon emission prediction data h t+1 , calculate the attention score e t+1 =a(h t+1 ,h s ), where h s It refers to any carbon emission prediction data with a serial number s specified in the output set H of the carbon emission prediction model, and a is the attention score function obtained by dot product calculation, and then the attention score e is calculated. t+1 Converted to weights through the softmax function: Carbon emission prediction data optimized by attention mechanism
[0024] Furthermore, in the carbon emission prediction model establishment module, the specific method of training the carbon emission prediction model according to the historical carbon emission data to be predicted is as follows:
[0025] The sparrow search algorithm is used to optimize the hyperparameters in the carbon emission prediction model. The hyperparameters are W i , W f , W o , W c , b i , b f , b o , b c , the specific method is as follows:
[0026] Initialize the population size and maximum number of iterations in the sparrow population search algorithm, set the dimension, lower boundary, upper boundary in the sparrow population search algorithm, set the warning value, the proportion of discoverers, the proportion of sparrows aware of danger, the number of discoverers, and the number of sparrows aware of danger in the sparrow search algorithm;
[0027] A set of hyperparameters of the carbon emission prediction model is randomly generated as a sparrow in the initial population, and the fitness value of each sparrow is calculated in each round of iteration. When the stopping condition is reached, the hyperparameter combination represented by the sparrow with the best fitness value is output. The stopping condition is that the maximum number of iterations is reached or the lower fitness value of the fitness values of all sparrows does not change after two rounds of iterations.
[0028] Furthermore, the specific method for calculating the fitness value of each sparrow is:
[0029] The hyperparameter combination represented by each sparrow is brought into the carbon emission prediction model, and the historical carbon emission data is divided into a training set and a test set. The training set is input to obtain the predicted value, and then the predicted value and the actual value in the test set are evaluated using the mean absolute percentage error (MAPE), mean absolute error (MAE), and mean square error (MSE). The calculation formula is as follows:
[0030]
[0031]
[0032] Among them, h t+1 is the carbon emission prediction data, Y(t+1) is the actual value of carbon emission in the test set, t is the sequence number of the moment, and n is the total number of data in the training set;
[0033] The fitness value is any one of mean absolute percentage error (MAPE), mean absolute error (MAE), and mean square error (MSE).
[0034] Furthermore, the carbon emission historical data is divided into a training set and a test set in a ratio of 4:1.
[0035] A carbon emission prediction method, comprising:
[0036] A carbon emission prediction model building module is used to build a carbon emission prediction model using a long short-term memory network algorithm, and train the carbon emission prediction model based on historical carbon emission data to be predicted;
[0037] The carbon emission prediction module is used to input the current carbon emission data to be predicted into the trained carbon emission prediction model to obtain carbon emission prediction data.
[0038] A computer program product comprises a computer program / instruction, wherein the computer program / instruction implements the above-mentioned carbon emission prediction method when executed by a processor.
[0039] The beneficial effects of the present invention are:
[0040] 1. The present invention establishes a carbon emission prediction model based on the long short-term memory network algorithm, and then uses the attention mechanism to optimize the carbon emission prediction model, thereby improving the prediction accuracy. Finally, the sparrow search algorithm is used to find the optimal hyperparameters, so that the carbon emission prediction model can obtain the optimal parameters according to the fitness value. This further improves the prediction accuracy based on the LSTM model, and is more suitable for processing long time series prediction problems than the recurrent neural network RNN.
[0041] 2. The present invention introduces an attention mechanism, which allows the carbon emission prediction model to focus more on the part of the input sequence that is related to the current prediction, enhancing the flexibility and interpretability of the model, thereby improving the performance and accuracy of the model.
[0042] 3. The present invention uses the carbon emission data of the cement industry to predict the future carbon emission of the cement industry. Enterprises can use the relevant data to formulate more effective carbon emission reduction plans and promote the transformation of enterprises towards sustainable development. It can achieve the rational allocation of resources, reduce production costs, and improve resource utilization efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 is a system block diagram of the present invention;
[0044] Figure 2 It is a flow chart of the carbon emission prediction model of the present invention;
[0045] Figure 3 Mechanism diagram of the long short-term memory network algorithm. DETAILED DESCRIPTION
[0046] In order to make the technical problems, technical solutions and beneficial effects to be solved by 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.
[0047] Example 1
[0048] refer to Figure 1 , a carbon emission prediction system, comprising:
[0049] A data collection module, used to collect historical carbon emission data to be predicted and pre-process the historical carbon emission data;
[0050] A carbon emission prediction model building module is used to build a carbon emission prediction model using a long short-term memory network algorithm, and train the carbon emission prediction model based on historical carbon emission data to be predicted;
[0051] The carbon emission prediction module is used to input the current carbon emission data to be predicted into the trained carbon emission prediction model to obtain carbon emission prediction data.
[0052] (1) The specific method for preprocessing the carbon emission historical data is as follows:
[0053] For missing values of historical carbon emission data, linear interpolation method is used to fill in the data;
[0054] For outliers in historical carbon emission data, data horizontal comparison method and data vertical comparison method are used to fill and remove data;
[0055] Finally, the historical data of carbon emissions is normalized, and the formula is as follows:
[0056]
[0057] Among them, x * is the normalized historical data of carbon emissions, x is the historical data of carbon emissions, and x min is the minimum value of historical carbon emission data, x max This is the maximum value of historical carbon emissions data.
[0058] Normalizing the data can not only accelerate the convergence of the gradient descent algorithm, but also help avoid numerical instability problems caused by values that are too large or too small.
[0059] (2) In the carbon emission prediction model establishment module, the specific method of establishing the carbon emission prediction model using the long short-term memory network algorithm is as follows:
[0060] h t+1 =o t ·tanh(c t+n );
[0061]
[0062] i t =σ(w i [h t ,x t ]+b i )
[0063] f t =σ(W f [h t ,x t ]+b f )
[0064] o t =σ(W o [h t ,x t ]+b o )
[0065] Among them, xt is the historical carbon emission data at time t, h t+1 is the historical data of carbon emissions x t The carbon emission prediction data of the adjacent time step, the input of the carbon emission prediction model is the carbon emission historical data set X = {x1, x2, x3, …, x t}, the output of the carbon emission prediction model is the carbon emission prediction data set H = {h2,h3,h4,…,h t+1}, the time step is two adjacent x t or two h t The length of time between t+n is the historical data of carbon emissions x t Carbon emission data separated by n time steps predicts long-term values, is to calculate the carbon emission data to predict the long-term value c t+n The middle value, W i , W f , W o , W c They are respectively the input gate i in the long short-term memory network algorithm t 、Forget gate t , output gate o t and the median The weight matrix, b i , b f , b o , b c They are respectively the input gate i in the long short-term memory network algorithm t 、Forget gate t , output gate o t and the median The bias vector of , σ represents the Sigmoid function, and tanh represents the hyperbolic tangent function.
[0066] The Long Short-Term Memory (LSTM) network algorithm is a variant of the Recurrent Neural Network (RNN) that is specifically designed to process sequence data. Compared with the traditional RNN structure, LSTM introduces a gating mechanism that can better capture long-term dependencies in sequence data. Since the input data is a collection of carbon emission data at every other time step, and the sequence in the collection is long, the Long Short-Term Memory network algorithm is very suitable for carbon emission data prediction. Traditional RNNs are prone to the problem of gradient vanishing when processing long sequences, making it difficult to train. LSTM introduces a gating mechanism that can effectively alleviate the gradient vanishing problem, so that it can process longer sequence data. LSTM can better capture long-term dependencies in sequence data through cell states and gating mechanisms. Compared with traditional RNNs, LSTM has better memory performance and can retain distant context information when processing sequence data. LSTM is sensitive to time and can learn patterns and features in time series data. This gives LSTM an advantage in tasks such as time series prediction and signal processing.
[0067] (3) The carbon emission prediction model building module is also used to optimize the carbon emission prediction model using the attention mechanism. The specific method is as follows:
[0068] For each carbon emission prediction data h t+1 , calculate the attention score e t+1 =a(h t+1 ,h s ), where h s It refers to any carbon emission prediction data with a serial number s specified in the output set H of the carbon emission prediction model, and a is the attention score function obtained by dot product calculation, and then the attention score e is calculated. t+1 Converted to weights through the softmax function: Carbon emission prediction data optimized by attention mechanism
[0069] The attention mechanism allows the carbon emission prediction model to focus more on the parts of the input sequence that are relevant to the current prediction, enhancing the flexibility and interpretability of the model, thereby improving the performance and accuracy of the model.
[0070] (4) In the carbon emission prediction model establishment module, the specific method for training the carbon emission prediction model based on the historical carbon emission data to be predicted is as follows:
[0071] The sparrow search algorithm is used to optimize the hyperparameters in the carbon emission prediction model. The hyperparameters are W i , W f , Wo , W c 、b i 、b f 、b o 、b c , the specific method is as follows:
[0072] Initialize the population size and maximum number of iterations in the sparrow population search algorithm, set the dimension, lower boundary, upper boundary in the sparrow population search algorithm, set the warning value, the proportion of discoverers, the proportion of sparrows aware of danger, the number of discoverers, and the number of sparrows aware of danger in the sparrow search algorithm;
[0073] A set of hyperparameters of the carbon emission prediction model is randomly generated as a sparrow in the initial population, and the fitness value of each sparrow is calculated in each round of iteration. When the stopping condition is reached, the hyperparameter combination represented by the sparrow with the best fitness value is output. The stopping condition is that the maximum number of iterations is reached or the lower fitness value of the fitness values of all sparrows does not change after two rounds of iterations.
[0074] The specific method for calculating the fitness value of each sparrow is:
[0075] The hyperparameter combination represented by each sparrow is brought into the carbon emission prediction model, and the historical carbon emission data is divided into a training set and a test set. The ratio of the historical carbon emission data to the training set and the test set is 4:1. The training set is input to obtain the predicted value, and then the predicted value and the actual value in the test set are evaluated using the mean absolute percentage error MAPE, mean absolute error MAE, and mean square error MSE, respectively. The calculation formula is as follows:
[0076]
[0077] Among them, h t+1 is the carbon emission prediction data, Y(t+1) is the actual value of carbon emission in the test set, t is the sequence number of the moment, and n is the total number of data in the training set;
[0078] The fitness value is any one of mean absolute percentage error (MAPE), mean absolute error (MAE), and mean square error (MSE).
[0079] In order to verify the prediction performance of the carbon emission prediction model optimized based on the sparrow search algorithm, the data in this article are respectively predicted using the carbon emission prediction model constructed by the long short-term memory network algorithm (LSTM), the carbon emission prediction model constructed by the long short-term memory network algorithm optimized by the attention mechanism (LSTM-Attention), the carbon emission prediction model constructed by the long short-term memory network algorithm optimized by the sparrow algorithm (SSA-LSTM), and the carbon emission prediction model constructed by the long short-term memory network algorithm optimized by the sparrow algorithm and the attention mechanism (SSA-LSTM-Attention) of this embodiment. The models are compared and evaluated by comparing the final fitness values of the models. It can be seen from Table 1 that after training and prediction of different models, the data of LSTM and SSA-LSTM-Attention show that the prediction effect of the combined model is significantly better than that of a single prediction model; by comparing the error indicators of SSA-LSTM and SSA-LSTM-Attention, it can be seen that the introduction of the attention mechanism has greatly improved the prediction accuracy of the model; by comparing the data of LSTM-Attention and SSA-LSTM-Attention, it can be analyzed that the optimization of hyperparameters by the sparrow search method has a significant promoting effect on the final prediction effect, greatly improving the prediction accuracy.
[0080] Table 1. Error index of carbon emission model prediction model
[0081]
[0082] The sparrow search algorithm is used to find the optimal hyperparameters, so that the carbon emission prediction model can obtain the optimal parameters according to the fitness value, which further improves the prediction accuracy based on the LSTM model.
[0083] Example 2
[0084] refer to Figure 2 , a carbon emission prediction method, comprising:
[0085] Collecting historical carbon emission data to be predicted and preprocessing the historical carbon emission data;
[0086] A carbon emission prediction model is established using a long short-term memory network algorithm, and the carbon emission prediction model is trained based on the historical data of carbon emissions to be predicted;
[0087] The current carbon emission data to be predicted is input into the trained carbon emission prediction model to obtain the carbon emission prediction data.
[0088] (1) The specific method for preprocessing the carbon emission historical data is as follows:
[0089] For missing values of historical carbon emission data, linear interpolation method is used to fill in the data;
[0090] For outliers in historical carbon emission data, data horizontal comparison method and data vertical comparison method are used to fill and remove data;
[0091] Finally, the historical data of carbon emissions is normalized, and the formula is as follows:
[0092]
[0093] Among them, x * is the normalized historical data of carbon emissions, x is the historical data of carbon emissions, and x min is the minimum value of historical carbon emission data, x max This is the maximum value of historical carbon emissions data.
[0094] Normalizing the data can not only accelerate the convergence of the gradient descent algorithm, but also help avoid numerical instability problems caused by values that are too large or too small.
[0095] (2) The specific method of establishing a carbon emission prediction model using the long short-term memory network algorithm is as follows:
[0096] h t+1 =o t ·tanh(c t+n );
[0097]
[0098] i t =σ(W i [h t ,x t ]+b i )
[0099] f t =σ(W f [h t ,x t ]+b f )
[0100] o t =σ(W o [h t , x t]+b o )
[0101] Among them, x t is the historical carbon emission data at time t, h t+1 is the historical data of carbon emissions x tThe carbon emission prediction data of the adjacent time step, the input of the carbon emission prediction model is the carbon emission historical data set X = {x1, x2, x3, …, x t}, the output of the carbon emission prediction model is the carbon emission prediction data set H = {h2,h3,h4,…,h t+1}, the time step is two adjacent x t or two h t The length of time between t+n is the historical data of carbon emissions x t Carbon emission data separated by n time steps predicts long-term values, is to calculate the carbon emission data to predict the long-term value c t+n The middle value, W i , W f , W o , W c They are respectively the input gate i in the long short-term memory network algorithm t 、Forget gate t , output gate o t and the median The weight matrix, b i , b f , b o , b c They are respectively the input gate i in the long short-term memory network algorithm t 、Forget gate t , output gate o t and the median The bias vector of , σ represents the Sigmoid function, and tanh represents the hyperbolic tangent function.
[0102] The Long Short-Term Memory (LSTM) network algorithm is a variant of the Recurrent Neural Network (RNN) that is specifically designed to process sequence data. Compared with the traditional RNN structure, LSTM introduces a gating mechanism that can better capture long-term dependencies in sequence data. Since the input data is a collection of carbon emission data at every other time step, and the sequence in the collection is long, the Long Short-Term Memory network algorithm is very suitable for carbon emission data prediction. Traditional RNNs are prone to the problem of gradient vanishing when processing long sequences, making it difficult to train. LSTM introduces a gating mechanism that can effectively alleviate the gradient vanishing problem, so that it can process longer sequence data. LSTM can better capture long-term dependencies in sequence data through cell states and gating mechanisms. Compared with traditional RNNs, LSTM has better memory performance and can retain distant context information when processing sequence data. LSTM is sensitive to time and can learn patterns and features in time series data. This gives LSTM an advantage in tasks such as time series prediction and signal processing.
[0103] (3) Use the attention mechanism to optimize the carbon emission prediction model. The specific method is as follows:
[0104] For each carbon emission prediction data h t+1 , calculate the attention score e t+1 =a(h t+1 ,h s ), where h s It refers to any carbon emission prediction data with a serial number s specified in the output set H of the carbon emission prediction model, and a is the attention score function obtained by dot product calculation, and then the attention score e is calculated. t+1 Converted to weights through the softmax function: Carbon emission prediction data optimized by attention mechanism
[0105] The attention mechanism allows the carbon emission prediction model to focus more on the parts of the input sequence that are relevant to the current prediction, enhancing the flexibility and interpretability of the model, thereby improving the performance and accuracy of the model.
[0106] (4) The specific method for training the carbon emission prediction model based on the historical carbon emission data to be predicted is as follows:
[0107] The sparrow search algorithm is used to optimize the hyperparameters in the carbon emission prediction model. The hyperparameters are W i , W f , W o , W c 、bi 、b f 、b o 、b c , the specific method is as follows:
[0108] Initialize the population size and maximum number of iterations in the sparrow population search algorithm, set the dimension, lower boundary, upper boundary in the sparrow population search algorithm, set the warning value, the proportion of discoverers, the proportion of sparrows aware of danger, the number of discoverers, and the number of sparrows aware of danger in the sparrow search algorithm;
[0109] A set of hyperparameters of the carbon emission prediction model is randomly generated as a sparrow in the initial population, and the fitness value of each sparrow is calculated in each round of iteration. When the stopping condition is reached, the hyperparameter combination represented by the sparrow with the best fitness value is output. The stopping condition is that the maximum number of iterations is reached or the lower fitness value of the fitness values of all sparrows does not change after two rounds of iterations.
[0110] The specific method for calculating the fitness value of each sparrow is:
[0111] The hyperparameter combination represented by each sparrow is brought into the carbon emission prediction model, and the historical carbon emission data is divided into a training set and a test set. The ratio of the historical carbon emission data to the training set and the test set is 4:1. The training set is input to obtain the predicted value, and then the predicted value and the actual value in the test set are evaluated using the mean absolute percentage error MAPE, mean absolute error MAE, and mean square error MSE, respectively. The calculation formula is as follows:
[0112]
[0113]
[0114] Among them, h t+1 is the carbon emission prediction data, Y(t+1) is the actual value of carbon emission in the test set, t is the sequence number of the moment, and n is the total number of data in the training set;
[0115] The fitness value is any one of mean absolute percentage error (MAPE), mean absolute error (MAE), and mean square error (MSE).
[0116] In order to verify the prediction performance of the carbon emission prediction model optimized based on the sparrow search algorithm, the data in this article are respectively predicted using the carbon emission prediction model constructed by the long short-term memory network algorithm (LSTM), the carbon emission prediction model constructed by the long short-term memory network algorithm optimized by the attention mechanism (LSTM-Attention), the carbon emission prediction model constructed by the long short-term memory network algorithm optimized by the sparrow algorithm (SSA-LSTM), and the carbon emission prediction model constructed by the long short-term memory network algorithm optimized by the sparrow algorithm and the attention mechanism (SSA-LSTM-Attention) of this embodiment. The models are compared and evaluated by comparing the final fitness values of the models. It can be seen from Table 1 that after training and prediction of different models, the data of LSTM and SSA-LSTM-Attention show that the prediction effect of the combined model is significantly better than that of a single prediction model; by comparing the error indicators of SSA-LSTM and SSA-LSTM-Attention, it can be seen that the introduction of the attention mechanism has greatly improved the prediction accuracy of the model; by comparing the data of LSTM-Attention and SSA-LSTM-Attention, it can be analyzed that the optimization of hyperparameters by the sparrow search method has a significant promoting effect on the final prediction effect, greatly improving the prediction accuracy.
[0117] Table 2 Error indicators of carbon emission model prediction model
[0118]
[0119] The sparrow search algorithm is used to find the optimal hyperparameters, so that the carbon emission prediction model can obtain the optimal parameters according to the fitness value, which further improves the prediction accuracy based on the LSTM model.
[0120] Example 3
[0121] A computer program product, comprising a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, the carbon emission prediction method described in Example 2 is implemented.
[0122] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any ordinary technician in the industry can smoothly implement the present invention as shown in the drawings and described above. However, any equivalent changes, modifications and evolutions made by technicians familiar with the profession without departing from the scope of the technical solution of the present invention using the technical content disclosed above are all equivalent embodiments of the present invention. At the same time, any equivalent changes, modifications and evolutions made to the above embodiments based on the essential technology of the present invention are still within the protection scope of the technical solution of the present invention.
Claims
1. A carbon emission prediction system, characterized in that: include: A carbon emission prediction model building module is used to build a carbon emission prediction model using a long short-term memory network algorithm, and train the carbon emission prediction model based on historical carbon emission data to be predicted; The carbon emission prediction module is used to input the current carbon emission data to be predicted into the trained carbon emission prediction model to obtain carbon emission prediction data.
2. The carbon emission prediction system according to claim 1, characterized in that: Also includes: The data collection module is used to collect historical carbon emission data to be predicted and pre-process the historical carbon emission data.
3. The carbon emission prediction system according to claim 2, characterized in that: The specific method for preprocessing the carbon emission historical data is as follows: For missing values of historical carbon emission data, linear interpolation method is used to fill in the data; For outliers in historical carbon emission data, data horizontal comparison method and data vertical comparison method are used to fill and remove data; Finally, the historical data of carbon emissions is normalized, and the formula is as follows: Among them, x * is the normalized historical data of carbon emissions, x is the historical data of carbon emissions, and x min is the minimum value of historical carbon emission data, x max This is the maximum value of historical carbon emissions data.
4. The carbon emission prediction system according to claim 1, characterized in that: In the carbon emission prediction model establishment module, the specific method of establishing the carbon emission prediction model using the long short-term memory network algorithm is as follows: h t+1 =o t ·tanh(c t+n ); i t =σ(W i [h t ,x t ]+b i ) f t =σ(W f [h t ,x t ]+b f ) the t =σ(W o [h t ,x t ]+b o ) Among them, x t is the historical carbon emission data at time t, h t+1 is the historical data of carbon emissions x t The carbon emission prediction data of the adjacent time step, the input of the carbon emission prediction model is the carbon emission historical data set X = {x1, x2, x3, ..., x t }, the output of the carbon emission prediction model is the carbon emission prediction data set H = {h2, h3, h4, ..., h t+1 }, the time step is two adjacent x t or two h t The length of time between t+n is the historical data of carbon emissions x t Carbon emission data separated by n time steps predicts long-term values, is to calculate the carbon emission data to predict the long-term value c t+n The middle value, W i , W f , W o , W c They are respectively the input gate i in the long short-term memory network algorithm t 、Forget gate t , output gate o t and the median The weight matrix, b i , b f , b o , b c They are respectively the input gate i in the long short-term memory network algorithm t 、Forget gate t , output gate o t and the median The bias vector of , σ represents the Sigmoid function, and tanh represents the hyperbolic tangent function.
5. The carbon emission prediction system according to claim 4, characterized in that: The carbon emission prediction model building module is also used to optimize the carbon emission prediction model using the attention mechanism. The specific method is as follows: For each carbon emission prediction data h t+1 , calculate the attention score e t+1 =a(h t+1 ,h s ), where h s It refers to any carbon emission prediction data with a serial number s specified in the output set H of the carbon emission prediction model, and a is the attention score function obtained by dot product calculation, and then the attention score e is calculated. t+1 Converted to weights through the softmax function Carbon emission prediction data optimized by attention mechanism The calculation formula is:
6. The carbon emission prediction system according to claim 4, characterized in that: In the carbon emission prediction model establishment module, the specific method of training the carbon emission prediction model according to the historical carbon emission data to be predicted is as follows: The sparrow search algorithm is used to optimize the hyperparameters in the carbon emission prediction model. The hyperparameters are W i , W f , W o , W c , b i , b f , b o , b c ; Initialize the population size and maximum number of iterations in the sparrow population search algorithm, set the dimension, lower boundary, upper boundary in the sparrow population search algorithm, set the warning value, the proportion of discoverers, the proportion of sparrows aware of danger, the number of discoverers, and the number of sparrows aware of danger in the sparrow search algorithm; A set of hyperparameters of the carbon emission prediction model is randomly generated as a sparrow in the initial population, and the fitness value of each sparrow is calculated in each round of iteration. When the stopping condition is reached, the hyperparameter combination represented by the sparrow with the best fitness value is output. The stopping condition is that the maximum number of iterations is reached or the lower fitness value of the fitness values of all sparrows does not change after two rounds of iterations.
7. The carbon emission prediction system according to claim 6, characterized in that: The specific method for calculating the fitness value of each sparrow is: The hyperparameter combination represented by each sparrow is brought into the carbon emission prediction model, and the historical carbon emission data is divided into a training set and a test set. The training set is input to obtain the predicted value, and then the predicted value and the actual value in the test set are evaluated using the mean absolute percentage error (MAPE), mean absolute error (MAE), and mean square error (MSE). The calculation formula is as follows: Among them, h t+1 is the carbon emission prediction data, Y(t+1) is the actual value of carbon emission in the test set, t is the sequence number of the moment, and n is the total number of data in the training set; The fitness value is any one of mean absolute percentage error (MAPE), mean absolute error (MAE), and mean square error (MSE).
8. The carbon emission prediction system according to claim 7, characterized in that: The carbon emission historical data is divided into a training set and a test set in a ratio of 4:
1.
9. A carbon emission prediction method, characterized in that: include: A carbon emission prediction model building module is used to build a carbon emission prediction model using a long short-term memory network algorithm, and train the carbon emission prediction model based on historical carbon emission data to be predicted; The carbon emission prediction module is used to input the current carbon emission data to be predicted into the trained carbon emission prediction model to obtain carbon emission prediction data.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the carbon emission prediction method according to claim 9 is implemented.
Citation Information
Cited By
Regional short-term carbon emission prediction method and related equipment
CN119783988A
Carbon emission prediction method and system based on big data analysis
CN120069216A
Construction method of carbon emission prediction model based on artificial intelligence
CN120297470A
Construction method of carbon emission prediction model based on artificial intelligence
CN120297470B
Construction process carbon emission prediction method for intelligent manufacturing
CN120542609A
