Carbon emission time series data prediction method, device and storage medium
By combining multi-scale temporal convolutional networks and the dream optimization algorithm, the problem of accuracy in carbon emission data prediction is solved, achieving high-precision carbon emission prediction and supporting the optimization of carbon peaking paths and scientific decision-making in the carbon trading market.
Patent Information
- Application Number
- CN202511419619.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2045-09-30
AI Technical Summary
Existing technologies are insufficient to accurately predict future carbon emission data, affecting the optimization of carbon peaking pathways and the formulation of carbon trading market strategies, and the updating of carbon emission factors lacks scientific basis.
A multi-scale temporal convolutional network model combined with a dream optimization algorithm is used to improve prediction accuracy by standardizing carbon emission data, calculating weekly averages, training multi-scale temporal convolutional networks, and introducing attention mechanisms and hybrid loss functions.
With limited data, high-precision prediction of carbon emissions data was achieved, improving the scientific rigor and reliability of carbon peaking path optimization and carbon trading market strategies.
Smart Images

Figure CN120893639B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of carbon emission time series data prediction, in particular to a method for building a multi-scale time series convolution network model optimized by a dream optimization algorithm to obtain the best hyperparameter combination for carbon emission data prediction. BACKGROUND
[0002] Carbon emission data prediction is an important foundation for realizing the low-carbon development strategy and addressing global climate change. Through medium and long-term prediction of carbon emissions, high-emission periods can be identified in advance, and phased targets and strategies for carbon emission reduction can be set reasonably, optimizing the layout of energy structure and promoting the planning and investment of renewable energy. At the same time, carbon emission prediction is also of great significance for enterprises to develop energy structure optimization schemes, production scheduling strategies and carbon trading strategies, which helps to improve energy efficiency and reduce carbon costs. In addition, the results of carbon emission prediction can provide reliable reference for carbon market quota pricing, carbon credit evaluation and international environmental agreement negotiation, ultimately promoting the development of green and low-carbon economy and the implementation of global sustainable development strategy.
[0003] On the other hand, carbon emission factors are key parameters for measuring the unit carbon emissions of a certain type of activity (such as fuel consumption, electricity use or industrial production), often serving as the basis for carbon emission accounting. Carbon emission data prediction and carbon emission factors are closely related and together form an important basis for carbon accounting and evaluation. Carbon emission factors are usually calculated based on measured data statistics, while the results of reasonable prediction of future carbon emission data based on historical carbon emission data can be verified with the results obtained by carbon emission factor method. If there is a significant deviation between the two, it may mean that the carbon emission factor needs to be updated to reflect the effects of technological progress, energy structure adjustment or implementation of emission control policies. Therefore, carbon emission data prediction is not only a tool for assessing future total emissions, but also provides a reference for the scientific revision of carbon emission factors. Combining prediction results with factor method can more accurately develop carbon peak path, optimize carbon trading market quota allocation, evaluate policy emission reduction effect, and provide more reliable decision basis for enterprises and research institutions. Therefore, how to use existing carbon emission measurement data to reasonably and accurately predict future carbon emission situation is a problem to be solved. SUMMARY
[0004] The carbon emission time series data prediction method, device and storage medium provided by the present application can at least solve one of the technical problems in the background art.
[0005] To achieve the above-mentioned purpose, the present application adopts the following technical solutions:
[0006] A carbon emission time series data prediction method, comprising the following steps executed by a computer device,
[0007] S100, align the length of the acquired carbon emission sample sequence data of each year, standard deviation standardization processing is used to align the data, and the weekly average of the aligned data is calculated;
[0008] S200, the aligned data and the weekly average after step S100 are divided into training set and validation set respectively, and the annual cycle division method is adopted, and the sliding window size is designed as the input of the subsequent prediction model;
[0009] S300, a multi-scale time convolution network Multi-Scale TCN model with two-dimensional feature input is built to train and predict the data samples;
[0010] S400, a dream optimization algorithm hyperparameter optimization function is constructed, five hyperparameters in the model built in step S300 that affect the prediction effect are selected, and the optimal hyperparameters of the model are determined when the optimization requirements are met, and the optimal hyperparameters are used to rebuild the model, so as to obtain the final model structure;
[0011] S500, the carbon emission time sequence sample data obtained after step S100 and S200 are input into the final model structure of step S400, the prediction of carbon emission data is completed, and the training set and validation set are added after the actual data of the new year is calculated, and dynamic training and prediction are realized.
[0012] Further, the step S100 specifically comprises,
[0013] S101, acquiring carbon emission time sequence data of different years , which means the carbon emission data of the th day of the th year, the unit is kilogram of carbon per day , is the year, is the date, the unit is day , under the premise of maintaining the distribution of carbon emission data, the length of the carbon emission data sequence of each year is aligned to make the length of the data set of each year consistent, which is 365 sample data, the data of February 29 in leap year is deleted to align the length of the carbon emission data sequence, so as to avoid additional complexity for sliding window construction and model input, and the aligned carbon emission data sequence is recorded as , which means the carbon emission value of the th time step of the th year, the unit is kilogram of carbon per day , is the year, is the aligned time step, the unit is day ;
[0014] S102: Standard deviation normalization is performed on the aligned carbon emission data, and all feature data is converted into a distribution with a mean of 0 and a standard deviation of 1. The calculation formula is
[0015] (1)
[0016] (2)
[0017] (3)
[0018] wherein: is the normalized carbon emission sample sequence, is the mean of the original carbon emission data, with a unit of kg carbon per day ( ), is the total number of data sample time steps after alignment each year, let , is the standard deviation of the original carbon emission data, with a unit of kg carbon per day ( );
[0019] S103, calculate the weekly average of carbon emission data each year , which is used as the second dimension feature input of the model, and the calculation formula is
[0020] (4)
[0021] wherein: is the average carbon emission value of the week in the year carbon emission sample sequence, with a unit of kg carbon per day ( ); is the time step length of the week, the of the part that can be divided by 7 is processed by 7 time steps, and the of the last less than 7 days of the year is processed by the actual remaining days; is the time step, with a unit of day ( ).
[0022] Further, the step S200 specifically comprises,
[0023] S201: First, the basic hyperparameters required by the Multi-Scale TCN model are set for data set processing, the weekly average is calculated based on the standardized data, and the standardized carbon emission sample sequence and its weekly average are used as the two input features of the model.
[0024] In terms of data set construction, an annual sliding window strategy is adopted, and the model input length and the prediction output length window size are both set to 365 days to realize the prediction of carbon emission data of the next year based on one year of data;
[0025] The training set and the validation set are divided in an annual cycle, and the model is trained and validated in cycles to enable the model to fully learn the characteristics of carbon emission data in different years;
[0026] S202: Define a window division function, which takes one year of features as input samples and the corresponding carbon emission data sequence of the next year as output samples for each training year to form a training-prediction pair and a diversified training sample set;
[0027] S203: Train the divided data and labels using the mini-batch gradient descent method, with a batch size of 16.
[0028] Further, the step S300 specifically includes,
[0029] S301: Construct a prediction model using a multi-scale time convolution network (Multi-Scale TCN) and an attention mechanism, and use the processed carbon emission sample sequence in a year and its weekly average features to construct a two-dimensional input matrix sequence , the formula is
[0030] (5)
[0031] wherein, is the number of feature channels, and the data input by the two feature channels is ; is the input time step;
[0032] For subsequent model hyperparameters that need to be optimized, the following hyperparameter set is selected , the formula is
[0033] (6)
[0034] wherein, is the number of convolution channels (hidden_size), which controls the capacity of the TCN network; is the Dropout random inactivation rate; is the adjustable learning rate of the optimizer selected in the model training; is the weight coefficient of Huber and MSE in the hybrid loss function; is a combination of convolution kernels of different sizes;
[0035] S302: The model takes the two-dimensional input sequence matrix The multi-scale convolution module is fed to extract multi-time scale feature information, generate multi-scale time-dependent features, and generate a two-dimensional input matrix sequence The 0th layer feature is obtained In the 1st layer TCN, the output formula of the 1st convolution kernel is
[0036] (7)
[0037] wherein, is the time step; is an activation function, used to enhance the non-linear expression and regularization; is the number of channels, when , ; is the size of the 1st convolution kernel; is the weight parameter of the 1st convolution kernel in the 1st layer at the channel and the offset is ; is the feature value of the 1st channel in the 1st layer at the time step ; is the dilation coefficient, defined as , used to expand the convolution receptive field; is the bias term of the 1st convolution kernel in the 1st layer; is the feature value of the 1st channel in the 1st layer at the time step ; is the bias term of the 1st convolution kernel in the 1st layer; is the feature value of the 1st channel in the 1st layer at the time step ;
[0038] After that, the results of multiple convolution kernels are averaged and fused with the residual, and the formula is:
[0039] (8)
[0040] wherein, is the final output of the 1st layer convolution block, is the number of multi-scale convolution kernels, is the residual connection, which maps the input to the current layer dimension and adds it to the convolution result, and after stacking layers, the final feature matrix is obtained, , is the feature matrix output by the last layer TCN, is the number of convolution channels (hidden_size), which extracts different dependent features by using multiple different convolution kernel sizes , and further expands the receptive field by combining the dilated convolution;
[0041] S303: Obtain the feature matrix At the same time, in order to enable the model to automatically focus on important time point features in the data, the convolution output is transposed, and the formulas are as follows:
[0042] (9)
[0043] wherein, are query (Query), key (Key) and value (Value) matrices, which are used for attention calculation; is the transpose of , the dimension changes from to ; is a trainable weight matrix of the attention mechanism, ;
[0044] The attention weight formula is
[0045] (10)
[0046] wherein, is an attention distribution matrix, and the dimension is ; is a scaling factor, which can prevent the dot product value from being too large;
[0047] The weighted output of the feature matrix is realized as follows:
[0048] (11)
[0049] Finally, average pooling is performed on the time dimension to obtain the time series feature vector after attention convolution output weighted aggregation, which aggregates the global features of the time series, and the formula is as follows:
[0050] (12)
[0051] S304: After each operation step of the model, the attention feature vector is input into the fully connected layer, mapped to years of prediction output, and the prediction carbon emission data is output at the output layer, and the formula is as follows:
[0052] (13)
[0053] wherein, is the standardized carbon emission data of the th time step in the th year predicted using the standardized data , and the unit is kilogram of carbon per day , is the weight matrix of the output layer; is the bias term of the output layer.
[0054] Further, step S304 further comprises defining the loss function of the model as a hybrid loss function of Huber loss and Mean Squared Error (MSE) loss, the definition formulas of Huber loss function, MSE loss function and hybrid loss function are respectively
[0055] (14)
[0056] (15)
[0057] (16)
[0058] wherein, Huber loss function definition uses SmoothL1Loss in PyTorch , is the weight coefficient of different parts in the hybrid loss function.
[0059] Further, the S300 further comprises S305: using inverse normalization to convert the predicted value back to the original carbon emission data unit, i.e. kilogram of carbon per day , the inverse normalization formula is
[0060] (17)
[0061] wherein, is the inverse normalized predicted data sequence, the unit is kilogram of carbon per day , is the standard deviation of the normalized predicted data, is the mean of the normalized predicted data;
[0062] S306: using the following indicators to evaluate the prediction results, including Mean Absolute Error (MAE), Root Mean Square Error (RMSE), Normalized Root Mean Square Error (NRMSE), Pearson Correlation Coefficient (CORR), the formulas are respectively
[0063] (18)
[0064] (19)
[0065] (20)
[0066] (21)
[0067] wherein, is the total number of sample time steps, is the mean of the true value and the predicted value of the annual carbon emission data, respectively, in units of kilograms of carbon per day (kgC / d).
[0068] Further, the step S400 specifically comprises,
[0069] S401: A dream optimization algorithm (DOA) model hyperparameter optimizer is constructed, and multiple hyperparameter combinations are selected for optimization according to the influence degree on the accuracy of the model running. The Pearson correlation coefficient (CORR) selected as the verification effect is the larger the numerical value, the better the effect. The objective function of the DOA algorithm is the negative value of the Pearson correlation coefficient of the verification set, to ensure that the model prediction trend fitting ability is continuously improved in the iteration process, and the formula is
[0070] (22)
[0071] S402: The optimization process of the algorithm is divided into two stages of exploration and development. In the exploration stage, the hyperparameter individuals selected in step S301 that need to be optimized are divided into D groups, corresponding to the number of hyperparameters to be optimized.
[0072] According to step 301, the selected hyperparameter set is , wherein the upper and lower limits of each hyperparameter contained are: the number of convolution channels (hidden_size) ; the Dropout random inactivation rate ; the learning rate of the optimizer ; the weight coefficient of Huber and MSE in the loss function ; the combination of different sizes of convolution kernels ;
[0073] In order to facilitate the search of the dream optimization algorithm, the continuous type parameter is normalized, and the Min-Max Normalization method is adopted. For the hyperparameter , the formula is
[0074] (23)
[0075] wherein, is the normalized parameter, is the lower bound of the hyperparameter, is an upper bound of the hyper-parameters;
[0076] S403: In the exploration stage, the position of each individual is reset to the position of the best individual in the group in the previous iteration, and then the position of each individual is updated from randomly selected dimensions in the dimension, denoted as and update the position in these dimensions, The calculation formula is:
[0077] (24)
[0078] wherein, denotes the group number, denotes a random integer selected from the range to , wherein, denotes the number of the group of forgetting dimensions in the exploration stage, denotes the total dimension of the parameter to be optimized;
[0079] S404: In each iteration, update is performed from the first individual to the th individual in turn, is the total number of population individuals, and the specific update process is:
[0080] (1) Execute the memory strategy. For the individuals of the th group, remember the position information of the best individual in the group before optimization, reset the position information to the position information of the best individual in the group, and the formula is
[0081] (25)
[0082] wherein, is the iteration number, is the position information of the th hyper-parameter set in the th iteration, is the position information of the best hyper-parameter set individual in the th group in the th iteration;
[0083] (2) Execute the forgetting and supplement strategy: the forgetting and supplement strategy combines global and local search functions, allowing individuals to forget and self-organize position information in the forgetting dimension, and the formula is:
[0084] (26)
[0085] wherein, Among these dimensions, the individual forgets the information of the best individual position in the group and looks for a new position in the optimization, namely the forgetting dimension; denotes the iteration the first time the position of the best set of hyperparameters in the dimension, denotes the iteration the first time the position of the best set of hyperparameters in the dimension; and are the upper and lower bounds of the hyperparameter space searched in the dimension, respectively; is a random number between 0 and 1; is the maximum total number of iterations set, is the maximum number of iterations set for the exploration phase; the parameter is used to adjust the proportion between the forgetting replenishment strategy and the dream sharing strategy in the exploration phase, when , the forgetting replenishment strategy is executed, otherwise the dream sharing strategy is executed, and the parameter is set;
[0086] (3) Execute the dream sharing strategy: the dream sharing strategy enhances the ability of the algorithm to jump out of the local optimal solution, and this strategy runs in parallel with the forgetting replenishment strategy, allowing individuals to randomly obtain position information from other individuals in the forgetting dimension, and the formula is
[0087] (27)
[0088] wherein is a random integer selected from when updating in each dimension, denotes the position of the set of hyperparameters in the dimension at the iteration, and the formula controls the search step to decrease with the iteration through the cosine function, achieving the purpose of large-scale exploration in the early stage and gradual convergence in the later stage;
[0089] S405: development stage, iteration count from to , at this time, grouping is no longer performed; before dreaming each time, the entire population will display the best individual in the previous iteration of the population, and then update the position of each individual in the forgetting dimension; all individuals in the population in this stage have the same number of forgetting dimensions, and dimensions are selected from dimensions, denoted as , and the positions in these dimensions are updated, The formula is:
[0090] (28)
[0091] (1) Execute the memory strategy: wherein represents the position information of the i-th individual at the j-th iteration, represents the position information of the best individual in the entire superpopulation at the j-th iteration;
[0092] (2) Execute the forgetting and supplement strategy, and the formula is
[0093] (29)
[0094] wherein, ;
[0095] S406: Considering the stability and adaptability of the algorithm, the number of iterations in the exploration stage is set to be related to the total number of iterations , that is, , that is, in the first iterations, the individual is updated through global search, and after exceeding the value, the algorithm switches to local development search. In the development stage, the search is fine-tuned around the current global optimal solution , and gradually approaches the optimal hyperparameter. After each generation calculation, the global optimal solution is updated. If the objective function of the current candidate hyperparameter set is better, replace it with it. When or there is no significant improvement for consecutive generations, the algorithm stops and outputs the optimal hyperparameter combination. ;
[0096] S407: After the dream optimization algorithm converges, the global optimal solution
[0096] is taken, and the original hyperparameter data that can be used in the model is obtained by performing inverse normalization on the global optimal solution. The inverse normalization formula is
[0097] (30)
[0098] wherein, is the inverse normalized hyperparameter, is the parameter that needs to be inverse normalized, is the lower bound of the hyperparameter, is the upper bound of the hyperparameter.
[0099] Further, the step S500 specifically comprises,
[0100] S501, input the carbon emission sample sequence processed in steps S100 and S200 into a Multi-Scale TCN model built by an optimal hyperparameter combination obtained by optimizing a DOA hyperparameter optimization function built in steps S300 and S400, use 365 data of the previous year to predict 365 data of the next year, and use an annual cycle division method to cyclically train and verify, and realize prediction of carbon emission data.
[0101] In another aspect, the present application also discloses a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to make the processor execute the steps of the above method.
[0102] In another aspect, the present application also discloses a computer device, which comprises a memory and a processor, and the memory stores a computer program, and the computer program is executed by the processor to make the processor execute the steps of the above method.
[0103] According to the above technical solution, the present application is a carbon emission time series data prediction method, which comprises the following steps: , the unit is kilogram of carbon per day ( ), is the year, taking 2019, 2020, etc. is the date, the unit is day ( );According to the data time series property, design the data sequence length alignment method, standardize the aligned carbon emission data sequence to obtain the carbon emission sample sequence, and calculate the carbon emission weekly average value;At the same time, using the annual cycle division method, the sample sequence is dynamically divided into training set and validation set;Design and build a multi-scale time convolution network (Multi-Scale Temporal Convolutional Network, Multi-Scale TCN) model with a two-dimensional feature matrix as input, and introduce an attention mechanism in it, design a hybrid loss function to enhance the model's ability to focus on data mutation and overall trend fitting;Construct the hyperparameter optimization function under the dream optimization algorithm (Dream Optimization Algorithm, DOA), and after obtaining the hyperparameter combination obtained by the DOA optimization function, reconstruct the Multi-Scale TCN model, train, verify and predict the carbon emission data. The present application can obtain high prediction accuracy after training the optimized model with a small amount of carbon emission data.
[0104] Specifically, in the present application, the Multi-Scale TCN model extracts multi-level time features through different size convolution kernels, and combines dilated convolution to expand the receptive field without increasing too much computing cost, thereby capturing both short-term fluctuations and long-term trends in carbon emission data. This multi-scale feature extraction capability is obviously superior to single-scale convolution or single time window recurrent network in modeling the seasonality and sudden changes of carbon emissions. At the same time, the attention mechanism is introduced in the model, which can adaptively highlight the contribution of key time points by learning the relationship between query, key and value. For example, at the moment of abnormal rise or sudden drop of carbon emissions, the model will assign higher weights, thereby improving the prediction accuracy and the interpretability of the model. In addition, the present application adopts a hybrid loss function combining Huber loss and mean square error, which can not only maintain high-precision fitting of overall trends, but also reduce the excessive sensitivity of the model to extreme values or abnormal points, making the prediction results more stable and reliable. The present application also introduces the dream optimization algorithm to globally optimize the learning rate, the number of convolution channels, the dropout rate, the loss function weight and other key hyperparameters. DOA can search for the globally optimal or approximately globally optimal parameter combination in a relatively short time through the iterative mechanism combining exploration and development, so that the model is excellent in training efficiency and prediction accuracy. BRIEF DESCRIPTION OF DRAWINGS
[0105] Figure 1 is a flow chart of the present application;
[0106] Figure 2 is a comparison line graph of the predicted value and the actual value of carbon emission data in 2024. DETAILED DESCRIPTION
[0107] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all the embodiments.
[0108] As shown in Figure 1 , the carbon emission time series data prediction method described in the present embodiment specifically relates to a carbon emission time series data prediction method, in order to enrich carbon emission prediction data and improve model prediction effect, comprising the following steps:
[0109] S100, aligning the length of carbon emission time series data obtained by the present application, due to the existence of leap years, the sequence length is not the same, under the premise of keeping the data distribution, the length of carbon emission data of each year is aligned, the aligned data is processed by using standard deviation standardization (StandardScaler), the input data is processed to a suitable range, and the weekly average of the aligned data is calculated;
[0110] S200. The modified carbon emission sample sequence is divided into training and validation sets, and an annual cyclical division method is adopted. The sliding window size is designed to meet the input of the subsequent prediction model.
[0111] S300. Construct a multi-scale temporal convolutional network (Multi-Scale TCN) model with two-dimensional feature input for training and prediction of data samples;
[0112] S400. Construct the hyperparameter optimization function of the dream optimization algorithm. Select the five hyperparameters that affect the prediction effect in the model built in step S300, and optimize them. When the optimization requirements are met, determine the optimal hyperparameters of the model. Use the optimal hyperparameters to reconstruct the model, and thus obtain the final model structure.
[0113] S500: Input the acquired carbon emission time series sample data into the training and prediction model obtained by optimizing the optimal hyperparameters in step S400 and rebuilding it according to step S300 to complete the prediction of carbon emission data. After the actual data of the new year is calculated, it is cyclically added to the training set and validation set to achieve dynamic training and prediction.
[0114] The following is a detailed explanation:
[0115] Step S100 specifically includes,
[0116] S101. Obtain carbon emission time-series data for different years. Its meaning is the first Year Carbon emissions data per day, in kilograms of carbon per day (kcal / day) ), For the year, choose 2019, 2020, etc. For dates, the unit is days ( Due to the existence of leap years, the sequence lengths vary across different years, making it impossible to construct a unified sample data dimension. Therefore, this invention, while maintaining the distribution of carbon emission data, aligns the carbon emission data sequence lengths for each year, ensuring a consistent dataset length of 365 samples per year. Since February 29th only occurs in leap years, there are no comparable dates in non-leap years. Furthermore, removing February 29th has the least impact on annual periodicity and overall trend compared to deleting other specific dates. Therefore, the data on February 29th in leap years is removed to align the carbon emission data sequence lengths, avoiding additional complexity in sliding window construction and model input. The aligned carbon emission data sequence is denoted as... Its meaning is the first Year Carbon emission value of a time step, in kilogram of carbon per day ), is a year, taking 2019, 2020, etc. is the aligned time step, in days ) ;
[0117] S102: In order to eliminate the influence of different characteristic quantities and numerical range differences on model convergence and prediction performance, the aligned carbon emission data is processed by standard deviation standardization (StandardScaler), and all feature data is converted into a distribution with a mean of 0 and a standard deviation of 1, and the calculation formula is
[0118] (1)
[0119] (2)
[0120] (3)
[0121] Among them: is the normalized carbon emission sample sequence, is the mean of the original carbon emission data, in kilogram of carbon per day ), is the total number of data sample time steps after alignment each year, in the present application , is the standard deviation of the original carbon emission data, in kilogram of carbon per day ) ;
[0122] S103, calculate the weekly average of carbon emission data each year , used as the second dimension feature input of the model, and the calculation formula is
[0123] (4)
[0124] Among them, is the average carbon emission value of the th week in the carbon emission sample sequence of the th year, in kilogram of carbon per day ) ; is the time step length of the th week, since 365 days cannot be divided by 7, i.e. cannot take an integer number of weekly averages, the of the part that can be divided by 7 is processed as 7 time steps, and the of less than 7 days at the end of the year is processed according to the actual remaining days; is the time step, in days ) ;
[0125] The step S200 specifically comprises,
[0126] S201: Firstly, the basic hyperparameters required by the Multi-Scale TCN model are set, and the dataset is processed. Considering that the research data is selected from daily carbon emission observation values from 2019 to 2024 (365 days per year), the weekly average value is calculated based on the standardized data, and the standardized carbon emission sample sequence and its weekly average value are used as two input features of the model. In terms of data set construction, the annual sliding window strategy is adopted, and the model input length and the prediction output length window size are both set to 365 days to realize the prediction of the next year's carbon emission data based on one year's data. Due to the small amount of data, in order to improve the model training effect, the annual cycle division method is adopted: firstly, the data from 2019 to 2023 is used as the training set, and the data in 2024 is used as the validation set; then, the data arrangement is adjusted, and the data from 2019 to 2022 and 2024 is used as the training set, and the data in 2023 is used as the validation set; and so on, the cycle training and validation make the model can fully learn the characteristics of carbon emission data in different years;
[0127] S202: A window division function is defined, which functions to take the one-year length (365) features in the input data as input samples and the next year's corresponding carbon emission data sequence as output samples. For each training year, a training-prediction pair is constructed to form a diversified training sample set;
[0128] S203: In order to improve the training efficiency and stability of the model, the small batch gradient descent method is used to train the divided data and labels, and the batch size is set to 16.
[0129] The step S300 specifically comprises,
[0130] S301: A prediction model is constructed by using a multi-scale temporal convolutional network (Multi-Scale TCN) and an attention mechanism, and the processed carbon emission sample sequence in one year and its weekly average value features are used to construct a two-dimensional input matrix sequence , the formula is
[0131] (5)
[0132] Wherein, , the feature channel number, the data input by the two feature channels is ; , is the input time step.
[0133] For the model hyperparameters that need to be optimized subsequently, the following hyperparameters are selected to form a set , the formula is
[0134] (6)
[0135] wherein, is the number of convolution channels (hidden_size), which controls the capacity of the TCN network; is the Dropout random inactivation rate; is the adjustable learning rate of the optimizer selected in the model training; is the weight coefficient of Huber and MSE in the hybrid loss function; is the combination of convolution kernels of different sizes;
[0136] S302: The model sends the two-dimensional input sequence matrix into the multi-scale convolution module to extract multi-time scale feature information and generate multi-scale time-dependent features. The two-dimensional input matrix sequence will be the 0th layer feature , in the layer TCN, the output formula of the th convolution kernel is
[0137] (7)
[0138] wherein, is the time step; is the activation function, which is used to enhance the non-linear expression and regularization; is the number of channels, when , ; is the size of the th convolution kernel; is the weight parameter of the th convolution kernel in the th layer at the channel , with an offset of ; is the feature value of the th channel in the th layer at the time step , is the dilation coefficient, defined as , which is used to expand the convolution receptive field; is the bias term of the th convolution kernel in the th layer;
[0139] Then take the average of the results of multiple convolution kernels and add the residual to fuse, the formula is
[0140] (8)
[0141] where, is the output of the layer convolution block, is the number of multi-scale convolution kernels, is the residual connection that maps the input to the current layer dimension and adds it to the convolution result, After the layer stacking, the final feature matrix is obtained. is the feature matrix output by the last layer of TCN, is the number of convolution channels (hidden_size), which uses multiple different convolution kernel sizes to extract different dependency features and combines dilated convolution to further expand the receptive field.
[0142] S303: Obtain the feature matrix At the same time, in order to let the model automatically focus on important time point features in the data, the convolution output is transposed, and the formulas are respectively
[0143] (9)
[0144] where, Query, Key and Value matrices are used for attention calculation, is the transpose of , the dimension changes from to ; is the trainable weight matrix of the attention mechanism, .
[0145] The attention weight formula is
[0146] (10)
[0147] where, is the attention distribution matrix, with a dimension of ; is a scaling factor that can prevent the dot product value from being too large.
[0148] The weighted output of the feature matrix is:
[0149] (11)
[0150] Finally, the time dimension is averaged and pooled to obtain the time series feature vector output after attention convolution output weighted aggregation, which aggregates the global features of the time series, and the formula is
[0151] (12)
[0152] S304: After each step of the model's operation, the attention feature vector is... Input fully connected layer, mapped to The predicted output for the day will be displayed at the output layer, showing predicted carbon emission data. The formula is
[0153] (13)
[0154] in, To use standardized data The predicted first Year Standardized carbon emission data for each time step, in kilograms of carbon per day (kcal / day). ), This is the weight matrix of the output layer; This represents the bias term for the output layer. Meanwhile, to balance model accuracy and robustness, the model's loss function is defined as a hybrid loss function of Huber loss and Mean Squared Error (MSE). The definitions of the Huber loss function, MSE loss function, and hybrid loss function are as follows:
[0155] (14)
[0156] (15)
[0157] (16)
[0158] The Huber loss function definition uses SmoothL1Loss from PyTorch. ), These are the weighting coefficients for different parts of the mixed loss function.
[0159] S305: Use inverse standardization to adjust the predicted values Convert back to the original carbon emission data unit, i.e., kilograms of carbon per day (kilograms of carbon per day) The anti-standardization formula is:
[0160] (17)
[0161] in, This is the predicted data sequence after inverse normalization, in kilograms of carbon per day (kcal / day). ), To predict the standard deviation of the standardized data, To predict the mean value of the standardized data.
[0162] S306: Evaluate the prediction results using the following indicators, including mean absolute error (MAE), root mean square error (RMSE), normalized root mean square error (NRMSE), and Pearson correlation coefficient (CORR), whose formulas are
[0163] (18)
[0164] (19)
[0165] (20)
[0166] (21)
[0167] wherein, is the total number of sample time steps, are the mean values of the true value and the predicted value of the carbon emission data in the year, respectively, and the unit is kilogram of carbon per day );
[0168] The step S400 specifically comprises,
[0169] S401: Construct a dream optimization algorithm (DOA) model hyperparameter optimizer, and select 5 hyperparameters for optimization according to the influence degree on the accuracy of the model, and the selected hyperparameters are: the number of convolution channels , the Dropout random inactivation rate , the adjustable learning rate of the optimizer , the weight coefficient of Huber and MSE in the hybrid loss function , and the combination of convolution kernels of different sizes . DOA is a meta-heuristic optimization algorithm. In order to measure the pros and cons of each set of hyperparameters obtained by DOA, a target function needs to be constructed. Since the DOA algorithm aims to minimize the target function, and the selected parameter Pearson correlation coefficient (CORR) as the verification effect is the larger the value, the better the effect, the target function of the DOA algorithm is taken as the negative value of the Pearson correlation coefficient of the validation set, to ensure that the model prediction trend fitting ability is continuously improved in the iteration process, and the formula is
[0170] (22)
[0171] S402: The optimization process of the algorithm is divided into two stages: exploration and development. In the exploration stage, the hyperparameters selected in step S301 that need to be optimized are first divided into D groups, denoted as... This corresponds to the number of hyperparameters to be selected for optimization.
[0172] As described in step 301, the set of hyperparameters selected by this invention is as follows: The upper and lower limits of the various hyperparameters included are: number of convolution channels (hidden_size) Dropout random inactivation rate The learner rate of the optimizer The weighting coefficients of Huber and MSE in the combined loss function Different combinations of convolution kernel sizes .
[0173] To facilitate the search of the dream optimization algorithm, continuous parameters are... Normalization is performed using the Min-Max Normalization method for hyperparameters. The formula is
[0174] (twenty three)
[0175] in, These are the normalized parameters. This is the lower bound of the hyperparameters. This is the upper bound of the hyperparameters;
[0176] S403: During the exploration phase, reset the position of each individual to the position of the best individual in the group from the previous iteration, and then from... Random selection from dimensions Each dimension is denoted as... And update the positions in these dimensions. The calculation formula is:
[0177] (twenty four)
[0178] in, Indicates the group number. Indicates from the range arrive A random integer selected from , Indicates the first The forgetting dimension of the group during the exploration phase. This represents the total dimension of the parameters to be optimized;
[0179] S404: In each iteration, from the first individual to the... Each individual executes the update sequentially ( (Total number of individuals in the population), the specific update process is as follows:
[0180] (1) Implement memory strategies, for the first Before optimization, each individual in the group remembers the position information of the best performer in the group and resets its own position information to match that of the best performer. The formula is as follows:
[0181] (25)
[0182] in, For the number of iterations, In the first During the nth iteration Location information of a set of hyperparameters In the first During the nth iteration The best set of hyperparameters in the group; individual location information;
[0183] (2) Executing Forgetting and Replenishment Strategies: Forgetting and replenishment strategies combine global and local search functions, allowing individuals to forget and self-organize location information within the forgetting dimension. The formula is as follows:
[0184] (26)
[0185] in, In these dimensions, individuals forget their best individual position information in the group and seek a new position during optimization; this is the forgetting dimension. Iteration Next time The set of hyperparameters in the th... The position of the dimension Iteration Next time The optimal set of hyperparameters in the group is in the th The position of the dimension; and The first Search for the upper and lower bounds of the hyperparameter space in each dimension; A random number between 0 and 1; This is the maximum total number of iterations set. This sets the maximum number of iterations for the exploration phase. (Parameter) Used to adjust the ratio between forgetting recovery strategies and dream sharing strategies during the exploration phase, when If the condition is met, the forgetting supplementation strategy is executed; otherwise, the dream sharing strategy is executed. (Settings are missing from the original text.) ;
[0186] (3) Dream sharing strategy: Dream sharing strategy enhances the ability of the algorithm to jump out of local optimal solution. This strategy runs in parallel with the forgetting supplement strategy, allowing individuals to randomly obtain position information from other individuals in the forgetting dimension. The formula is
[0187] (27)
[0188] wherein, is a random integer selected from when updating in each dimension, represents the position of the th hyperparameter set in the th dimension at the th iteration. The formula controls the search step size to decrease with iteration through the cosine function, achieving the purpose of large-scale exploration in the early stage and gradual convergence in the later stage.
[0189] S405: Development stage, from to iteration count, at this time no longer execute grouping. Before dreaming each time, the population will display the best individual in the previous iteration of the entire population, and then update the position of each individual in the forgetting dimension. All individuals in the population in this stage have the same number of forgetting dimensions, select from forgetting dimensions, denoted as , and update the position in these dimensions, The formula is:
[0190] (28)
[0191] (1) Execute memory strategy: wherein represents the position information of the th individual at the th iteration, represents the position information of the best individual in the entire superpopulation in the th iteration;
[0192] (2) Execute forgetting supplement strategy, formula is
[0193] (29)
[0194] wherein, ;
[0195] S406: Considering the stability and adaptability of the algorithm, the number of exploration stage iterations and the total number of iterations is set to , that is, the first In the next iteration, the individual is updated by global search using the forgetting complementary strategy formula. When the value exceeds this number, the algorithm switches to local development search. In the development stage, the search is around the current global optimal solution Fine-tuning, step by step, approaching the optimal hyperparameters, updating the global optimal solution after each generation calculation. If the current candidate hyperparameter set is better, replace it When or no significant improvement for consecutive generations, the algorithm stops and outputs the optimal hyperparameter combination ;
[0196] S407: After the dream optimization algorithm converges, take the global optimal solution , and get the original hyperparameter data that can be used in the model. The inverse normalization formula is
[0197] (30)
[0198] Where, is the inverse normalized hyperparameter, is the parameter that needs to be inverse normalized, is the lower bound of the hyperparameter, is the upper bound of the hyperparameter
[0199] In this model, the inverse normalization formula of each hyperparameter is described in the following formula, including the number of convolution channels (hidden_size), Droup_out ratio, learning rate (Learning Rate), loss function weight (Loss Weight), and convolution kernel combination (kernel_set). The formulas are as follows:
[0200] (31)
[0201] (32)
[0202] (33)
[0203] (34)
[0204] (35)
[0205] Where, is the normalized hyperparameter before DOA optimization, is the number of convolution combinations. Using this parameter configuration, the Multi-Scale TCN model is reconstructed according to the content described in step S400.
[0206] Step S500 specifically includes,
[0207] S501, Process the carbon emission sample sequence from steps S100 and S200. The data is input into the Multi-Scale TCN model built from the optimal hyperparameter combination obtained by the DOA hyperparameter optimization function constructed in steps S300 and S400. 365 data points from the previous year are used to predict 365 data points for the following year. A yearly cyclical partitioning method is adopted: first, data from 2019 to 2023 are used as the training set, and data from 2024 are used as the validation set; then, the data arrangement is adjusted, using data from 2019 to 2022 and 2024 as the training set, and data from 2023 as the validation set; this process is repeated, cyclically training and validating, to predict carbon emission data for 2025.
[0208] S502. After the relevant documents on carbon emission data for 2025 are released, the data can be processed according to the method described in step S100 and requisitioned for use, replacing the retired offline data as the test set of 2024 carbon emission data, which becomes the new validation set for the Multi-Scale TCN model. At the same time, following the annual cyclical partitioning method described in step S501, the model is cyclically trained, validated, and predicted. In the future, new actual carbon emission data will be continuously calculated and acquired, the amount of data in the model training set will be expanded, and the data sequence of the model validation set will be replaced, so as to realize the dynamic expansion of model data and the prediction of future carbon emission data.
[0209] Figure 2 The image shows a line graph plotting the prediction of 2024 carbon emissions using a Multi-Scale TCN model built with DOA-optimized hyperparameters based on the method described in this invention, and comparing it with the actual 2024 carbon emissions data. Figure 2 As shown, the model's predicted values (blue curve) and the actual values (red curve) remain highly consistent throughout the year. Whether it is the overall trend or local fluctuations, the prediction results can follow the actual data well. In particular, it shows good prediction results at the peak and trough of carbon emissions, which reflects the strong prediction accuracy and generalization ability of the Multi-Scale TCN Dream Optimization Method in carbon emission prediction, as well as its potential advantages in practical applications.
[0210] Table 1 shows some evaluation index values for the 2024 carbon emission data prediction results, including mean absolute error (MAE), root mean square error (RMSE), normalized root mean square error (NRMSE), and Pearson coefficient (CORR). The index results in Table 1 further validate this, with the model's MAE being 9.04 × 10⁻⁶. 6, which indicates that the average deviation between the predicted value and the true value is small, and the high stability can be maintained; the RMSE is 1.24x10 7 , which shows that the model can maintain good accuracy when facing larger fluctuations, and there is no significant error accumulation; the normalized error NRMSE is 0.0825, which is lower than 0.1, indicating that the prediction error accounts for a very low proportion in the relative scale, highlighting the robustness and reliability of the model; the correlation coefficient CORR reaches 0.871, indicating that the prediction result and the true value have a strong linear correlation, which not only ensures the accuracy of trend fitting, but also improves the ability to describe the dynamic changes of carbon emissions.
[0211] Table 1
[0212]
[0213] In yet another aspect, the present application also discloses a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to make the processor execute the steps of the above method.
[0214] In still another aspect, the present application also discloses a computer device, which comprises a memory and a processor, and the memory stores a computer program, and the computer program is executed by the processor to make the processor execute the steps of the above method.
[0215] It can be understood that the system, device and storage medium provided by the embodiments of the present application correspond to the method provided by the embodiments of the present application, and the explanation, examples and beneficial effects of the related content can be referred to the corresponding part in the above method.
[0216] In the embodiments described above, all or some of the steps can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, all or some of the steps can be implemented in the form of one or more computer programs or program elements. The computer programs reside (at least temporarily) in a memory of a computer during execution. The memory can be a RAM memory, a flash memory, a ROM memory, an EPROM memory, or any other suitable memory. The memory can be integral to or separate from the computer. The computer programs can be written in any suitable programming language, such as C, C++, Java, Visual Basic, etc. The computer programs can be written in assembly or machine language, if desired. The computer programs can be distributed over network coupled file servers, or can be distributed by any other suitable means.
[0217] It is to be understood that the terminology "first", "second", etc. used herein merely for the purpose of distinguishing one entity or action from another, and does not necessarily imply these entities or actions are mutually exclusive or are either temporal or spatial priorities of one another. Moreover, the terms "comprising", "including", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that processes, methods, articles, or apparatuses that comprise a list of elements are not necessarily limited to those elements, but can include other elements not expressly listed or inherent to such processes, methods, articles, or apparatuses. Furthermore, the term "comprising" does not exclude the presence of elements or additional steps other than those listed in the process, method, article, or apparatus.
[0218] Each of the embodiments described in the specification is described in a related manner, and the same or similar parts of each of the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for the system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the description of the method embodiments.
[0219] The above examples are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that the technical solutions recorded in the foregoing examples can be modified, or some technical features can be replaced by equivalent features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A carbon emission time series data prediction method, characterized in that, The method comprises the following steps: S100, aligning the length of the obtained annual carbon emission sample sequence data, standard deviation normalizing the aligned data, and calculating the weekly average of the aligned data; S200, dividing the aligned data and the weekly average processed in step S100 into training sets and validation sets, respectively, adopting an annual cycle division method, designing a sliding window size as an input of a prediction model to be built subsequently; S300, building a multi-scale time convolution network (Multi-Scale TCN) model with two-dimensional feature input, for training and predicting the data samples; S400, building a dream optimization algorithm hyperparameter optimization function, selecting five hyperparameters in the model built in step S300 that have an influence on the prediction effect, optimizing the hyperparameters, determining the optimal hyperparameters of the model when the optimization requirements are met, and rebuilding the model using the optimal hyperparameters to obtain a final model structure; S500, inputting the carbon emission time series sample sequence data obtained after the processing in steps S100 and S200 into the final model structure in step S400, completing the prediction of the carbon emission data, and adding the training set and the validation set after the calculation of the actual data in the new year to realize dynamic training and prediction; The step S300 specifically comprises, S301: A prediction model is constructed using a multi-scale time convolution network Multi-Scale TCN and an attention mechanism, and a two-dimensional input sequence matrix is constructed using the processed carbon emission sample sequence in a year and the weekly average features thereof , the formula is (1) wherein, is the number of feature channels, and the data input of two feature channels are ; is the input time step; wherein: is the normalized carbon emission sample sequence, is the weekly average of carbon emission data per year; For the subsequent need to optimize the model hyperparameters, select the following hyperparameters consisting of a set , the formula is (2) wherein, is the number of convolution channels, controlling the capacity of the TCN network; is the Dropout random inactivation rate; is the adjustable learning rate of the optimizer selected in model training; is the weight coefficient of Huber and MSE in the hybrid loss function; is the combination of convolution kernels of different sizes; S302: The model inputs the two-dimensional input sequence matrix into the multi-scale convolution module to extract multi-time scale feature information and generate multi-scale time-dependent features. The two-dimensional input sequence matrix is taken as the 0th layer feature . In the 1st layer TCN, the output formula of the 1st convolution kernel is (3) wherein, is the time step; is an activation function for enhancing non-linear representation and regularization; is the number of channels when ; ; is the size of the th convolution kernel; is the weight parameter of the th convolution kernel in the th layer at the th channel with an offset of ; is the feature value of the th channel in the th layer at the time step ; is the dilation coefficient defined as , which is used to expand the receptive field of convolution; is the bias term of the th convolution kernel in the th layer; Then, the results of the plurality of convolution kernels are averaged, and a residual is added for fusion, and the formula is (4) wherein, is the number of layers, is the final output of the layer convolution block, is the number of multi-scale convolution kernels, is a residual connection that maps the input to the current layer dimension and adds it to the convolution result, which is after layer stacking, the final feature matrix is obtained, is the feature matrix output by the last layer of TCN, is the number of convolution channels, and different dependent features are extracted using multiple different convolution kernel sizes to further expand the receptive field in combination with dilated convolution; S303: Obtain a feature matrix At the same time, in order to enable the model to automatically focus on important time point features in the data, the convolution output is transposed, and the formulas are as follows (5) wherein, are the query, key and value matrices, respectively, used for attention computation; is the transpose of , with dimensions changing from to is a trainable weight matrix for the attention mechanism, ; The attention weight formula is (6) wherein, is an attention distribution matrix with dimension ; is a scaling factor that can prevent the dot product value from being too large; To The matrix implements the weighted output as (7) Finally, the time dimension is averaged and pooled to obtain the time series feature vector after attention convolution output weighted aggregation which aggregates the global features of the time series, and the formula is (8) S304: After each operation step of the model, the time series feature vector is inputted into a fully connected layer, which is mapped to the predicted output of the day, which outputs the predicted carbon emission data at the output layer , which is formulated as (9) wherein, is the standardized data predicted standardized carbon emission data for the year is the standardized carbon emission data for the year is the standardized carbon emission data for the year is the weight matrix of the output layer; is the bias term of the output layer.
2. The carbon emission time series data prediction method of claim 1, wherein: The step S100 specifically comprises, S101. Obtain carbon emission time-series data for different years. Its meaning is the first Year Carbon emissions data per day, in kilograms of carbon per day. For the year, For dates, the unit is days. While maintaining the distribution of carbon emission data, the length of the carbon emission data sequence for each year is aligned to ensure a consistent dataset length of 365 samples per year. Data for February 29th in leap years is removed to align the carbon emission data sequence lengths, avoiding additional complexity to the sliding window construction and model input. The aligned carbon emission data sequence is denoted as... Its meaning is the first Year Carbon emissions at each time step, expressed in kilograms of carbon per day. For the year, The time step after alignment, in days; S102: standard deviation normalizing the aligned carbon emission data, and converting all feature data into a distribution with a mean of 0 and a standard deviation of 1, and the calculation formula is (10) (11) (12) wherein, is the mean of the original carbon emission data in kilogram of carbon per day, is the total number of time steps of the data sample per year after alignment, let , is the standard deviation of the original carbon emission data in kilogram of carbon per day; S103、Calculate the weekly average of carbon emission data per year , for the second dimension feature input of the model, the calculation formula is (13) wherein, is the average carbon emission value of the first week in the carbon emission sample sequence of the year , in units of kilograms of carbon per day; is the time step length of the first week, the part that can be divided by 7 will be processed as 7 time steps, the part that cannot be divided by 7 will be processed as the actual remaining days; is the time step, in units of days. 3. The carbon emission time series data prediction method of claim 2, wherein: The step S200 specifically comprises, S201: first, setting the basic hyperparameters required by the Multi-Scale TCN model for data set processing, calculating the weekly average based on the standardized data, and taking the standardized carbon emission sample sequence and the weekly average as two input features of the model; In terms of data set construction, an annual sliding window strategy is adopted, and the model input length and the prediction output length window size are both set to 365 days to realize the prediction of the carbon emission data of the next year based on one year of data; The training set and the validation set are divided in an annual cycle, and the model is trained and validated in cycles, so that the model can fully learn the carbon emission data characteristics of different years; S202: defining a window division function, which takes one year of features in the input data as input samples and the carbon emission data sequence of the next year as output samples to form a diversified training sample set for each training year; S203: training the divided data and labels using a mini-batch gradient descent method, and the batch size is set to 16.
4. The carbon emission timing data prediction method of claim 3, wherein: Step S304 further includes defining a loss function of the model as a hybrid loss function of a Huber loss and a mean squared error loss, and the definition formulas of the Huber loss function, the MSE loss function and the hybrid loss function are respectively (14) (15) (16) where the Huber loss function is defined using SmoothL1Loss in PyTorch, taking , are the weight coefficients for different parts of the hybrid loss function.
5. The carbon emission timing data prediction method of claim 4, wherein: The S300 further comprises, S305: using de-normalization to convert the predicted value Converting back to the original carbon emission data unit, i.e. kilograms of carbon per day, the de-normalization formula is (17) wherein, is the normalized predicted data sequence in kilograms of carbon per day, is the standard deviation of the normalized predicted data, is the mean of the normalized predicted data; S306: using the following indicators to evaluate the prediction results, including mean absolute error, root mean square error, normalized root mean square error, and Pearson correlation coefficient, and the formulas are (18) (19) (20) (21) in, The total number of sample time steps. The first The average of the actual and predicted annual carbon emissions data, expressed in kilograms of carbon per day.
6. The carbon emission time series data prediction method according to claim 5, characterized in that: The step S400 specifically comprises, S401: Construct a dream optimization algorithm model hyperparameter optimizer, and select multiple hyperparameter combinations for optimization according to the influence degree on the accuracy of the model. The parameter Pearson correlation coefficient selected as the verification effect is the larger the numerical value, the better the effect, and the objective function of the DOA algorithm The negative value of the Pearson correlation coefficient for the validation set ensures that the model prediction trend fitting ability is continuously improved during the iteration process. The formula is (22) S402: The optimization process of the algorithm is divided into exploration and development two stages, in the exploration stage, first the selected in step S301 need to be optimized super parameter individual is divided into D groups, corresponding to the number of super parameters to be optimized needs to be selected; According to step S301, the selected hyperparameter set is , wherein the upper and lower limits of each hyperparameter are respectively: the number of convolution channels ; the Dropout random inactivation rate ; the learning rate of the optimizer ; the weight coefficients of Huber and MSE in the hybrid loss function ; the different size combinations of convolution kernels ; In order to facilitate the dream optimization algorithm search, the continuous parameters are normalized, and the minimum-maximum normalization method is adopted. For the hyperparameters , the formula is (23) wherein, is a normalized parameter, is a lower bound of the hyperparameter, is an upper bound of the hyperparameter; S403: In the exploration phase, the position of each individual is reset to the position of the best individual in the group in the previous iteration, and then a random position in dimension is selected dimension, denoted as and the position in these dimensions is updated, The calculation formula is: (24) wherein, denotes a group number, denotes a random integer selected from the range to , denotes the th group's forgetting dimension in the exploration phase, denotes the total dimension of the parameters to be optimized; S404: In each iteration, the update is performed from the first individual to the last individual in turn, is the total number of population individuals, and the specific update process is as follows: (1) Implement memory strategies, for the first Before optimization, each individual in the group remembers the position information of the best performer in the group and resets its own position information to match that of the best performer. The formula is as follows: (25) wherein, is the iteration number, is the position information of the best hyperparameter set individual in the th iteration, is the position information of the th hyperparameter set in the th iteration, is the position information of the best hyperparameter set individual in the (2) Execute the forgetting and supplement strategy: the forgetting and supplement strategy combines global and local search functions, allowing individuals to forget and self-organize location information in the forgetting dimension, and the formula is: (26) wherein, Among these dimensions, the individual forgets the best individual position information in the group and looks for a new position when optimizing, i.e. the forgetting dimension; denotes the iteration the first hyperparameter set in the first dimension, denotes the iteration the first hyperparameter set in the first dimension; and are the upper and lower bounds of the hyperparameter space searched in the first dimension, respectively; is a random number between 0 and 1; is the maximum total number of iterations set, is the maximum number of iterations set for the exploration phase; the parameter is used to adjust the proportion between the forgetting and replenishing strategy and the dream sharing strategy in the exploration phase, when the forgetting and replenishing strategy is executed, otherwise the dream sharing strategy is executed, and the setting ; (3) Execute the dream sharing strategy: the dream sharing strategy enhances the algorithm's ability to jump out of the local optimal solution. This strategy runs in parallel with the forgetting and supplement strategy, allowing individuals to randomly obtain location information from other individuals in the forgetting dimension, and the formula is (27) wherein, is a random integer selected from at each dimension when updating, represents the position of the th hyper-parameter set in the th dimension at the th iteration, the formula controls the search step to decrease with the iteration by the cosine function, achieving the purpose of large-scale exploration in the early stage and gradual convergence in the later stage. S405: development stage, is from to the iteration count, at this time no longer to perform grouping; this stage before each dream, the entire population to the population in the last iteration of the best individual, and then update each individual in the position of the forget dimension; in this stage all individuals in the population have the same number of forget dimension, from dimension, select forget dimension, recorded as , and update the position in these dimensions, the formula is: (28) (1) Implement memory strategies: ,in Indicates the first During the nth iteration Location information of each individual Indicates the first The location information of the best individual in the entire superpopulation during the next iteration; (2) Execute the forgetting and supplement strategy, and the formula is (29) wherein ; S406: considering the stability and adaptability of the algorithm, set the maximum number of iterations of the exploration stage The total number of iterations The relationship is set to That is, in the previous Iteration, the individual is updated by global search, and after exceeding the value, the algorithm switches to local development search. In the development stage, the search is around the current global optimal solution Fine-tuning, gradually approaching the optimal hyperparameter, updating the global optimal solution after each generation calculation. If the objective function Using a certain candidate hyperparameter set Is better, replace it with it When Or no significant improvement for several generations in a row, the algorithm stops and outputs the optimal hyperparameter combination ; S407: After the dream optimization algorithm converges, take the global optimal solution , and the original hyperparameter data can be used in the model, and the inverse normalization formula is (30) wherein, is the hyperparameter after denormalization, is the parameter that needs to be denormalized, is the lower bound of the hyperparameter, is the upper bound of the hyperparameter.
7. The carbon emission timing data prediction method of claim 6, wherein: The step S500 specifically comprises, S501, Process the carbon emission sample sequence from steps S100 and S200. The data is input into the Multi-Scale TCN model built by optimizing the optimal hyperparameter combination obtained by the DOA hyperparameter optimization function constructed in steps S300 and S400. The model uses 365 data points from the previous year to predict 365 data points from the next year. The model is trained and validated in cycles using an annual cyclic partitioning method, and the carbon emission data is predicted.
8. A computer readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor, so that the processor executes the steps of the method according to any one of claims 1 to 7. 9.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-8 when the computer program is executed by the processor. The computer program is executed by the processor, so that the processor executes the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for monitoring carbon emission of thermal power plant by excavating deep time dependence
CN118332431A
MMT-PMSLM dynamic performance modeling optimization method and device based on PI-GAN and medium
CN120671548A