Carbon emission prediction method and system based on LSTM and self-attention

By introducing LSTM and self-attention mechanisms into the carbon emission prediction model, key information and correlation relationships of influencing factors are extracted, and the problem of inability to effectively capture nonlinear relationships and long-term dependencies in the existing technology is solved, and more accurate carbon emission prediction is achieved.

CN119539140APending Publication Date: 2025-02-28BEIJING UNIV OF POSTS & TELECOMM +2

Patent Information

Application Number
CN202411403789.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-09
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

Existing carbon emission prediction technologies cannot effectively capture the nonlinear relationships and long-term dependencies in time series data, making it difficult to achieve accurate predictions of unknown carbon emissions.

Method used

The carbon emission prediction model based on LSTM and self-attention is adopted, and the effective key information of influencing factors is extracted through the long-term memory layer, the self-attention layer obtains the correlation information between various factors, and outputs the carbon emission prediction results through the linear layer.

Benefits of technology

This method can more effectively capture nonlinear relationships and long-term dependencies in time series data, improving the ability to accurately predict carbon emissions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119539140A_ABST
    Figure CN119539140A_ABST
Patent Text Reader

Abstract

The invention provides a carbon emission prediction method and system based on LSTM and self-attention, and a prediction model training method comprises the steps: obtaining a training sample set, inputting training samples into an initial carbon emission prediction model which comprises a long-short term memory layer, a self-attention layer and a linear layer. And extracting and outputting effective key information corresponding to each influence factor by using the long-short term memory layer, inputting the effective key information corresponding to each influence factor into the self-attention layer, and outputting association information between each influence factor and other influence factors except for the influence factor. And integrating the associated information corresponding to each influence factor, inputting the integrated information into a linear layer, and outputting a carbon emission prediction result. And constructing a loss function based on the difference between the prediction result and the real label, minimizing the loss to update the model parameters until a preset training round number is reached, and obtaining a trained carbon emission prediction model. According to the method, multiple factors are comprehensively considered, the long-term dependency relationship of the data sequence is captured, and more accurate carbon emission prediction is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of carbon emission prediction, and in particular to a carbon emission prediction method and system based on LSTM and self-attention. Background Art

[0002] As the global greenhouse effect intensifies, reducing greenhouse gas emissions caused by human activities since the Industrial Revolution has become the top priority in solving human environmental problems. Accurate carbon emission forecasts can help decision makers understand future emission trends and formulate effective emission reduction measures to slow down global warming.

[0003] Carbon emission forecasting predicts the future carbon emissions of a region or industry by analyzing and modeling historical data, economic indicators, energy use and other factors. This work is of great significance in addressing global climate change and achieving sustainable development goals.

[0004] Currently available carbon emission forecasting technologies either only consider the impact of years on carbon emissions and ignore other factors, or only consider the impact of a single factor on carbon emissions, or the established models cannot capture the long-term information of time series data and the correlation information between multiple factors. Existing carbon emission forecasting methods cannot achieve accurate prediction of unknown carbon emissions. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a carbon emission prediction method and system based on LSTM and self-attention to eliminate or improve the defect of low accuracy of carbon emission prediction in the prior art.

[0006] A first aspect of the present invention provides a method for training a carbon emission prediction model based on LSTM and self-attention, the method comprising the following steps:

[0007] Acquire a training sample set, wherein a set of training samples in the training sample set includes multiple influencing factor data; input the training samples into an initial carbon emission prediction model; the initial carbon emission prediction model includes a long short-term memory layer, a self-attention layer, and a linear layer;

[0008] The initial carbon emission prediction model uses the long short-term memory layer to extract and output effective key information corresponding to each influencing factor;

[0009] Input the effective key information corresponding to each influencing factor into the self-attention layer, and output the correlation information between each influencing factor and other influencing factors other than itself;

[0010] Integrate the correlation information corresponding to each influencing factor and input it into the linear layer, and output the carbon emission prediction result;

