Carbon emission transaction cost data prediction method and system
By pre-processing the historical data with LOF algorithm, screening of the feature of random forest algorithm, extracting empirical modal decomposition signal and extracting long-term dependency relationships of long-term and short-term memory networks, the accurate calculation of carbon emission trading prices is achieved, and the problem of low calculation accuracy in the existing technology is solved.
Patent Information
- Application Number
- CN202411987117.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology is difficult to accurately calculate the trading price of carbon emissions, mainly due to the high complexity of data processing and the difficulty of model training, resulting in low prediction accuracy.
By collecting historical data, pre-processing is performed using the LOF algorithm, the random forest algorithm calculates the importance of feature, empirical modal decomposition extracts signal characteristics, long-term and short-term memory networks extract long-term dependencies, and finally calculates the carbon emission trading price based on these relationships.
It reduces the complexity of data processing, improves the accuracy of carbon emission trading price calculation, and solves the problem of low prediction accuracy in the existing technology.
Smart Images

Figure CN119809824A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power measurement and calculation, and in particular to a method and system for predicting carbon emission transaction cost data. Background Art
[0002] The carbon emission trading market has played an important policy role in achieving the carbon peak and carbon neutrality goals. With the continuous development of the national carbon emission trading market, carbon prices, as the core trading indicator, are of great significance for guiding the optimal allocation of carbon emission reduction resources and promoting green and low-carbon development. Carbon trading prices are affected by many complex factors, which are characterized by uncertainty, nonlinearity, non-stationarity, and irregularity, which makes the calculation of carbon prices face huge challenges.
[0003] The current carbon emission trading price calculation technology is mainly divided into two categories: one is based on traditional statistical methods, and the other is based on machine learning technology. Traditional statistical methods include technical analysis, multivariate regression analysis, autoregressive moving average model and gray theory, etc., which often lead to unsatisfactory prediction results because carbon prices are affected by multiple factors and the mechanism of action is complex. Machine learning methods, such as support vector machines (SVM) and artificial neural networks (ANN) and their combined models, although they perform well in processing complex data, also face problems such as difficulty in model training and insufficient generalization ability, resulting in low accuracy in carbon trading price calculation, little guiding significance in practical applications, and difficult to promote. Summary of the invention
[0004] The present invention provides a method and system for predicting carbon emission trading cost data, which can solve the technical problem that it is difficult to accurately calculate the carbon emission trading price in the prior art. By analyzing the characteristic values, the complexity of data processing is reduced and the accuracy of calculation is further improved.
[0005] In order to solve the above technical problems, an embodiment of the present invention provides a method for predicting carbon emission transaction cost data, comprising:
[0006] Collect historical data, and use the LOF algorithm to preprocess the historical data to obtain preprocessed data; the historical data includes carbon emission trading price data and historical fossil fuel price data;
[0007] Calculating the characteristic values of the preprocessed data, obtaining the importance of each characteristic value of the preprocessed data by a random forest algorithm, screening the preprocessed data according to the importance of the characteristic values, and obtaining a first carbon emission trading price sequence;
[0008] Performing empirical mode decomposition on the first carbon emission trading price sequence to obtain a second carbon emission trading price sequence;
[0009] Extracting the long-term dependency of the second carbon emission trading price series through a long short-term memory network;
[0010] The carbon emission trading price after a preset time is calculated based on the long-term dependency relationship and the historical carbon emission trading price data.
[0011] As an improvement of the above solution, the historical data is collected and the historical data is preprocessed using the LOF algorithm to obtain preprocessed data, including:
[0012] Collect historical carbon emission trading price data and historical fossil fuel price data, and obtain several historical data points according to the preset time steps;
[0013] Calculating the Euclidean distance between the historical data points and assigning LOF local outlier factors to the historical data points;
[0014] According to the LOF local outlier factor, outliers are removed from the historical data points to obtain preprocessed data.
[0015] As an improvement of the above solution, the calculating of the Euclidean distance between the historical data points and the allocation of LOF local outlier factors to the historical data points include:
[0016] Selecting a first historical data point and a second historical data point from the historical data points;
[0017] Taking a set of data points between the first historical data point and the second historical data point as a neighborhood of the first historical data point;
[0018] Calculate the Euclidean distances from all points in the neighborhood of the first historical data point to the first historical data point to obtain the local reachable density of the first historical data point;
[0019] According to the local reachable density, the local relative density of the first historical data point is calculated and assigned to the first historical data point as the LOF local outlier factor, until all historical data points are assigned with the LOF local outlier factor.
[0020] As an improvement of the above solution, the calculating of the characteristic values of the preprocessed data, obtaining the importance of each characteristic value of the preprocessed data by a random forest algorithm, screening the preprocessed data according to the importance of the characteristic values, and obtaining the first carbon emission trading price sequence includes:
[0021] Using Bootstrap algorithm to extract samples from the preprocessed data to obtain preprocessed samples and out-of-bag data;
[0022] Calculating eigenvalues of the preprocessed samples and the out-of-bag data;
[0023] Creating an initial decision tree by using a random forest algorithm, training the initial decision tree using the feature values of the preprocessed samples, and calculating the first classification accuracy of the out-of-bag data by using the trained initial decision tree;
[0024] Randomly perturb the eigenvalues of the out-of-bag data, and calculate the second classification accuracy of the out-of-bag data after the perturbation;
[0025] Calculating the importance of the feature value according to the first classification accuracy and the second classification accuracy;
[0026] The preprocessed data is filtered according to the importance of the characteristic value to obtain a first carbon emission trading price sequence.
[0027] As an improvement of the above solution, performing empirical mode decomposition on the first carbon emission trading price sequence to obtain the second carbon emission trading price sequence includes:
[0028] Obtaining an initial signal according to the first carbon emission trading price sequence;
[0029] Initializing the initial signal using empirical mode decomposition to obtain an iterative signal;
[0030] Calculating a mean envelope of the iterative signal according to an upper envelope and a lower envelope of the iterative signal;
[0031] According to the mean envelope, the iterative signal is updated until the updated iterative signal satisfies a preset iterative stop condition, thereby obtaining a component signal and a residual signal; the iterative stop condition includes a threshold condition and a zero-pole condition;
[0032] The first carbon emission trading price sequence is expressed as the sum of the component signal and the residual signal to obtain a second carbon emission trading price sequence.
[0033] As an improvement of the above scheme, the iterative signal is updated according to the mean envelope until the updated iterative signal satisfies a preset iteration stop condition to obtain a component signal and a residual signal; the iteration stop condition includes a threshold condition and a zero-pole condition, including:
[0034] By h k+1 [n] = h k [n]-m k [n] Update the iterative signal; wherein k is the number of iterations, k = 0, 1, 2, ...; h k [n] is the iteration signal of the kth iteration; m k [n] is the mean envelope at the kth iteration;
[0035] Perform signal decomposition and extraction based on the updated iterative signal to obtain an intermediate component signal;
[0036] When the intermediate component signal does not meet the preset iterative stop condition, update the initial signal according to the intermediate component signal;
[0037] When the intermediate component signal meets the preset iterative stop condition, stop the update of the iterative signal, and obtain the residual signal of the component signal according to the number of extreme points of the intermediate component signal.
[0038] As an improvement to the above solution, the preset iterative stop conditions include a first iterative stop condition, a second iterative stop condition, and a third iterative stop condition; where:
[0039] The first iterative stop condition is that the number of zeros and extreme points of the signal is the same;
[0040] The first iterative stop condition is that the difference between the zeros and extreme points of the signal is less than a preset difference threshold;
[0041] The third iterative stop condition is f(k - 2) < f(k - 1), f(k - 1) < f(k); where f(k) is the root mean square of the signal at the k-th iteration.
[0042] As an improvement to the above solution, the extraction of the long-term dependence relationship of the second carbon emission trading price sequence by the long short-term memory network includes:
[0043] Construct a long short-term memory network; the long short-term memory network includes a forgetting gate unit, an input gate unit, a cell state update unit, and an output gate unit for processing the cell state in the long short-term memory network;
[0044] Input the second carbon emission trading price sequence into the long short-term memory network, and calculate the first parameter of the forgetting gate unit, the second parameter of the input gate unit, and the third parameter of the output gate unit based on the Sigmoid function;
[0045] Select candidate cells from the cells of the long short-term memory network based on the tanh function;
[0046] Update the state of the candidate cells through the cell state update unit according to the first parameter and the second parameter to obtain the updated cell state;
[0047] Calculate the hidden state at the current time step through the third parameter and the updated cell state to obtain the long-term dependence relationship of the second carbon emission trading price sequence.
[0048] As an improvement of the above solution, the carbon emission trading price after a preset time is calculated based on the long-term dependency relationship and the historical carbon emission trading price data, including:
[0049] Adding a position code to the historical carbon emission trading price data to obtain a position tag;
[0050] According to the long-term dependency, a multi-head self-attention mechanism is used to perform attention training on the features of the historical carbon emission trading price data to obtain an attention score for each feature;
[0051] According to the attention score of each feature, the carbon emission trading price after a preset time is calculated.
[0052] The embodiment of the present invention further provides a carbon emission transaction cost data prediction system, including:
[0053] A data preprocessing module is used to collect historical data and preprocess the historical data using the LOF algorithm to obtain preprocessed data; the historical data includes carbon emission trading price data and historical fossil fuel price data;
[0054] A feature importance calculation module, used to calculate the feature values of the preprocessed data, obtain the importance of each feature value of the preprocessed data by a random forest algorithm, and filter the preprocessed data according to the importance of the feature values to obtain a first carbon emission trading price sequence;
[0055] An empirical mode decomposition module, used to perform empirical mode decomposition on the first carbon emission trading price sequence to obtain a second carbon emission trading price sequence;
[0056] A long-term dependency extraction module, used to extract the long-term dependency of the second carbon emission trading price sequence through a long short-term memory network;
[0057] The price calculation module is used to calculate the carbon emission trading price after a preset time based on the long-term dependency relationship and the historical carbon emission trading price data.
[0058] Compared with the prior art, the present invention discloses a method and system for predicting carbon emission trading cost data, which collects historical data and uses the LOF algorithm to preprocess the historical data to obtain preprocessed data; the historical data includes carbon emission trading price data and historical fossil fuel price data; the characteristic values of the preprocessed data are calculated, and the importance of each characteristic value of the preprocessed data is obtained by the random forest algorithm, and the preprocessed data is screened according to the importance of the characteristic values to obtain a first carbon emission trading price sequence; the first carbon emission trading price sequence is subjected to empirical mode decomposition to obtain a second carbon emission trading price sequence; the long-term dependency of the second carbon emission trading price sequence is extracted by the long short-term memory network; and the carbon emission trading price after a preset time is calculated based on the long-term dependency and the historical carbon emission trading price data. The embodiment of the present invention can reduce the complexity of data processing and further improve the accuracy of calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 It is a schematic diagram of the steps of a method for predicting carbon emission transaction cost data provided by an embodiment of the present invention;
[0060] Figure 2 It is a structural diagram of a carbon emission transaction cost data prediction system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0061] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0062] In the description of the specification and claims, it is to be understood that the terms first, second, etc. in the specification and claims are only used for the purpose of describing the same technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated, nor necessarily describing the order or time sequence. The terms are interchangeable where appropriate. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features.
[0063] The embodiment of the present invention provides a method for predicting carbon emission transaction cost data. Figure 1 In this embodiment, the carbon emission transaction cost data prediction method is specifically performed through steps S1 to S5:
[0064] S1. Collect historical data, and use the LOF algorithm to preprocess the historical data to obtain preprocessed data; the historical data includes carbon emission trading price data and historical fossil fuel price data.
[0065] It should be noted that the historical carbon emission trading price data refers to the price data of carbon emission rights in the carbon emission rights trading market. The change of this data reflects the market's assessment of the monetary value of the right to reduce one ton of carbon dioxide or equivalent greenhouse gas emissions. By analyzing the historical carbon emission trading price data and sorting out the historical fossil fuel price data, it can help to accurately analyze the influencing factors of the historical carbon emission trading price data. The LOF algorithm can determine anomalies based on data density. In the embodiment of the present invention, the LOF algorithm is used to screen the outliers of the historical data.
[0066] S2. Calculate the characteristic values of the preprocessed data, obtain the importance of each characteristic value of the preprocessed data through a random forest algorithm, filter the preprocessed data according to the importance of the characteristic values, and obtain a first carbon emission trading price sequence.
[0067] It should be noted that, in the embodiment of the present invention, the importance of each feature value is evaluated by a random forest model composed of multiple decision trees, and then redundant features are eliminated in a large-scale high-dimensional data set to complete feature screening.
[0068] S3. Perform empirical mode decomposition on the first carbon emission trading price sequence to obtain a second carbon emission trading price sequence.
[0069] By performing empirical mode decomposition on the first carbon emission trading price sequence, the first carbon emission trading price sequence can be decomposed into several signals to reconstruct the original signal and mine the original characteristics of the first carbon emission trading price sequence. This can adapt to the characteristics of various complex signals and effectively avoid the influence of noise interference and outliers.
[0070] S4. Extracting the long-term dependency of the second carbon emission trading price sequence through a long short-term memory network.
[0071] In sequence data, the dependencies between some elements may span longer time steps or positions. Long short-term memory network is a recurrent neural network variant widely used in time series data modeling. It solves the problems of gradient vanishing and gradient exploding in traditional recurrent neural networks and can better capture long-term dependencies in sequence data.
[0072] S5. Calculate the carbon emission trading price after a preset time based on the long-term dependency relationship and the historical carbon emission trading price data.
[0073] In the above scheme, the LOF algorithm and the random forest algorithm are used to screen historical data from the two aspects of data anomaly and feature importance respectively, which can not only reduce the amount of data, but also further extract the key influencing factors and changes in influencing results; the first carbon emission trading price sequence can be decomposed and reconstructed through empirical mode decomposition to deeply explore the original characteristics of the signal; by extracting the long-term dependency of the reconstructed signal and then calculating the carbon emission trading price, the long-term dependency problem of the sequence can be solved and the accurate calculation of the carbon emission trading price can be achieved.
[0074] As a preferred implementation, step S1, collecting historical data, and preprocessing the historical data using the LOF algorithm to obtain preprocessed data, includes:
[0075] Collect historical carbon emission trading price data and historical fossil fuel price data, and obtain several historical data points according to the preset time steps;
[0076] Calculating the Euclidean distance between the historical data points and assigning LOF local outlier factors to the historical data points;
[0077] According to the LOF local outlier factor, outliers are removed from the historical data points to obtain preprocessed data.
[0078] In the embodiment of the present invention, outliers are determined based on density, and a LOF local outlier factor that depends on the neighborhood density is assigned to each data point to determine whether the data point is an outlier, wherein the distance is calculated using the Euclidean distance.
[0079] Further, as a preferred implementation, the calculating of the Euclidean distance between the historical data points and the allocation of the LOF local outlier factor to the historical data points are performed through steps S11-S14:
[0080] S11, selecting a first historical data point and a second historical data point from the historical data points;
[0081] S12, taking a set of data points between the first historical data point and the second historical data point as a neighborhood of the first historical data point;
[0082] S13, calculating the Euclidean distances from all points in the neighborhood of the first historical data point to the first historical data point, and obtaining the local reachable density of the first historical data point;
[0083] S14. Calculate the local relative density of the first historical data point according to the local reachable density, and assign it to the first historical data point as a LOF local outlier factor, until all historical data points are assigned a LOF local outlier factor.
[0084] In some preferred embodiments, step S13 includes:
[0085] pass Calculating the local reachable density of the first historical data point;
[0086] Among them, N k (p) is the number of data points in the neighborhood of the first historical data point p; o is a data point in the neighborhood, and there are k data points between the first historical data point p and the data point o; R k (o,p) is the kth reachable distance between the first historical data point p and data point o, R k (o,p)=max{d k (o),d(p,o)}; d(p,o) is the Euclidean distance between the first historical data point p and the data point o, d k (o) is the kth reachable distance from data point o to the first historical data point.
[0087] It should be noted that, assuming that the distance between two points p and o is d(p,o), k is the number of adjacent points; d k (p) represents the kth distance of the first data point p, d k (p)=d(p,o), indicating that data point o is the k-th farthest point from the first data point p.
[0088] In some preferred embodiments, step S14 includes:
[0089] pass Calculate the local relative density of the first historical data point; where N k (p) is the number of data points in the neighborhood of the first historical data point p; o is the data point in the neighborhood, D k (p) is the LOF local outlier factor of the first historical data point p; D k (o) is the LOF local outlier factor of data o;
[0090] The local relative density is used as a LOF local outlier factor, and the LOF local outlier factor is assigned to the first historical data point until all historical data points are assigned with a LOF local outlier factor.
[0091] It should be noted that, in the embodiment of the present invention, the LOF local outlier factor is represented by the local relative density, which is the average of the ratio of the local reachable density of all sample points in the kth domain of the data point p to the local reachable density of the data point p. When the local relative density is closer to 1, the density of the neighborhood points of the data point p is similar, and the data point p and the neighborhood belong to the same cluster; if the ratio is farther away from 1, the density of p is higher than the density of its neighborhood points, and p is a dense point; if the ratio is greater than 1, it means that the density of p is less than the density of its neighborhood points, and p is more likely to be an outlier.
[0092] As a preferred implementation, step S2, calculating the characteristic value of the preprocessed data, obtaining the importance of each characteristic value of the preprocessed data by a random forest algorithm, screening the preprocessed data according to the importance of the characteristic value, and obtaining a first carbon emission trading price sequence, includes:
[0093] Using Bootstrap algorithm to extract samples from the preprocessed data to obtain preprocessed samples and out-of-bag data;
[0094] Calculating eigenvalues of the preprocessed samples and the out-of-bag data;
[0095] Creating an initial decision tree by using a random forest algorithm, training the initial decision tree using the feature values of the preprocessed samples, and calculating the first classification accuracy of the out-of-bag data by using the trained initial decision tree;
[0096] Randomly perturb the eigenvalues of the out-of-bag data, and calculate the second classification accuracy of the out-of-bag data after the perturbation;
[0097] Calculating the importance of the feature value according to the first classification accuracy and the second classification accuracy;
[0098] The preprocessed data is filtered according to the importance of the characteristic value to obtain a first carbon emission trading price sequence.
[0099] Exemplarily, the Bootstrap algorithm is used to extract samples of the preprocessed data to obtain preprocessed samples k=2, 3, ..., K and out-of-bag (OOB) data, and when each preprocessed sample has N-dimensional feature attributes, the importance of the feature value is calculated through the following steps.
[0100] Set the initial value k = 1 and create a decision tree T k . Train T for the kth Bootstrap preprocessed sample k , and calculate the first classification accuracy of each OOB data Randomly change the feature value X in the OOB data set j, j = 1, 2…, N apply disturbances and calculate the second classification accuracy Repeat the above decision tree training and classification accuracy calculation steps for k = 2, 3, ..., K. Calculate the eigenvalue X j After arranging the importance in descending order, the importance ranking of the eigenvalues can be obtained.
[0101] As a preferred implementation, step S3, performing empirical mode decomposition on the first carbon emission trading price sequence to obtain a second carbon emission trading price sequence, includes:
[0102] Obtaining an initial signal according to the first carbon emission trading price sequence;
[0103] Initializing the initial signal using empirical mode decomposition to obtain an iterative signal;
[0104] Calculating a mean envelope of the iterative signal according to an upper envelope and a lower envelope of the iterative signal;
[0105] According to the mean envelope, the iterative signal is updated until the updated iterative signal satisfies a preset iterative stop condition, thereby obtaining a component signal and a residual signal; the iterative stop condition includes a threshold condition and a zero-pole condition;
[0106] The first carbon emission trading price sequence is expressed as the sum of the component signal and the residual signal to obtain a second carbon emission trading price sequence.
[0107] Preferably, in an embodiment of the present invention, empirical mode decomposition is performed on the first carbon emission trading price sequence by using a robust empirical mode decomposition model.
[0108] The robust empirical mode decomposition model (REMD) can solve the problem that the traditional empirical mode decomposition model may cause differences in the decomposition effects of different data sets due to the use of a preset threshold method when screening and stopping the criterion during the decomposition process. In the embodiment of the present invention, the screening and stopping criterion is defined as f(k), and f(k) is as small as possible. Specifically, by and f(k)=e RMS +E k Get the screening stop judgment condition. Among them, g k [n] is the component obtained after k iterations of the initial signal; N s is the number of decomposed signals obtained by decomposing the initial signal; E k is the weight g k The excess kurtosis of [n]; e RMS is the weight gk The root mean square of [n]; n is the signal length.
[0109] Furthermore, the iterative signal is updated according to the mean envelope until the updated iterative signal satisfies a preset iterative stop condition, thereby obtaining a component signal and a residual signal; the iterative stop condition includes a threshold condition and a zero-pole condition, including:
[0110] By h k+1 [n] = h k [n]-m k [n] Update the iterative signal; wherein k is the number of iterations, k = 0, 1, 2, ...; h k [n] is the iteration signal of the kth iteration; m k [n] is the mean envelope at the kth iteration;
[0111] Perform signal decomposition and extraction according to the updated iterative signal to obtain an intermediate component signal;
[0112] When the intermediate component signal does not meet a preset iteration stop condition, updating the initial signal according to the intermediate component signal;
[0113] When the intermediate component signal meets a preset iteration stop condition, the updating of the iterative signal is stopped, and a residual signal of the component signal is obtained according to the number of extreme value points of the intermediate component signal.
[0114] Exemplarily, the steps of decomposing the first carbon emission trading price sequence x[n] using REMD in an embodiment of the present invention are as follows.
[0115] Assume E j (R IMF ) is the jth R that meets the conditions obtained by empirical mode decomposition IMF Component, k is the number of decomposition realizations, k = 0, 1, 2, ..., I max ; j=1,2,….
[0116] According to the time step of the first carbon emission trading price sequence, h k [n] = G j [n] Import the original data for initialization; by h k [n] Calculate the upper envelope g max [n] and lower envelope g min [n], then through Calculate the mean envelope at the kth iteration. Then use h k+1 [n] = h k [n]-m k[n] Update the iterative signal. Further determine whether the extracted R IMF meets the iterative stop condition. If it does not meet the iterative stop condition, use h k+1 [n] as the new initial signal and repeat the above steps until the first qualified R IMF component is obtained.
[0117] When the maximum number of iterations I max is not reached, R IMF1 = h k-2[n] ; when the maximum number of iterations I max is reached, R IMF1 = h k[n] .
[0118] Then obtain a new initial signal G j[n] (j = 1, 2,...), and determine whether G j[n] is monotonic or constant. If not, repeat the above steps until the initial signal cannot be decomposed, and obtain The characteristics of the signal that cannot be decomposed are that it has at most two extreme points. Define the signal that cannot be decomposed as the residual R RS = G j [n].
[0119] Finally, by decomposing and reconstructing the first carbon emission trading price series, the second carbon emission trading price series
[0120] As a preferred implementation manner, the preset iterative stop conditions include a first iterative stop condition, a second iterative stop condition, and a third iterative stop condition; where:
[0121] The first iterative stop condition is that the number of zeros and extreme points of the signal is the same;
[0122] The second iterative stop condition is that the difference between the zeros and extreme points of the signal is less than a preset difference threshold;
[0123] The third iterative stop condition is f(k - 2) < f(k - 1), f(k - 1) < f(k); where f(k) is the root mean square of the signal at the k-th iteration.
[0124] Exemplarily, in the second iterative stop condition, the preset difference threshold is 1.
[0125] As a preferred implementation manner, step S4, extracting the long-term dependence relationship of the second carbon emission trading price series through a long short-term memory network, includes:
[0126] Constructing a long short-term memory network; the long short-term memory network includes a forget gate unit, an input gate unit, a cell state updating unit and an output gate unit for processing the cell state in the long short-term memory network;
[0127] Inputting the second carbon emission trading price sequence into the long short-term memory network, and calculating the first parameter of the forget gate unit, the second parameter of the input gate unit, and the third parameter of the output gate unit based on the Sigmoid function;
[0128] Selecting candidate cells from the cells of the long short-term memory network based on the tanh function;
[0129] According to the first parameter and the second parameter, the state of the candidate cell is updated by the cell state updating unit to obtain an updated cell state;
[0130] The hidden state of the current time step is calculated by using the third parameter and the updated cell state to obtain the long-term dependency of the second carbon emission trading price sequence.
[0131] For example, by f t =σ(W xf x t +W hf h t-1 +b f ) obtains the first parameter of the forget gate unit, which is used to determine how much information to forget from the cell state; t =σ(W xi x t +W hi h t-1 +b i ) obtains the second parameter of the input gate unit, which is used to determine how much new information to add to the cell state; by g t =tanh(W xg x t +W hg h t-1 +b g ) Select candidate cells, and the updated cell state is c t =f t *c t-1 +i t *g t ; by o t =σ(W xo x t +W ho h t-1 +b o ) to obtain the third parameter of the output gate unit, which is used to determine how much information can be passed to the hidden state given the cell state.xf ,W hf ,W xi ,W hi ,W xg ,W hg ,W xo ,W ho is the weight matrix, b f ,b i ,b g ,b o is the bias vector; σ() is the Sigmoid function; tanh() is the hyperbolic tangent function.
[0132] As a preferred implementation, step S5, calculating the carbon emission trading price after a preset time according to the long-term dependency relationship and the historical carbon emission trading price data, includes:
[0133] Adding a position code to the historical carbon emission trading price data to obtain a position tag;
[0134] According to the long-term dependency, a multi-head self-attention mechanism is used to perform attention training on the features of the historical carbon emission trading price data to obtain an attention score for each feature;
[0135] According to the attention score of each feature, the carbon emission trading price after a preset time is calculated.
[0136] It should be noted that the self-attention mechanism is a key feature of the Transformer model, which enables the model to perform weighted aggregation on various parts of the input sequence. By calculating the attention score between the query, key, and value, the model can determine the importance of each position to other positions.
[0137] Since Transformer has no built-in sequence order information, position encoding is used to add some information to each position in the input sequence so that the model can distinguish between tokens at different positions.
[0138] To capture different types of relationships, the Transformer model uses multiple parallel self-attention mechanisms (heads). Each head learns different weights so that it can capture information in different representation subspaces. The outputs of multiple heads are concatenated and linearly transformed.
[0139] In a preferred specific embodiment, historical data from 2023 to the end of October 2024 is collected for analysis, and mean absolute error (MAE), mean square error (MSE), root mean square error (RMSE), and mean absolute percentile error (MAPE) are selected as evaluation indicators to evaluate the measurement performance. Calculate the mean absolute error; by Calculate the mean square error; by Calculate the root mean square error; by Calculate the mean absolute percentile error; where y i is the true value, is the measured value, i=1,2,…,n, and n is the number of samples.
[0140] The present invention adopts several methods to analyze the historical data, and calculates the carbon emission trading price after a preset time, and compares the calculated value with the actual value to obtain the calculation results shown in Table 1.
[0141] Table 1
[0142]
[0143]
[0144] It can be seen from Table 1 that the carbon emission trading price calculated by the carbon emission trading cost data prediction method described in the present invention has the highest accuracy and is closest to the true value.
[0145] A carbon emission trading cost data prediction method provided by an embodiment of the present invention is adopted. The historical data are screened from the two aspects of data anomaly and feature importance through the LOF algorithm and the random forest algorithm respectively, which can not only reduce the amount of data, but also further extract the key influencing factors and the changes in influencing results; the first carbon emission trading price sequence can be decomposed and reconstructed through empirical mode decomposition to deeply mine the original characteristics of the signal; by extracting the long-term dependency relationship of the reconstructed signal and then calculating the carbon emission trading price, the long-term dependency problem of the sequence can be solved, and the accurate calculation of the carbon emission trading price can be achieved.
[0146] The embodiment of the present invention provides a carbon emission transaction cost data prediction system. Figure 2The carbon emission transaction cost data prediction system includes a data preprocessing module 11, a feature importance calculation module 12, an empirical mode decomposition module 13, a long-term dependency extraction module 14 and a price estimation module 15, wherein:
[0147] The data preprocessing module 11 is used to collect historical data and preprocess the historical data using the LOF algorithm to obtain preprocessed data; the historical data includes carbon emission trading price data and historical fossil fuel price data;
[0148] A feature importance calculation module 12 is used to calculate the feature values of the preprocessed data, obtain the importance of each feature value of the preprocessed data through a random forest algorithm, and filter the preprocessed data according to the importance of the feature values to obtain a first carbon emission trading price sequence;
[0149] An empirical mode decomposition module 13, configured to perform empirical mode decomposition on the first carbon emission trading price sequence to obtain a second carbon emission trading price sequence;
[0150] A long-term dependency extraction module 14, configured to extract the long-term dependency of the second carbon emission trading price sequence through a long short-term memory network;
[0151] The price calculation module 15 is used to calculate the carbon emission trading price after a preset time according to the long-term dependency relationship and the historical carbon emission trading price data.
[0152] As a preferred implementation, the data preprocessing module 11 includes:
[0153] A data point acquisition unit, used to collect historical carbon emission trading price data and historical fossil fuel price data, and obtain a number of historical data points according to a preset time step;
[0154] A Euclidean distance calculation unit, used to calculate the Euclidean distance between the historical data points and assign a LOF local outlier factor to the historical data points;
[0155] The abnormal data screening unit is used to remove abnormal points from the historical data points according to the LOF local outlier factor to obtain pre-processed data.
[0156] Further, as a preferred implementation, the Euclidean distance calculation unit is specifically used for:
[0157] Selecting a first historical data point and a second historical data point from the historical data points;
[0158] Taking a set of data points between the first historical data point and the second historical data point as a neighborhood of the first historical data point;
[0159] Calculate the Euclidean distances from all points in the neighborhood of the first historical data point to the first historical data point to obtain the local reachable density of the first historical data point;
[0160] According to the local reachable density, the local relative density of the first historical data point is calculated and assigned to the first historical data point as the LOF local outlier factor, until all historical data points are assigned with the LOF local outlier factor.
[0161] As a preferred implementation, the feature importance calculation module 12 is specifically used for:
[0162] Using Bootstrap algorithm to extract samples from the preprocessed data to obtain preprocessed samples and out-of-bag data;
[0163] Calculating eigenvalues of the preprocessed samples and the out-of-bag data;
[0164] Creating an initial decision tree by using a random forest algorithm, training the initial decision tree using the feature values of the preprocessed samples, and calculating the first classification accuracy of the out-of-bag data by using the trained initial decision tree;
[0165] Randomly perturb the eigenvalues of the out-of-bag data, and calculate the second classification accuracy of the out-of-bag data after the perturbation;
[0166] Calculating the importance of the feature value according to the first classification accuracy and the second classification accuracy;
[0167] The preprocessed data is filtered according to the importance of the characteristic value to obtain a first carbon emission trading price sequence.
[0168] As a preferred implementation, the empirical mode decomposition module 13 includes:
[0169] An initial signal acquisition unit, configured to obtain an initial signal according to the first carbon emission trading price sequence;
[0170] An initialization unit, used to initialize the initial signal using empirical mode decomposition to obtain an iterative signal;
[0171] A mean envelope calculation unit, used to calculate the mean envelope of the iterative signal according to the upper envelope and the lower envelope of the iterative signal;
[0172] A signal updating unit, configured to update the iterative signal according to the mean envelope until the updated iterative signal satisfies a preset iterative stop condition, thereby obtaining a component signal and a residual signal; the iterative stop condition includes a threshold condition and a zero-pole condition;
[0173] A sequence reconstruction unit, configured to represent the first carbon emission trading price sequence as the sum of the component signal and the residual signal, so as to obtain a second carbon emission trading price sequence.
[0174] Further, preferably, the signal update unit is specifically configured to:
[0175] Update the iterative signal through h k+1 [n]=h k [n]-m k [n]; where k is the number of iterations, k = 0, 1, 2...; h k [n] is the iterative signal of the k-th iteration; m k [n] is the mean envelope at the k-th iteration;
[0176] Perform signal decomposition and extraction according to the updated iterative signal to obtain an intermediate component signal;
[0177] When the intermediate component signal does not meet the preset iteration stop condition, update the initial signal according to the intermediate component signal;
[0178] When the intermediate component signal meets the preset iteration stop condition, stop updating the iterative signal, and obtain the residual signal of the component signal according to the number of extreme points of the intermediate component signal.
[0179] Furthermore, preferably, the preset iteration stop condition includes a first iteration stop condition, a second iteration stop condition, and a third iteration stop condition; where:
[0180] The first iteration stop condition is that the number of zeros and extreme points of the signal is the same;
[0181] The first iteration stop condition is that the difference between the zero and the extreme point of the signal is less than a preset difference threshold;
[0182] The third iteration stop condition is f(k - 2)<f(k - 1), f(k - 1)<f(k); where f(k) is the root mean square of the signal at the k-th iteration.
[0183] As a preferred implementation manner, the long-term dependence extraction module 14 is specifically configured to:
[0184] Construct a long short-term memory network; the long short-term memory network includes a forgetting gate unit, an input gate unit, a cell state update unit, and an output gate unit for processing the cell state in the long short-term memory network;
[0185] Inputting the second carbon emission trading price sequence into the long short-term memory network, and calculating the first parameter of the forget gate unit, the second parameter of the input gate unit, and the third parameter of the output gate unit based on the Sigmoid function;
[0186] Selecting candidate cells from the cells of the long short-term memory network based on the tanh function;
[0187] According to the first parameter and the second parameter, the state of the candidate cell is updated by the cell state updating unit to obtain an updated cell state;
[0188] The hidden state of the current time step is calculated by using the third parameter and the updated cell state to obtain the long-term dependency of the second carbon emission trading price sequence.
[0189] As a preferred implementation, the price calculation module 15 is specifically used for:
[0190] Adding a position code to the historical carbon emission trading price data to obtain a position tag;
[0191] According to the long-term dependency, a multi-head self-attention mechanism is used to perform attention training on the features of the historical carbon emission trading price data to obtain an attention score for each feature;
[0192] According to the attention score of each feature, the carbon emission trading price after a preset time is calculated.
[0193] A carbon emission trading cost data prediction system provided by an embodiment of the present invention is used to filter historical data from two aspects, namely, data anomaly and feature importance, through LOF algorithm and random forest algorithm, which can not only reduce the amount of data, but also further extract key influencing factors and changes in influencing results; the first carbon emission trading price sequence can be decomposed and reconstructed through empirical mode decomposition to deeply mine the original characteristics of the signal; by extracting the long-term dependency of the reconstructed signal and then calculating the carbon emission trading price, the long-term dependency problem of the sequence can be solved, and accurate calculation of the carbon emission trading price can be achieved.
[0194] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0195] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for predicting carbon emission transaction cost data, characterized in that: include: Collect historical data, and use the LOF algorithm to preprocess the historical data to obtain preprocessed data; the historical data includes carbon emission trading price data and historical fossil fuel price data; Calculating the characteristic values of the preprocessed data, obtaining the importance of each characteristic value of the preprocessed data by a random forest algorithm, screening the preprocessed data according to the importance of the characteristic values, and obtaining a first carbon emission trading price sequence; Performing empirical mode decomposition on the first carbon emission trading price sequence to obtain a second carbon emission trading price sequence; Extracting the long-term dependency of the second carbon emission trading price series through a long short-term memory network; The carbon emission trading price after a preset time is calculated based on the long-term dependency relationship and the historical carbon emission trading price data.
2. A carbon emission transaction cost data prediction method as claimed in claim 1, characterized in that: The collecting of historical data and preprocessing the historical data using the LOF algorithm to obtain preprocessed data include: Collect historical carbon emission trading price data and historical fossil fuel price data, and obtain several historical data points according to the preset time steps; Calculating the Euclidean distance between the historical data points and assigning LOF local outlier factors to the historical data points; According to the LOF local outlier factor, outliers are removed from the historical data points to obtain preprocessed data.
3. A method for predicting carbon emission transaction cost data according to claim 2, characterized in that: The calculating the Euclidean distance between the historical data points and assigning the LOF local outlier factor to the historical data points includes: Selecting a first historical data point and a second historical data point from the historical data points; Taking a set of data points between the first historical data point and the second historical data point as a neighborhood of the first historical data point; Calculate the Euclidean distances from all points in the neighborhood of the first historical data point to the first historical data point to obtain the local reachable density of the first historical data point; According to the local reachable density, the local relative density of the first historical data point is calculated and assigned to the first historical data point as the LOF local outlier factor, until all historical data points are assigned with the LOF local outlier factor.
4. A method for predicting carbon emission transaction cost data according to claim 1, characterized in that: The calculating the characteristic value of the pre-processed data, obtaining the importance of each characteristic value of the pre-processed data by a random forest algorithm, screening the pre-processed data according to the importance of the characteristic value, and obtaining a first carbon emission trading price sequence includes: Using Bootstrap algorithm to extract samples from the preprocessed data to obtain preprocessed samples and out-of-bag data; Calculating eigenvalues of the preprocessed samples and the out-of-bag data; Creating an initial decision tree by using a random forest algorithm, training the initial decision tree using the feature values of the preprocessed samples, and calculating the first classification accuracy of the out-of-bag data by using the trained initial decision tree; Randomly perturb the eigenvalues of the out-of-bag data, and calculate the second classification accuracy of the out-of-bag data after the perturbation; Calculating the importance of the feature value according to the first classification accuracy and the second classification accuracy; The preprocessed data is filtered according to the importance of the characteristic value to obtain a first carbon emission trading price sequence.
5. A method for predicting carbon emission transaction cost data according to claim 1, characterized in that: Performing empirical mode decomposition on the first carbon emission trading price sequence to obtain a second carbon emission trading price sequence, including: Obtaining an initial signal according to the first carbon emission trading price sequence; Initializing the initial signal using empirical mode decomposition to obtain an iterative signal; Calculating the mean envelope of the iterative signal according to the upper envelope and the lower envelope of the iterative signal; Updating the iterative signal according to the mean envelope until the updated iterative signal meets a preset iterative stop condition, to obtain a component signal and a residual signal; the iterative stop condition includes a threshold condition and a zero-pole condition; Representing the first carbon emission trading price sequence as the sum of the component signal and the residual signal to obtain a second carbon emission trading price sequence.
6. A method for predicting carbon emission transaction cost data according to claim 5, characterized in that: The updating the iterative signal according to the mean envelope until the updated iterative signal meets a preset iterative stop condition, to obtain a component signal and a residual signal; The iterative stop condition includes a threshold condition and a zero-pole condition, including: By h k+1 [n] = h k [n]-m k [n] Update the iterative signal; wherein k is the number of iterations, k = 0, 1, 2, ...; h k [n] is the iteration signal of the kth iteration; m k [n] is the mean envelope at the kth iteration; Performing signal decomposition extraction on the updated iterative signal to obtain an intermediate component signal; When the intermediate component signal does not meet the preset iterative stop condition, updating the initial signal according to the intermediate component signal; When the intermediate component signal meets the preset iterative stop condition, stopping the update of the iterative signal, and obtaining the residual signal of the component signal according to the number of extreme points of the intermediate component signal.
7. A method for predicting carbon emission transaction cost data according to claim 5 or 6, characterized in that: The preset iterative stop condition includes a first iterative stop condition, a second iterative stop condition, and a third iterative stop condition; where: The first iterative stop condition is that the number of zeros and extreme points of the signal is the same; The first iterative stop condition is that the difference between the zeros and extreme points of the signal is less than a preset difference threshold; The third iterative stop condition is f(k - 2) < f(k - 1), f(k - 1) < f(k); where f(k) is the root mean square of the signal at the k-th iteration.
8. A method for predicting carbon emission transaction cost data according to claim 1, characterized in that: Extracting the long-term dependence relationship of the second carbon emission trading price sequence through a long short-term memory network, including: Constructing a long short-term memory network; the long short-term memory network includes a forgetting gate unit, an input gate unit, a cell state update unit, and an output gate unit for processing the cell state in the long short-term memory network; Inputting the second carbon emission trading price sequence into the long short-term memory network, and calculating a first parameter of the forgetting gate unit, a second parameter of the input gate unit, and a third parameter of the output gate unit based on the Sigmoid function; Selecting candidate cells from the cells of the long short-term memory network based on the tanh function; Updating the state of the candidate cells through the cell state update unit according to the first parameter and the second parameter to obtain an updated cell state; Calculating the hidden state at the current time step through the third parameter and the updated cell state to obtain the long-term dependence relationship of the second carbon emission trading price sequence.
9. A method for predicting carbon emission transaction cost data according to claim 1, characterized in that: Calculating the carbon emission trading price after a preset time according to the long-term dependence relationship and the historical carbon emission trading price data, including: Adding a position code to the historical carbon emission trading price data to obtain a position tag; According to the long-term dependency, a multi-head self-attention mechanism is used to perform attention training on the features of the historical carbon emission trading price data to obtain an attention score for each feature; According to the attention score of each feature, the carbon emission trading price after a preset time is calculated.
10. A carbon emission transaction cost data prediction system, characterized in that: include: A data preprocessing module is used to collect historical data and preprocess the historical data using the LOF algorithm to obtain preprocessed data; the historical data includes carbon emission trading price data and historical fossil fuel price data; A feature importance calculation module, used to calculate the feature values of the preprocessed data, obtain the importance of each feature value of the preprocessed data by a random forest algorithm, and filter the preprocessed data according to the importance of the feature values to obtain a first carbon emission trading price sequence; An empirical mode decomposition module, used to perform empirical mode decomposition on the first carbon emission trading price sequence to obtain a second carbon emission trading price sequence; A long-term dependency extraction module, used to extract the long-term dependency of the second carbon emission trading price sequence through a long short-term memory network; The price calculation module is used to calculate the carbon emission trading price after a preset time based on the long-term dependency relationship and the historical carbon emission trading price data.