Carbon price prediction method and device of LSTM model based on attention mechanism
By introducing the attention mechanism layer into the LSTM model and analyzing the time series data of the carbon trading market, it solves the shortcomings of carbon price prediction models in the existing technology in capturing the interaction of complex factors and achieves more efficient and reliable carbon price predictions. , suitable for operating decisions of power generation enterprises.
Patent Information
- Application Number
- CN202410857367.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-20
AI Technical Summary
Existing carbon price prediction models fail to fully capture and analyze the interaction of complex factors of carbon price fluctuations, affecting the accuracy and reliability of prediction results.
The LSTM model based on the attention mechanism is used, combined with the LSTM network and the attention mechanism layer, to analyze time series data, predict future price trends by memorizing historical data information, and monitor the loss function through the training set data to ensure effective learning of the model and continuously optimize the model. to adapt to market changes.
It significantly improves the accuracy, efficiency and stability of carbon price forecasting, provides more accurate trend forecasting results, and helps power generation companies formulate effective market strategies and carbon emission management plans.
Smart Images

Figure CN118674480A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data analysis and prediction technology, and more specifically, to a carbon price prediction method based on an LSTM model with an attention mechanism. Background Art
[0002] The economic development model that is highly dependent on fossil fuels as a driving force has led to an increase in greenhouse gas emissions, becoming one of the main causes of environmental problems such as global warming and extreme weather. Mitigating climate change requires effective improvements in energy consumption systems worldwide, promoting energy conservation, emission reduction and low-carbon economic development. Carbon emission rights trading is an effective means of controlling carbon emissions using market mechanisms.
[0003] As the impact of global climate change becomes increasingly significant, governments and market participants around the world continue to pay attention to the price dynamics of carbon emission rights. Accurate carbon price forecasts are essential for formulating effective environmental policies and market strategies. Carbon price fluctuations are complex and are affected by a variety of factors, including policy changes, market supply and demand, and economic conditions. Existing forecasting models, such as regression analysis and basic machine learning models, often fail to fully capture and analyze the complex interactions of these factors, thus affecting the accuracy and reliability of forecast results. Therefore, developing a new forecasting model to improve forecast accuracy is an urgent problem that needs to be solved. Summary of the invention
[0004] The purpose of the present invention is to provide a carbon price prediction method based on an LSTM model with an attention mechanism.
[0005] The present invention aims to solve the problems existing in the prior art.
[0006] Compared with the prior art, the technical solution of the present invention and its beneficial effects are as follows:
[0007] The first aspect disclosed by the present invention provides a carbon price prediction method based on an LSTM model of an attention mechanism, comprising: collecting and preprocessing historical data of a carbon trading market, wherein the historical data includes carbon prices and economic indicator data; combining an LSTM network model with an attention mechanism into an AT-LSTM model, adopting the AT-LSTM model to analyze time series data, and predicting future price trends by memorizing time series data information; training the AT-LSTM model using training set data, monitoring the loss function during the training process, and ensuring that the AT-LSTM model can learn effectively; applying the prediction results of the AT-LSTM model to the operating decisions of power generation enterprises; and continuously optimizing the AT-LSTM model according to user feedback and market changes, adjusting data input and algorithm parameters, and ensuring the continued effectiveness of the AT-LSTM model.
[0008] As a further improvement, the collecting and preprocessing of historical data of the carbon trading market, wherein the preprocessing of historical data of the carbon trading market includes:
[0009] Perform data standardization on historical data, that is,
[0010]
[0011] Among them, X is the output data, x is the input data, xmin is the minimum value of the input data, and xmax is the maximum value of the input data.
[0012] As a further improvement, the AT-LSTM model is trained using training set data, and the loss function during the training process is monitored to ensure that the AT-LSTM model can learn effectively, including: using an independent test set to evaluate the prediction performance of the AT-LSTM model; by comparing the difference between the prediction results of the AT-LSTM model and the actual carbon price, the root mean square error is calculated to evaluate the accuracy of the AT-LSTM model.
[0013] As a further improvement, the calculation formula of the root mean square error is:
[0014]
[0015] Among them, RMSE is the root mean square error, N is the number of samples, yc is the actual value of the cth sample, and yc ′ is the estimated value of the cth sample.
[0016] As a further improvement, the historical data of the carbon trading market is collected and preprocessed, and the historical data includes carbon prices and economic indicator data, wherein the economic indicator data includes carbon emissions, trading volume, energy prices, macroeconomic data and policy change records.
[0017] As a further improvement, the LSTM network model is combined with the attention mechanism into an AT-LSTM model, and the AT-LSTM model is used to analyze time series data, and future price trends are predicted by memorizing historical data information, wherein the AT-LSTM model includes an LSTM layer and an attention mechanism layer; the LSTM layer is used to process time series data; the attention mechanism layer is used to identify and emphasize key features and important moments in time series data, thereby improving the accuracy and efficiency of the AT-LSTM model prediction.
[0018] As a further improvement, the LSTM layer is used to process time series data, wherein the LSTM layer effectively learns and memorizes long-term dependencies in the time series through its forget gate, input gate and output gate.
[0019] As a further improvement, the AT-LSTM model includes an LSTM layer and an attention mechanism layer; wherein the attention mechanism layer uses a weighted technique to assign different weights to data at different time points, the weights are determined by the importance of the corresponding data, and the weights are set to highlight the time periods that have a greater impact on the prediction results.
[0020] As a further improvement, the historical data of the carbon trading market is collected and preprocessed, wherein the historical data is automatically captured from a publicly available database or from a trading platform of the carbon trading market to ensure real-time updating and accuracy of the data.
[0021] The second aspect disclosed by the present invention provides a carbon price prediction device based on an LSTM model with an attention mechanism, comprising: a data collection and preprocessing module, configured to collect and preprocess historical data of a carbon trading market, wherein the historical data includes carbon prices and economic indicator data; a prediction model establishment module, configured to combine the LSTM network model with the attention mechanism into an AT-LSTM model, adopt the AT-LSTM model to analyze time series data, and predict future price trends by memorizing time series data information; a prediction model training module, configured to train the AT-LSTM model using training set data, monitor the loss function during the training process, and ensure that the AT-LSTM model can learn effectively; a prediction model optimization module, configured to apply the prediction results of the AT-LSTM model to the operating decisions of power generation enterprises; and continuously optimize the AT-LSTM model according to user feedback and market changes, adjust data input and algorithm parameters, and ensure the continued effectiveness of the AT-LSTM model.
[0022] The beneficial effects of the present invention are:
[0023] The present invention provides a method for predicting the market price of carbon emission rights by using machine learning and deep learning technology, by collecting and preprocessing historical data of the carbon trading market, including price and trading volume; using LSTM network to analyze time series data, and predicting future price trends by memorizing past information; introducing attention mechanism to optimize LSTM network, and strengthening the model's ability to learn key features in time series, especially at important time points in the data, so as to more accurately capture the key factors affecting carbon prices; and verifying the prediction performance of the model through experiments, and comparing it with the existing technology to prove its superiority.
[0024] The method provided by the present invention combines a long short-term memory network (LSTM) and an attention mechanism to improve the accuracy, efficiency and stability of carbon price prediction.
[0025] The method proposed in the present invention is significantly superior to the traditional model, and the overall trend obtained is more consistent with the actual price. The prediction results can be applied to the business decisions of power generation companies to help them formulate more effective market strategies and carbon emission management plans. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a schematic diagram of a carbon price prediction method based on an LSTM model of an attention mechanism provided in an embodiment of the present invention.
[0027] Figure 2 It is a schematic diagram of a carbon price prediction device based on an LSTM model of an attention mechanism provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0029] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0030] Reference Figure 1 As shown, a carbon price prediction method based on an LSTM model with an attention mechanism is characterized in that it includes: collecting and preprocessing historical data of the carbon trading market, wherein the historical data includes carbon prices and economic indicator data; combining the LSTM network model with the attention mechanism into an AT-LSTM model, using the AT-LSTM model to analyze time series data, and predicting future price trends by memorizing time series data information; using training set data to train the AT-LSTM model, monitoring the loss function during the training process, and ensuring that the AT-LSTM model can learn effectively; applying the prediction results of the AT-LSTM model to the operating decisions of power generation companies; continuously optimizing the AT-LSTM model according to user feedback and market changes, adjusting data input and algorithm parameters, and ensuring the continued effectiveness of the AT-LSTM model.
[0031] The collecting and preprocessing of historical data of the carbon trading market, wherein the preprocessing of historical data of the carbon trading market includes:
[0032] In order to eliminate the impact between data of different magnitudes, data standardization is performed to make them at the same magnitude to facilitate machine learning processing;
[0033] Among them, the historical data is processed by data standardization, that is,
[0034]
[0035] Among them, X is the output data, x is the input data, xmin is the minimum value of the input data, and xmax is the maximum value of the input data.
[0036] The method of using the training set data to train the AT-LSTM model and monitoring the loss function during the training process to ensure that the AT-LSTM model can learn effectively includes: using an independent test set to evaluate the prediction performance of the AT-LSTM model; and calculating the root mean square error by comparing the difference between the prediction results of the AT-LSTM model and the actual carbon price to evaluate the accuracy of the AT-LSTM model.
[0037] The calculation formula of the root mean square error is:
[0038]
[0039] Among them, RMSE is the root mean square error, N is the number of samples, yc is the actual value of the cth sample, and yc ′ is the estimated value of the cth sample.
[0040] The historical data of the carbon trading market is collected and preprocessed, and the historical data includes carbon prices and economic indicator data, wherein the economic indicator data includes carbon emissions, trading volume, energy prices, macroeconomic data and policy change records.
[0041] The LSTM network model is combined with the attention mechanism to form an AT-LSTM model, and the AT-LSTM model is used to analyze time series data, and future price trends are predicted by memorizing historical data information, wherein the AT-LSTM model includes an LSTM layer and an attention mechanism layer; the LSTM layer is used to process time series data; the attention mechanism layer is used to identify and emphasize key features and important moments in time series data, thereby improving the accuracy and efficiency of the AT-LSTM model prediction.
[0042] The LSTM layer is used to process time series data, wherein the LSTM layer effectively learns and memorizes long-term dependencies in the time series through its forget gate, input gate, and output gate.
[0043] The AT-LSTM model includes an LSTM layer and an attention mechanism layer; wherein the attention mechanism layer uses a weighted technique to assign different weights to data at different time points, the weights are determined by the importance of the corresponding data, and the weights are set to highlight the time periods that have a greater impact on the prediction results.
[0044] The attention mechanism is used to improve the LSTM model. The LSTM model can process data features by assigning weights, highlighting the influence of important features, and paying enough attention to key information. At the same time, the attention mechanism can solve the problem of information loss that may exist in the LSTM model.
[0045] Adding an attention mechanism layer on top of the LSTM model can help the model focus more on key information when processing long time series data. The weight of each moment is calculated through the fully connected layer and Softmax, and these weights are multiplied with the output of the LSTM module to weight the global features of the processing time point. Finally, the processed data is sent to the fully connected layer for prediction.
[0046] The historical data of the carbon trading market is collected and preprocessed, wherein the historical data is automatically captured from a publicly available database or from a trading platform of the carbon trading market to ensure real-time updating and accuracy of the data.
[0047] Reference Figure 2 As shown, a carbon price prediction device based on an LSTM model of an attention mechanism includes: a data collection and preprocessing module, configured to collect and preprocess historical data of a carbon trading market, wherein the historical data includes carbon prices and economic indicator data; a prediction model establishment module, configured to combine the LSTM network model with the attention mechanism into an AT-LSTM model, adopt the AT-LSTM model to analyze time series data, and predict future price trends by memorizing time series data information; a prediction model training module, configured to train the AT-LSTM model using training set data, monitor the loss function during the training process, and ensure that the AT-LSTM model can learn effectively; a prediction model optimization module, configured to apply the prediction results of the AT-LSTM model to the operating decisions of power generation enterprises; and continuously optimize the AT-LSTM model according to user feedback and market changes, adjust data input and algorithm parameters, and ensure the continued effectiveness of the AT-LSTM model.
[0048] The data collection and preprocessing module is used to collect historical time series data of carbon prices and related economic indicators, including but not limited to carbon prices, carbon emissions, trading volumes, related energy prices (such as coal and natural gas prices), macroeconomic data (such as GDP growth rate, industrial production index) and policy change records.
[0049] The prediction model building module combines the output of the LSTM network layer and the attention mechanism layer to predict future carbon prices based on the data features learned by the model and the dynamic patterns of the time series. The prediction model building module uses a software interface to display the prediction results and provides an export function, allowing users to download or directly view carbon price forecast data and related analysis reports.
[0050] The prediction model optimization module automatically adjusts the parameters of the LSTM network and attention mechanism based on the comparative analysis of the prediction results and the actual data, so as to continuously improve the accuracy and adaptability of the prediction model.
[0051] The units included in the device can be implemented in various ways, including software, hardware, firmware or any combination thereof. In some embodiments, one or more units can be implemented using software and / or firmware, such as machine executable instructions stored on a storage medium. In addition to or as an alternative to machine executable instructions, some or all of the units in the device can be implemented at least in part by one or more hardware logic components. As an example and not limitation, exemplary types of hardware logic components that can be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0052] In a third aspect of the present disclosure, an electronic device is provided, comprising: a memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method according to the first aspect of the present disclosure.
[0053] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which one or more computer instructions are stored, wherein the one or more computer instructions are executed by a processor to implement the method according to the first aspect of the present disclosure.
[0054] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0055] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0056] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0057] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0058] The above embodiments are only used to explain the technical solutions of the present invention rather than to limit them. Those skilled in the art should understand that any modification and equivalent substitution that does not depart from the spirit and scope of the present invention should fall within the protection scope of the claims of the present invention.
Claims
1. A carbon price prediction method based on an LSTM model with an attention mechanism, characterized in that: include: Collect and pre-process historical data of the carbon trading market, including carbon price and economic indicator data; The LSTM network model is combined with the attention mechanism into the AT-LSTM model. The AT-LSTM model is used to analyze time series data and predict future price trends by memorizing time series data information. Use the training set data to train the AT-LSTM model and monitor the loss function during the training process to ensure that the AT-LSTM model can learn effectively; Apply the prediction results of the AT-LSTM model to the business decisions of power generation companies; continuously optimize the AT-LSTM model based on user feedback and market changes, adjust data input and algorithm parameters, and ensure the continued effectiveness of the AT-LSTM model.
2. According to the carbon price prediction method of the LSTM model based on the attention mechanism according to claim 1, it is characterized in that: The collecting and preprocessing of historical data of the carbon trading market, wherein the preprocessing of historical data of the carbon trading market includes: Perform data standardization on historical data, that is, Among them, X is the output data, x is the input data, xmin is the minimum value of the input data, and xmax is the maximum value of the input data.
3. The carbon price prediction method based on the LSTM model of the attention mechanism according to claim 1 is characterized in that: The method of using the training set data to train the AT-LSTM model and monitoring the loss function during the training process to ensure that the AT-LSTM model can learn effectively includes: An independent test set was used to evaluate the prediction performance of the AT-LSTM model. The root mean square error was calculated by comparing the prediction results of the AT-LSTM model with the actual carbon price to evaluate the accuracy of the AT-LSTM model.
4. The carbon price prediction method based on the LSTM model of the attention mechanism according to claim 3 is characterized in that: The calculation formula of the root mean square error is: Among them, RMSE is the root mean square error, N is the number of samples, yc is the actual value of the cth sample, and yc ′ is the estimated value of the cth sample.
5. The carbon price prediction method based on the LSTM model of the attention mechanism according to claim 1 is characterized in that: The historical data of the carbon trading market is collected and preprocessed, and the historical data includes carbon prices and economic indicator data, wherein the economic indicator data includes carbon emissions, trading volume, energy prices, macroeconomic data and policy change records.
6. The carbon price prediction method based on the LSTM model of the attention mechanism according to claim 1 is characterized in that: The LSTM network model is combined with the attention mechanism into an AT-LSTM model, and the AT-LSTM model is used to analyze time series data, and the future price trend is predicted by memorizing historical data information, wherein the AT-LSTM model includes an LSTM layer and an attention mechanism layer; The LSTM layer is used to process time series data; The attention mechanism layer is used to identify and emphasize key features and important moments in time series data, improving the accuracy and efficiency of the AT-LSTM model prediction.
7. The carbon price prediction method based on the LSTM model of the attention mechanism according to claim 6 is characterized in that: The LSTM layer is used to process time series data, wherein the LSTM layer effectively learns and memorizes long-term dependencies in the time series through its forget gate, input gate, and output gate.
8. The carbon price prediction method based on the LSTM model of the attention mechanism according to claim 6 is characterized in that: The AT-LSTM model includes an LSTM layer and an attention mechanism layer; wherein the attention mechanism layer uses a weighted technique to assign different weights to data at different time points, the weights are determined by the importance of the corresponding data, and the weights are set to highlight the time periods that have a greater impact on the prediction results.
9. The carbon price prediction method based on the LSTM model of the attention mechanism according to claim 1 is characterized in that: The historical data of the carbon trading market is collected and preprocessed, wherein the historical data is automatically captured from a publicly available database or from a trading platform of the carbon trading market to ensure real-time updating and accuracy of the data.
10. A carbon price prediction device based on an LSTM model with an attention mechanism, characterized in that: include: A data collection and preprocessing module, configured to collect and preprocess historical data of the carbon trading market, wherein the historical data includes carbon prices and economic indicator data; The prediction model building module is configured to combine the LSTM network model with the attention mechanism into an AT-LSTM model, use the AT-LSTM model to analyze time series data, and predict future price trends by memorizing time series data information; The prediction model training module is configured to train the AT-LSTM model using the training set data and monitor the loss function during the training process to ensure that the AT-LSTM model can learn effectively; The prediction model optimization module is configured to apply the prediction results of the AT-LSTM model to the operating decisions of power generation companies; continuously optimize the AT-LSTM model based on user feedback and market changes, adjust data input and algorithm parameters, and ensure the continued effectiveness of the AT-LSTM model.
Citation Information
Cited By
Carbon emission prediction method and system based on LSTM and self-attention
CN119539140A