[0011] A loss function is constructed based on the gap between the carbon emission prediction result and the true label, and the loss is minimized to update the model parameters until the number of training rounds reaches a preset number of training rounds, thereby obtaining a trained carbon emission prediction model.

[0012] In some embodiments of the present invention, the plurality of influencing factor data include historical carbon emission data, energy structure data, population data and economic data in a preset region;

[0013] The carbon emission historical data includes the carbon emissions in the preset area over the years and the corresponding years; the energy structure data includes the consumption of various energy sources in the preset area over the years; the population data includes the population number in the preset area over the years and the corresponding numbers of various population classifications; the economic data includes the growth value of various industries in the preset area and the residents' consumption level data.

[0014] In some embodiments of the present invention, the initial carbon emission prediction model uses the long short-term memory layer to extract effective key information corresponding to each influencing factor data, and the calculation formula is:

[0015]

[0016] Among them, a i Indicates the effective key information corresponding to each influencing factor data, x i represents the influencing factor data, i represents the influencing factor number, σ represents the activation function, and w ls and b ls Represents the parameters of the long short-term memory layer.

[0017] In some embodiments of the present invention, before inputting the training samples into the initial carbon emission prediction model, the method further includes: performing data preprocessing and normalization on the training sample set;

[0018] The data preprocessing includes cleaning the data in the training sample set, and classifying and encoding the data in the training sample set according to influencing factors.

[0019] In some embodiments of the present invention, the associated information corresponding to each influencing factor is integrated and input into the linear layer, and the carbon emission prediction result is output. The calculation formula is:

[0020] y cb =w ln ·(∑ i r i )+b ln ;

[0021] Among them, y cb represents the carbon emission prediction result, r iIndicates the associated information corresponding to each influencing factor, i represents the influencing factor number, w ln and b ln represents the parameters of the linear layer.

[0022] In some embodiments of the present invention, the associated information corresponding to each influencing factor is integrated, and also includes: introducing learnable weights, assigning corresponding weights to each influencing factor to adjust the contribution of each influencing factor to the carbon emission prediction result.

[0023] In some embodiments of the present invention, the algorithm for minimizing the loss to update the model parameters adopts a small batch stochastic gradient descent algorithm or an adaptive learning rate algorithm.

[0024] A second aspect of the present invention provides a carbon emission prediction method based on LSTM and self-attention, the method comprising:

[0025] Acquire carbon emission data, input the carbon emission data into a trained carbon emission prediction model obtained by the training method of the carbon emission prediction model based on LSTM and self-attention as described in any one of the above items, and output a carbon emission prediction result.

[0026] The third aspect of the present invention provides a carbon emission prediction system based on LSTM and self-attention, comprising a processor, a memory and a computer program stored in the memory, wherein the processor is used to execute the computer program, and when the computer program is executed, the system implements the steps of any of the methods described above.

[0027] A fourth aspect of the present invention provides a computer program product, comprising a computer program, which implements the steps of any of the above methods when executed by a processor.

[0028] The beneficial effects of the present invention are at least:

[0029] The present invention provides a carbon emission prediction method and system based on LSTM and self-attention. The prediction model training method is: obtain a training sample set, input the training sample into an initial carbon emission prediction model, and the model includes a long short-term memory layer, a self-attention layer, and a linear layer. The effective key information corresponding to each influencing factor is extracted and output by the long short-term memory layer, and the effective key information corresponding to each influencing factor is input into the self-attention layer, and the association information between each influencing factor and other influencing factors other than itself is output. The association information corresponding to each influencing factor is integrated and input into the linear layer, and the carbon emission prediction result is output. A loss function is constructed based on the gap between the prediction result and the true label, and the loss is minimized to update the model parameters until a preset number of training rounds is reached to obtain a trained carbon emission prediction model. The present invention comprehensively considers a variety of factors affecting carbon emissions, and considers the mutual influence between multiple factors. The prediction model constructed by the present invention can more effectively capture the nonlinear relationship and long-term dependency in time series data, thereby achieving a more accurate prediction of carbon emissions.

[0030] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention may be achieved and obtained by the structures specifically indicated in the specification and the accompanying drawings.

[0031] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of the present application, and do not constitute a limitation of the present invention. In the drawings:

[0033] Figure 1 This is a flow chart of a training method for a carbon emission prediction model based on LSTM and self-attention in one embodiment of the present invention.

[0034] Figure 2 This is a framework diagram of a carbon emission prediction model based on LSTM and self-attention mechanism in another embodiment of the present invention.

[0035] Figure 3 This is a structural framework diagram of each LSTM layer in another embodiment of the present invention.

[0036] Figure 4 Schematic diagram of LSTM neuron structure in another embodiment of the present invention.

[0037] Figure 52 is an architecture diagram of a self-attention layer in another embodiment of the present invention.

[0038] Figure 6 This is a flowchart of a carbon emission prediction model training based on LSTM and self-attention mechanism in another embodiment of the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0040] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.

[0041] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.

[0042] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.

[0043] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.

[0044] Carbon emission forecasting refers to the estimation and prediction of carbon dioxide (CO2) emissions in a specific region, industry or country in a certain period of time in the future. This forecast is of great significance for the formulation of environmental policies, resource management, energy planning, emission reduction strategies, etc.

[0045] An aspect of an embodiment of the present invention provides a training method for a carbon emission prediction model based on LSTM and self-attention, such as Figure 1 As shown, the method includes the following steps S101 to S105:

[0046] Step S101: Obtain a training sample set, wherein a set of training samples in the training sample set includes data of multiple influencing factors. Input the training samples into an initial carbon emission prediction model. The initial carbon emission prediction model includes a long short-term memory layer, a self-attention layer, and a linear layer.

[0047] Step S102: The initial carbon emission prediction model uses the long short-term memory layer to extract and output effective key information corresponding to each influencing factor.

[0048] Step S103: Input the effective key information corresponding to each influencing factor into the self-attention layer, and output the association information between each influencing factor and other influencing factors other than itself.

[0049] Step S104: Integrate the associated information corresponding to each influencing factor and input it into the linear layer to output the carbon emission prediction result.

[0050] Step S105: construct a loss function based on the gap between the carbon emission prediction result and the true label, minimize the loss to update the model parameters until the number of training rounds reaches a preset number of training rounds, and obtain a trained carbon emission prediction model.

[0051] In step S101, the plurality of influencing factor data includes historical carbon emission data, energy structure data, population data and economic data in a preset region.

[0052] Historical carbon emission data includes the carbon emissions in the preset area over the years and the corresponding years.

[0053] Energy structure data includes the consumption of various energy sources in a preset area over the years. For example, the energy consumption of a region over the years, the annual consumption and classification proportion of various energy sources such as coal, fuel oil, natural gas and electricity.

[0054] Population data includes the population numbers of the preset area over the years and the corresponding numbers of various population categories, such as the number and proportion of resident population, urban population and rural population.

[0055] Economic data include the growth value of various industries and residents' consumption level data in the preset region. Various industries can be classified according to economic activities, such as primary, secondary and tertiary industries; or classified according to international standards, or classified according to market characteristics. Residents' consumption level data can include residents' disposable income, the proportion of various types of consumption, etc.

[0056] In step S101, the initial carbon emission prediction model uses the long short-term memory layer to extract the effective key information corresponding to each influencing factor data, and the calculation formula is:

[0057]

[0058] Among them, a i Indicates the effective key information corresponding to each influencing factor data, x i represents the influencing factor data, i represents the influencing factor number, σ represents the activation function, and w ls and b ls Represents the parameters of the long short-term memory layer.

[0059] Furthermore, each influencing factor data corresponds to a long short-term memory layer for extracting its effective key information. The structure of each long short-term memory layer includes a linear change layer and two layers of long short-term memory neural network layers. The linear change layer extracts initial information from the input data, and then extracts key information at each moment of the time series data through two layers of short-term memory neural network layers. The long short-term memory network is a special RNN that can learn long-term dependent information.

[0060] In some embodiments, before inputting the training samples into the initial carbon emission prediction model, the method further includes: performing data preprocessing and normalization on the training sample set.

[0061] Data preprocessing includes cleaning the data in the training sample set and classifying and encoding the data in the training sample set according to influencing factors.

[0062] Specifically, data preprocessing includes cleaning the data of the training sample set, which may include: identifying and processing missing values ​​in the data, which can be processed by interpolation (such as mean filling or forward filling), or finding and screening out outliers.

[0063] In some embodiments, the associated information corresponding to each influencing factor is integrated and input into the linear layer, and the carbon emission prediction result is output. The calculation formula is:

[0064] y cb =w ln ·(∑ i r i )+b ln ;

[0065] Among them, y cb represents the carbon emission prediction result, r i Indicates the associated information corresponding to each influencing factor, i represents the influencing factor number, w ln and b ln Represents the parameters of the linear layer.

[0066] In some embodiments, integrating the associated information corresponding to each influencing factor also includes: introducing learnable weights, assigning corresponding weights to each influencing factor to adjust the contribution of each influencing factor to the carbon emission prediction result.

[0067] In some embodiments, the algorithm for minimizing the loss to update the model parameters adopts a mini-batch stochastic gradient descent algorithm or an adaptive learning rate algorithm.

[0068] The mini-batch stochastic gradient descent algorithm is an optimization algorithm that combines the stochastic gradient descent and batch gradient descent algorithms. The mini-batch method has lower memory requirements than the batch method and is suitable for large-scale data sets.

[0069] The adaptive learning rate algorithm can automatically adjust the learning rate of each parameter according to the progress of model training. Compared with the traditional fixed learning rate method, the adaptive learning rate method can flexibly handle the learning rates of different features, thereby accelerating convergence and improving model performance.

[0070] Accordingly, another aspect of this embodiment provides a carbon emission prediction method based on LSTM and self-attention, the method comprising:

[0071] Obtain carbon emission data, input the carbon emission data into a trained carbon emission prediction model obtained by any of the above-mentioned training methods for the carbon emission prediction model based on LSTM and self-attention, and output the carbon emission prediction result.

[0072] Another embodiment of the present invention provides a carbon emission prediction model based on LSTM (Long Short-Term Memory Network) and self-attention mechanism, the framework of which is as follows: Figure 2 As shown in Figure 1, the model mainly includes LSTM layer and self-attention layer. The input data of each factor is extracted through the LSTM layer to extract the key information in the time series data, and then the attention mechanism is used to obtain the correlation between the factors, and finally the information is integrated to predict regional carbon emissions.

[0073] The specific training process includes the following steps:

[0074] The first step is to collect the historical data of carbon emissions, energy structure data, population data, and economic data of the region as the input of the model. Carbon emission data includes the carbon emissions of the region over the years and their years. Energy structure data includes the energy consumption of the region over the years, such as coal, fuel oil, natural gas, and electricity. Population data covers the population changes in the region over the years, such as resident population, urban population, and rural population. Economic data shows the economic development of the region over the years, including the growth value of various industries such as agriculture, industry, and construction, as well as the level of residents' consumption. Assume that the input of the model is {x1, x2, x3, x4}, which respectively represent the historical information of carbon emissions, energy structure information, population information, and economic growth information.

[0075] In the second step, the input data of various factors affecting carbon emissions are extracted through the LSTM layer to obtain the representation information of each time series, and the long-term information contained in the input data itself is obtained. That is, the input data is initially extracted to obtain the effective key information {a1, a2, a3, a4} containing various influencing factors. The calculation formula is as follows:

[0076]

[0077] where w ls ,b ls Represents the model parameters of the LSTM layer.

[0078] In the third step, the vector output by the LSTM layer is used as input to the self-attention layer to calculate the association and influence between various factors, extract the association information between various factors, and obtain the association information between various inputs {r1, r2, r3, r4}. Among them, r1 represents the association information between input a1 and other inputs (a2, a3, a4).

[0079] The fourth step is to integrate the extracted correlation information and output the final carbon emission prediction result y through the linear layer cb , the calculation formula is as follows:

[0080] y cb =w ln ·(∑ i r i )+b ln ,

[0081] where w ln ,b ln is the linear layer model parameter. From this we can get the loss as

[0082]

[0083] Where y is the true label predicted by the data, and B is the batch data size used for each model update.

[0084] The following further explains the mechanism of the LSTM layer. The structural framework of each LSTM layer is as follows Figure 3 The LSTM layer used in this embodiment includes a linear change layer Dense and two LSTM neural network layers. The input data is extracted from the input data through the Dense layer, and then the data output is obtained through the LSTM neural network, which includes the key information of each moment of the time series data.

[0085] Long Short-Term Memory (LSTM) is a special type of RNN (recurrent neural network) that can solve the problem of gradient disappearance and easily learn long-term dependent information. Figure 4 This is a schematic diagram of the LSTM neuron structure, where the input is defined as {m0,m1,…,m t ,m t+1}, where m t is the data at time t. t-1 Get long-term information through LSTM neurons t-1 and short-term information h t-1 , and the data m at the next moment t It passes through the LSTM neuron again as input.

[0086] The first step of LSTM is to decide to discard some previous information from the long-term information. This is achieved by a sigmoid (activation function) network layer called the forget gate, whose input is h t-1 and m t , the output is f t , f t For long-term information t-1 Each value in the vector is output as a number between 0 and 1, where 0 means completely removing the value and 1 means keeping the value. t The calculation formula is as follows:

[0087] f t =σ(W f ·[h t-1 ,m t ]+b f ),

[0088] Where σ represents the sigmoid function, W f ,b f Represents training parameters.

[0089] The next step is to determine what new information to store in the long-term information. This is divided into two parts. First, the tanh (hyperbolic tangent function) network layer creates a vector s that can be added to the long-term information. The calculation formula for vector s is as follows:

[0090] s t =tanh(W s ·[h t-1 ,m t ]+b s ),

[0091] Where W s ,b s represents the training parameters. Then the sigmoid network layer outputs p for each value in t , is a set of vectors between 0 and 1, which determines which state values ​​to update and the degree of update. t The calculation formula is as follows:

[0092] p t =σ(W p ·[h t-1 ,m t ]+b p ),

[0093] Where W p ,b p Represents training parameters.

[0094] Once we know the information to be forgotten and the new information to be updated, we can combine the two to create an updated value of the long-term information, dt The calculation formula is as follows:

[0095] d t =f t *d t +p t *s t ,

[0096] The input short-term information will be updated by combining the long-term information of the previous moment, the short-term information and the input of the current moment. t and the short-term information h of the previous moment t-1 Get o through the sigmoid layer t , the calculation formula is as follows:

[0097] o t =σ(W o ·[h t-1 ,m t ]+b o ),

[0098] Where W o ,b o represents the training parameters. Then d t Through the tanh function and t Multiply them to get the updated h t , the calculation formula is as follows:

[0099] h t =o t *tanh(d t ),

[0100] The final h t Contains key information of input data at each moment.

[0101] The following is a further explanation of the mechanism of the self-attention layer. The architecture of the self-attention layer is as follows: Figure 5 As shown. Carbon emissions in a region are affected by different factors, including historical carbon emission trends, population, economic growth, and energy structure. There are inherent connections between various factors, which not only affect the carbon emissions of the region, but also affect each other. In order to better pay attention to the interconnections between these factors, the present invention uses a self-attention mechanism to obtain this information.

[0102] Assume that the input is {a1, a2, a3, a4}, {a1, a2, a3, a4} is the effective key information of each influencing factor output by the LSTM layer. The function of the self-attention layer is to obtain the internal connection between each input. First, each input a1, a2, a3, a4 will be multiplied by three matrices, namely w q ,w k ,wv , we get three vectors q, k, v. The matrix is ​​shared for each input. The calculation formula of q, k, v is as follows:

[0103] q i =w q a i ,

[0104] k i =w k a i ,

[0105] v i =w v a i ,

[0106] The meaning of q is generally used to indicate matching with other inputs and calculating the association or relationship between the current element and other elements. The meaning of k is used to match with q, and can also be understood as the key information of the association between the element and other elements. v represents the valuable information contained in the element itself, which can also be understood as an important feature.

[0107] Next, calculate the association information between each element. For example, if you need to calculate the association between a1 and a2, a3, and a4, you need to use q1 and k2, k3, and k4 for matching calculations. The calculation formula is as follows:

[0108]

[0109] where w 1,i Indicates a1 and a i , d represents the matrix dimension of q and k, and σ is the activation function.

[0110] Then according to the obtained w 1,1 ,w 1,2 ,w 1,3 ,w 1,4 As the weight, it is multiplied by v1, v2, v3, and v4 respectively to obtain the association information r1 between a1 and a2, a3, and a4. The calculation formula is as follows:

[0111] r1=∑ i w 1,i v i ,

[0112] The corresponding r2, r3, and r4 can all be obtained through similar calculations.

[0113] The training process of this model is as follows Figure 6 As shown, the steps include:

[0114] 1. Collect historical data of various influencing factors.

[0115] 2. Preprocess and normalize the data.

[0116] 3. Start training: Input data into the model for training. Obtain long-term information and nonlinear relationships of the data through the LSTM layer. Obtain the correlation information between each vector through the self-attention layer. Integrate the data containing historical information and correlation information, and output the prediction results through the linear layer. Calculate the loss and update the model parameters through mini-batch stochastic gradient descent. When the number of model training rounds reaches the specified number, end the model training and obtain the trained model.

[0117] In summary, the prediction model training method proposed in the present invention is: obtain a training sample set, and input the training sample into the initial carbon emission prediction model. The model includes a long short-term memory layer, a self-attention layer, and a linear layer. The long short-term memory layer is used to extract and output the effective key information corresponding to each influencing factor, and the effective key information corresponding to each influencing factor is input into the self-attention layer, and the association information between each influencing factor and other influencing factors other than itself is output. The association information corresponding to each influencing factor is integrated and input into the linear layer, and the carbon emission prediction result is output. A loss function is constructed based on the gap between the prediction result and the true label, and the loss is minimized to update the model parameters until the preset number of training rounds is reached to obtain the trained carbon emission prediction model. The present invention uses LSTM to model regional carbon emission prediction, effectively captures and memorizes the long-term dependencies in the time series and the complex nonlinear information in the time series, extracts the effective historical information of each influencing factor, extracts the connection between the factors through the self-attention mechanism, and comprehensively considers these related factors, thereby realizing accurate modeling of the carbon emission prediction task and obtaining accurate prediction results.

[0118] Corresponding to the above method, the present invention also provides an apparatus / system, which includes a computer device, the computer device includes a processor and a memory, the memory stores computer instructions, the processor is used to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the apparatus / system implements the steps of the method described above.

[0119] The embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned edge computing server deployment method are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.

[0120] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.

[0121] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.

[0122] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.

[0123] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A training method for a carbon emission prediction model based on LSTM and self-attention, characterized in that: The method comprises the following steps: Acquire a training sample set, wherein a set of training samples in the training sample set includes multiple influencing factor data; input the training samples into an initial carbon emission prediction model; the initial carbon emission prediction model includes a long short-term memory layer, a self-attention layer, and a linear layer; The initial carbon emission prediction model uses the long short-term memory layer to extract and output effective key information corresponding to each influencing factor; Input the effective key information corresponding to each influencing factor into the self-attention layer, and output the correlation information between each influencing factor and other influencing factors other than itself; Integrate the correlation information corresponding to each influencing factor and input it into the linear layer, and output the carbon emission prediction result; A loss function is constructed based on the gap between the carbon emission prediction result and the true label, and the loss is minimized to update the model parameters until the number of training rounds reaches a preset number of training rounds, thereby obtaining a trained carbon emission prediction model.

2. The training method of the carbon emission prediction model based on LSTM and self-attention according to claim 1 is characterized in that: The multiple influencing factor data include historical carbon emission data, energy structure data, population data and economic data in a preset area; The carbon emission historical data includes the carbon emissions in the preset area over the years and the corresponding years; the energy structure data includes the consumption of various energy sources in the preset area over the years; the population data includes the population number in the preset area over the years and the corresponding numbers of various population classifications; the economic data includes the growth value of various industries in the preset area and the residents' consumption level data.

3. The training method of the carbon emission prediction model based on LSTM and self-attention according to claim 1 is characterized in that: The initial carbon emission prediction model uses the long short-term memory layer to extract the effective key information corresponding to each influencing factor data, and the calculation formula is: Among them, a i Indicates the effective key information corresponding to each influencing factor data, x i represents the influencing factor data, i represents the influencing factor number, σ represents the activation function, and w ls and b ls Represents the parameters of the long short-term memory layer.

4. The training method of the carbon emission prediction model based on LSTM and self-attention according to claim 1 is characterized in that: Before inputting the training samples into the initial carbon emission prediction model, the method further includes: performing data preprocessing and normalization on the training sample set; The data preprocessing includes cleaning the data in the training sample set, and classifying and encoding the data in the training sample set according to influencing factors.

5. The training method of the carbon emission prediction model based on LSTM and self-attention according to claim 1 is characterized in that: The correlation information corresponding to each influencing factor is integrated and input into the linear layer, and the carbon emission prediction result is output. The calculation formula is: y cb =w ln ·(∑ i r i )+b ln ; Among them, y cb represents the carbon emission prediction result, r i Indicates the associated information corresponding to each influencing factor, i represents the influencing factor number, w ln and b ln represents the parameters of the linear layer.

6. The training method of the carbon emission prediction model based on LSTM and self-attention according to claim 1 is characterized in that: Integrating the associated information corresponding to each influencing factor also includes: introducing learnable weights, assigning corresponding weights to each influencing factor, so as to adjust the contribution of each influencing factor to the carbon emission prediction result.

7. The training method of the carbon emission prediction model based on LSTM and self-attention according to claim 1 is characterized in that: The algorithm for minimizing the loss to update the model parameters adopts a mini-batch stochastic gradient descent algorithm or an adaptive learning rate algorithm.

8. A carbon emission prediction method based on LSTM and self-attention, characterized in that: The method includes: Acquire carbon emission data, input the carbon emission data into a trained carbon emission prediction model obtained by the training method of the carbon emission prediction model based on LSTM and self-attention as described in any one of claims 1 to 7, and output the carbon emission prediction result.

9. A carbon emission prediction system based on LSTM and self-attention, comprising a processor, a memory, and a computer program stored in the memory, characterized in that: The processor is used to execute the computer program. When the computer program is executed, the system implements the steps of the method according to any one of claims 1 to 8.

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 8 are implemented.

Citation Information

Patent Citations

  • Carbon emission prediction method and device, electronic equipment and storage medium

    CN114662780A

  • Intelligent wind power prediction method based on Transform and LSTM hybrid model

    CN114841419A

  • A deep learning-based carbon emission prediction method

    CN114936681A

  • Carbon emission factor prediction method and device of power system and electronic equipment

    CN117408394A

  • Carbon emission prediction method and system based on improved long short-term memory network

    CN117540862A

Cited By

  • Regional short-term carbon emission prediction method and related equipment

    CN119783988A