Carbon prediction model optimization method based on data enhancement
Through the data-enhanced LSTM-VAE model and parallel computing technology, the problems of scarcity and inefficiency in the carbon prediction model are solved, and efficient carbon emission prediction and impact factor analysis are achieved.
Patent Information
- Application Number
- CN202510513643.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-08-01
AI Technical Summary
The existing carbon prediction models have scarce and uneven training samples, poor sample quality, a single model cannot adapt to the prediction needs of different types of enterprises and regions, the serial training process is inefficient, and insufficient computing resources are used.
Using a data augmentation method, the LSTM-VAE model is established by combining long and short-term memory networks and variational automatic encoders to enhance low-quality data, build a carbon prediction model with parallel computing, and use Joblib to perform parallel computing, optimize model training and inference process.
Improve data quality, optimize carbon prediction effect, realize accurate prediction of carbon emissions and efficient analysis of impact factors, and shorten model training and inference time.
Smart Images

Figure CN120409806A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of digital image processing, and particularly to an optimization method for a carbon prediction model based on data augmentation. Background Art
[0002] With the rapid development of new energy, more and more countries around the world attach importance to the demand and opportunities for the low-carbon transformation of the power system. Promoting the research on the carbon assessment system and technological innovation of the electricity-carbon coupling helps to identify the characteristics of the carbon role of electric energy and the emission reduction mechanism in all links, give full play to the advantages of power big data, and coordinate the promotion of the "dual control" of the total carbon emission and intensity with electricity as the link. It is the key to achieving the synergy between the carbon neutral goal of the power system and the high-quality economic development. Carbon prediction technology estimates carbon emissions through digital means, which can enhance the efficiency of power enterprises in carbon footprint management, assist enterprises and regions in reducing the economic burden of carbon emissions, accelerate the exploration and application of clean energy, reduce the dependence on fossil fuels, and thus catalyze the booming rise of the new energy industry, contributing to the realization of the green and low-carbon sustainable development vision.
[0003] The existing "electricity-carbon analysis model" mainly uses the autoregressive distributed lag model (ARDL) for power data, energy data, economic data, and official carbon emission data to make predictions based on the relationship between variables and their own lags and other factors.
[0004] However, the existing "electricity-carbon analysis model" has the following deficiencies in actual enterprise applications:
[0005] 1. The training samples of the carbon prediction model are often scarce and unbalanced, and the poor sample quality leads to limited model prediction ability;
[0006] 2. A single model cannot adapt to the prediction needs of different types of enterprises and regions;
[0007] 3. The serial training process and model deduction efficiency are low, resulting in insufficient utilization of computing resources. Summary of the Invention
[0008] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, an object of the present invention is to propose an optimization method for a carbon prediction model based on data augmentation. The main processes of this method include three technical links: data augmentation, construction of a carbon prediction model based on parallel computing, and model prediction. The main innovation lies in the data augmentation stage, where by combining a long short-term memory network and a variational autoencoder, an LSTM-VAE model is established to perform data augmentation processing on low-quality data, effectively improving the quality of data samples.
[0009] To this end, the present invention proposes an optimization method for a carbon prediction model based on data augmentation, including the following steps:
[0010] S1. Data Augmentation:
[0011] S1.1. Data Preprocessing: Preprocess the electro-carbon data of industries and regions, including normalizing data, creating a sliding window dataset, and dividing the dataset;
[0012] S1.2. Perform Data Augmentation Processing Based on LSTM-VAE: Establish an LSTM-VAE model by defining a VAE loss function including reconstruction loss and KL divergence loss, defining an encoder, defining a decoder, reparameterization, defining a complete model, and model training to enhance low-quality data;
[0013] S1.3. Merge the real data in S1.1 and the data generated by data augmentation in S1.2: Generate data verification and merge data;
[0014] S2. Build a Carbon Prediction Model Based on Parallel Computing:
[0015] S2.1. Feature Engineering Construction: Divide the dataset after data augmentation into a training set, a test set, and a validation set according to the ratio of 7:2:1, and use a model-based analysis method to construct feature engineering;
[0016] S2.2. Carbon Prediction Model Construction: Construct decision tree regression LightGBM, time series regression ARDL, linear regression LR, and Holt exponential smoothing method Holt prediction models;
[0017] S2.3. Model Training: Use Joblib for parallel computing to distribute the computing tasks of multiple models to different CPUs for parallel execution;
[0018] S3. Model Evaluation and Prediction:
[0019] S3.1. Model Evaluation: Use the deviation rate as the evaluation index and select the model with the smallest deviation rate value as the optimal model;
[0020] S3.2. Model Prediction: Load the trained model parameters according to the requirements or retrain for carbon prediction.
[0021] Preferably, in the data augmentation processing based on LSTM-VAE in S1.2, during reparameterization, a normal distribution random noise with the same shape as the mean vector of each point in the latent space needs to be generated from the mean vector of the latent space and the logarithmic variance vector of the latent space, and then the latent vector is calculated by adding the mean vector of the latent space and the random noise, where:
[0022] (a) Define the VAE loss function:
[0023] The loss function of the variational autoencoder usually consists of two parts: reconstruction loss and KL divergence loss;
[0024] The reconstruction loss formula is shown in Equation (1):
[0025]
[0026] In Equation (1), N is the number of samples; θ are the network weights and bias parameters; x i is the i-th input sample; z is the latent variable, which is obtained through neural network training; the conditional probability distribution p θ (x i |z) represents the probability of generating the observed data x i under the latent variable z; taking the logarithm, summing, and then averaging is to maximize the log-likelihood of the data, that is, to make the reconstructed samples as close as possible to the original input;
[0027] Reconstruction KL divergence loss: It is used to measure the difference between the latent variable distribution learned by VAE and the standard normal distribution. The smaller the KL loss, the closer the learned latent variable distribution is to the standard normal distribution, thereby improving the model generation ability; the KL divergence loss formula is as follows:
[0028]
[0029] In Equation (2), J is the dimension of the latent variable z, representing the number of features of each sample in the latent space; σ j is the standard deviation of the j-th dimension of the latent variable output by the encoder, and (σ j ) 2 is the variance, describing the distribution dispersion degree of this dimension; μ j is the mean of the j-th dimension of the latent variable output by the encoder, describing the central position of this dimension;
[0030] Define the total loss: The total loss is the sum of the reconstruction loss and the KL divergence loss, and is obtained by averaging the losses of all samples; the total loss function is minimized during training to simultaneously optimize the reconstruction quality and the regularization of the latent variable distribution;
[0031] L = L1 + L2 (3)
[0032] In Equation (3), L1 is the reconstruction loss term, such as formula (1); L2 is the KL divergence loss term, such as formula (2);
[0033] (b) Define the encoder
[0034] The encoder consists of an input layer, an LSTM layer, and a fully connected layer; the preprocessed data is input from the input layer, and then the input sequence undergoes feature extraction through two layers of LSTM, and then the extracted features are mapped to a low-dimensional latent space, which is parameterized by the mean and log variance;
[0035] (c) Define the decoder
[0036] The decoder includes: an input layer, a RepeatVector layer, an LSTM layer, and a TimeDistributed fully connected layer; the decoder accepts a vector in the latent space as input and passes it to the input layer. The RepeatVector layer matches the length of the input vector to the original input sequence, processes the sequence through two LSTM layers, and uses the TimeDistributed fully connected layer to generate the output sequence. Finally, the output sequence matches the original input sequence in terms of shape and feature dimensions.
[0037] (d) Reparameterization
[0038] The encoder outputs two vectors, namely the mean vector μ of the latent space and the log variance vector log(σ 2 ) of the latent space. Reparameterization first samples a random noise ε from a standard normal distribution N(0, I), where I is the identity matrix; then calculates the latent vector z through the mean vector μ, the standard deviation vector σ, and the random noise ε.
[0039] z = μ + σ ⊙ ε (4)
[0040] In Equation (4), z is the latent vector; μ is the mean vector; σ is the standard deviation vector; ⊙ represents element-wise multiplication; and ε is the random noise.
[0041] (e) Model training
[0042] Parameter settings include: input sequence length SEQ_LENGTH = 30, latent space dimension LATENT_DIM = 10, number of epochs EPOCHS = 100, batch size BATCH_SIZE = 32. After training the model, the data augmentation result is returned.
[0043] Preferably, in S2.2:
[0044] When constructing a LightGBM model for decision tree regression: First, initialize the LightGBM regressor. Calculate the importance based on the contribution of features in the model, i.e., importance_type = "gain". Define the parameter grid. For boosting_type, select "gbdt" and "goss". Uniformly select 5 values for learning_rate between "0.01" and "0.1". Select 4 values for the maximum depth of the tree max_depth from "3" to "7". The minimum number of samples required for each leaf node min_child_samples is from "1" to "2". Control the verbosity of the output to "-1" to suppress the output. Use GridSearchCV for parameter tuning, specify the scoring criterion as the negative mean absolute percentage error, and use 3-fold cross-validation to evaluate the performance of each parameter combination.
[0045] When constructing an ARDL model for time series regression: First, determine the endogenous variables, exogenous / supplementary variables, and add them to the model. Use the ardl_select_order function to select the best lag order of the autoregressive distributed lag ARDL model. The information criterion ic = "aic". Check whether there is autocorrelation in the residuals. Check whether there is heteroscedasticity.
[0046] When constructing a linear regression LR model: First, initialize the linear regression model with fit_intercept as "True". Use the training data to fit the linear regression model. Create a dictionary of feature coefficients. Update the dictionary to include the intercept term. Save the model and its related information.
[0047] When constructing a Holt forecasting model using Holt exponential smoothing: First, define the parameter grid. The range of smoothing_slope is from "0.8" to "1", and the range of smoothing_level is from "0.8" to "1.5". Use ParameterSampler for parameter sampling. Initialize the best parameters and error. Traverse the parameter list and evaluate the model. Train the Holt model according to the given parameters and return the error, test set evaluation results, and predicted values. Finally, update the minimum error and the best parameter combination.
[0048] Preferably, when performing model training in S2.3, first adopt the Joblib parallel execution mode to distribute the training tasks of different machine learning methods to multiple CPU cores for execution and train simultaneously. The specific steps are as follows:
[0049] S2.3.1. Create a class named TimeSeriesModel to encapsulate the logic related to time series analysis.
[0050] S2.3.2. Define the `__init__` method in the `TimeSeriesModel` class to initialize the instance;
[0051] S2.3.3. Inside this method, create an empty dictionary named `self.results` to store the results of parallel computing later;
[0052] S2.3.4. Define the `run_parallel` method in the `TimeSeriesModel` class to execute the above-defined machine learning methods in parallel;
[0053] S2.3.5. Define a list named `tasks`, where each element is a tuple containing the method object to be executed and the corresponding parameter dictionary;
[0054] S2.3.6. Use the `Parallel` and `delayed` functions of the `joblib` library to execute the tasks in parallel, specifying the number of parallel tasks `n_jobs = 2`;
[0055] The results of parallel execution are collected and converted into dictionary form, stored in `self.results`, and the method returns a dictionary containing all the results.
[0056] Preferably, in S3.1, the carbon emission measurement deviation rate MAPE needs to be used as the evaluation value, and the deviation rate formula is as follows:
[0057]
[0058] In Equation (5), n is the number of test samples; y i is the actual value of the i-th test sample; is the prediction result of the i-th test sample, obtained from the prediction model. Select the model with the smallest MAPE among the prediction results of the LightGBM, ARDL, LR, and Holt models as the optimal model, output the results, and save the model.
[0059] Preferably, in S3.2, it is necessary to load the trained model parameters or retrain for carbon prediction according to the requirements;
[0060] When predicting a single enterprise, read the model and directly calculate;
[0061] When performing carbon predictions for multiple enterprises, if the number of enterprises exceeds 100, parallel processing is performed.
[0062] The advantages of the present invention compared with the prior art are as follows:
[0063] An optimization method for a carbon prediction model based on data augmentation innovatively constructs a data augmentation model based on LSTM-VAE, making up for the deficiencies of poor power data and carbon prediction samples, improving data quality, and optimizing the effect of carbon prediction.
[0064] An optimization method for a carbon prediction model based on data augmentation, in view of the method for constructing an electricity-carbon measurement model from a macroscopic dimension and considering that the model needs to be compatible with main body data for multi-scenario measurement, this invention innovatively introduces other types of machine learning methods and feature engineering automatic construction methods on the basis of existing algorithms to achieve accurate prediction of carbon emissions and efficient analysis of its influencing factors.
[0065] An optimization method for a carbon prediction model based on data augmentation uses model inference with a parallel processing mechanism, and greatly shortens the model training and inference time through parallel processing technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0067] Figure 1 It is a flowchart of the method of the present invention;
[0068] Figure 2 It is a schematic diagram of the data augmentation model based on LSTM-VAE in the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0069] The following will describe in detail the embodiments of the present application. The examples of the embodiments are shown in the drawings, where the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions from beginning to end. The embodiments described below with reference to the drawings are exemplary and are only used to explain the present application and should not be construed as a limitation of the present application.
[0070] In the description of the present application, it should be noted that unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the internal communication of two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific circumstances.
[0071] The present invention will be further described in detail below with reference to the accompanying drawings.
[0072] As Figure 1 shown, an optimization method for a carbon prediction model based on data augmentation according to the present invention mainly includes three parts: data augmentation, construction of a carbon prediction model based on parallel computing, and model prediction. Each production part includes unique technical methods.
[0073] The specific process principle steps are as follows:
[0074] S1. Data augmentation
[0075] S1.1 Data preprocessing
[0076] Create a MinMaxScaler instance to perform linear normalization on the data, mapping the original values to the interval [0, 1]; load the original dataset, separately extract the numerical feature columns from the data frame, and perform the normalization calculation; define a sequence generation function, traverse with a sliding window, and divide the dataset.
[0077] S1.2 Data augmentation based on LSTM-VAE
[0078] The data augmentation model based on LSTM-VAE is as Figure 2 shown. First, call the encoder model to obtain its output (i.e., the latent variable), and then pass this latent variable value to the decoder model to obtain the reconstructed output. This reconstructed output will be used as the final output of the VAE model.
[0079] (a) Define the VAE loss function:
[0080] The loss function of the variational autoencoder usually consists of two parts: the reconstruction loss and the KL divergence loss; the reconstruction loss formula is as shown in Equation (1):
[0081]
[0082] In the formula, the observed data is N samples sampled from a random process. In the formula: z (i) is the latent variable value, x (i) is the observed value; the mean square error is used to measure the difference between the original input and the reconstructed output, and the reconstruction loss is reconstructed as shown in Equation (2):
[0083]
[0084] In Equation (2), N is the dimension of the data, x is the input data, and x decoded is the decoded data, and the mean square error is used as the reconstruction loss;
[0085] The reconstruction KL divergence loss formula is as follows:
[0086]
[0087] Define the total loss: The total loss is the sum of the reconstruction loss and the KL divergence loss, which is obtained by averaging the losses of all samples; then minimize the total loss function during training while optimizing the reconstruction quality and the regularization of the latent variable distribution.
[0088]
[0089] (b) Define the encoder
[0090] The encoder mainly consists of an input layer, an LSTM layer, and a fully connected layer; the preprocessed data is input from the input layer, and then the input sequence is subjected to feature extraction through two layers of LSTM, and the extracted features are mapped to a low-dimensional latent space, which is parameterized by the mean and log variance.
[0091] (c) Define the decoder
[0092] The decoder includes: an input layer, a RepeatVector layer, an LSTM layer, and a TimeDistributed fully connected layer; the decoder accepts a vector in the latent space as input and passes it to the input layer, the RepeatVector layer matches the length of the input vector to the original input sequence, performs sequence processing through two layers of LSTM, and uses the TimeDistributed fully connected layer to generate the output sequence, and finally the output sequence matches the original input sequence in shape and feature dimension.
[0093] (d) Reparameterization
[0094] Generate a random normal distribution noise with the same shape as the mean vector of each point in the latent space from the mean vector of the latent space and the log variance vector of the latent space, and then calculate the latent vector by combining the mean vector of the latent space and the random noise.
[0095] (e) Model training
[0096] Parameter settings include: input sequence length SEQ_LENGTH = 30, latent space dimension LATENT_DIM = 10, number of epochs EPOCHS = 100, batch size BATCH_SIZE = 32, and return the data augmentation result after training the model.
[0097] S1.3 Combine the real data and the data generated by data augmentation
[0098] (a) Verification of the rationality of the generated data
[0099] Check whether the statistical features (mean, variance, etc.) are similar. If the similarity of the generated data statistical features is greater than 85%, the generated data is reasonable. If the rationality test fails, the data is not added.
[0100] (b) Combine the real data and the data generated by data augmentation
[0101] The generated data that passes the rationality test and the real data are combined.
[0102] S2. Construction of a carbon prediction model based on parallel computing
[0103] S2.1 Feature engineering construction
[0104] Use decision trees, random forests or regularization methods to evaluate the importance of features, and automatically select important features or construct new features. Use polynomial regression, kernel methods, etc. to automatically perform feature transformation to capture non-linear relationships.
[0105] S2.2 Model design
[0106] (a) LightGBM: Initialize the LightGBM regressor, calculate the importance based on the contribution of features in the model, i.e., importance_type = "gain"; define the parameter grid, select "gbdt" and "goss" for boosting_type, uniformly take 5 values for learning_rate between "0.01" and "0.1", take 4 values for the maximum depth of the tree max_depth from "3" to "7", the minimum number of samples required for each leaf node min_child_samples is from "1" to "2", control the verbosity of the output to "-1" to suppress the output; use GridSearchCV for parameter tuning, specify the scoring criterion as the negative mean absolute percentage error, and use 3-fold cross-validation to evaluate the performance of each parameter combination.
[0107] (b) ARDL: Determine the endogenous variables, exogenous / supplementary variables, and add them to the model; use the ardl_select_order function to select the best lag order of the autoregressive distributed lag (ARDL) model; information criterion ic = "aic"; test whether there is autocorrelation in the residuals; test whether there is heteroscedasticity.
[0108] (c) LR: Initialize the linear regression model, with fit_intercept as "True"; use the training data to fit the linear regression model; create a dictionary of feature coefficients; update the dictionary to include the intercept term; save the model and its related information.
[0109] (d) Holt: Define the parameter grid with the smoothing_slope ranging from "0.8" to "1" and the smoothing_level ranging from "0.8" to "1.5"; use ParameterSampler for parameter sampling; initialize the best parameters and error; iterate through the parameter list and evaluate the model, train the Holt model with the given parameters and return the error, test set evaluation results, and predicted values, and finally update the minimum error and the best parameter combination.
[0110] S2.3 Model Training
[0111] Under the parallel execution mode of Joblib, distribute the training tasks of different machine learning methods to multiple CPU cores for execution and training simultaneously. The specific steps are as follows: Create a class named TimeSeriesModel to encapsulate the logic related to time series analysis; define the __init__ method in the TimeSeriesModel class to initialize the instance; inside this method, create an empty dictionary named self.results to store the results of parallel computing later; define the run_parallel method in the TimeSeriesModel class to execute the machine learning methods defined above in parallel; define a list named tasks, where each element is a tuple containing the method object to be executed and the corresponding parameter dictionary; use the Parallel and delayed functions of the joblib library to execute the tasks in parallel, specifying the number of parallel tasks n_jobs = 2; the results of parallel execution are collected and converted into dictionary form and stored in self.results, and the method returns the dictionary containing all the results.
[0112] S3 Model Evaluation and Prediction
[0113] S3.1 Model Evaluation
[0114] Take the carbon emission measurement deviation rate (MAPE) as the evaluation value, and the deviation rate formula is as follows:
[0115]
[0116] where is the predicted value and y is the actual value.
[0117] Select the model with the smallest deviation rate among multiple machine learning methods as the optimal model, output the results, and save the model.
[0118] S3.2 Model Prediction
[0119] The model prediction part mainly depends on whether training is required and whether to predict a single enterprise or multiple enterprises. If based on the prediction results of the existing model, the trained model is directly read for inference; otherwise, the model is retrained and predicted. When predicting a single enterprise, the model is read for direct calculation; when predicting the carbon emissions of multiple enterprises, if the number of enterprises exceeds 100, parallel processing is performed.
[0120] Finally, for the parts not described in the present invention, mature products and mature technical means in the prior art are adopted.
[0121] The present invention and its implementation manners have been described above. Such description is not restrictive. What is shown in the drawings is only one of the implementation manners of the present invention, and the actual structure is not limited thereto. All in all, if those of ordinary skill in the art are inspired by it and, without departing from the gist of the present invention, creatively design a structural manner and an embodiment similar to the technical solution, they shall fall within the protection scope of the present invention.
Claims
1. An optimization method for a carbon prediction model based on data augmentation, characterized in that, It includes the following steps: S1. Data augmentation: S1.
1. Data preprocessing: Preprocess the electro-carbon data of industries and regions, including normalizing data, creating a sliding window dataset, and dividing the dataset; S1.
2. Perform data augmentation processing based on LSTM-VAE: Establish an LSTM-VAE model by defining a VAE loss function including reconstruction loss and KL divergence loss, defining an encoder, defining a decoder, reparameterization, defining a complete model, and model training, and enhance low-quality data; S1.
3. Merge the real data in S1.1 and the data generated by data augmentation in S1.2: Generate data verification and merge data; S2. Build a carbon prediction model based on parallel computing: S2.
1. Feature engineering construction: Divide the dataset after data augmentation into a training set, a test set, and a validation set in a ratio of 7:2:1, and use a model-based analysis method to construct feature engineering; S2.
2. Carbon prediction model construction: Construct decision tree regression LightGBM, time series regression ARDL, linear regression LR, and Holt exponential smoothing method Holt prediction models; S2.
3. Model training: Use Joblib for parallel computing to distribute the computing tasks of multiple models to different CPUs for parallel execution; S3. Model evaluation and prediction: S3.
1. Model evaluation: Use the deviation rate as an evaluation index, and select the model with the smallest deviation rate value as the optimal model; S3.
2. Model prediction: Load the trained model parameters according to the requirements or retrain for carbon prediction.
2. The optimization method for a carbon prediction model based on data augmentation according to claim 1, characterized in that: In the data augmentation processing based on LSTM-VAE in S1.2, during reparameterization, a normal distribution random noise with the same shape as the mean vector of each point in the latent space needs to be generated from the mean vector of the latent space and the log variance vector of the latent space, and then the latent vector is calculated by combining the mean vector of the latent space and the random noise, where: (a) Define the VAE loss function: The loss function of the variational autoencoder usually consists of two parts: reconstruction loss and KL divergence loss; The reconstruction loss formula is shown in Equation (1): In Equation (1), N is the number of samples; θ are the network weights and bias parameters; x i is the i-th input sample; z is a latent variable trained through a neural network; the conditional probability distribution p θ (x i |z) represents the probability of generating the observed data x i under the latent variable z; taking the logarithm, summing, and then averaging are to maximize the log-likelihood of the data, that is, to make the reconstructed samples as close as possible to the original input; Reconstruction KL divergence loss: Used to measure the difference between the latent variable distribution learned by the VAE and the standard normal distribution. The smaller the KL loss, the closer the learned latent variable distribution is to the standard normal distribution, thereby improving the model generation ability; The KL divergence loss formula is as follows: In Equation (2), J is the dimension of the latent variable z, representing the number of features of each sample in the latent space; σ j is the standard deviation of the j-th dimension of the latent variable output by the encoder, (σ j ) 2 is the variance, describing the degree of distribution dispersion of this dimension; μ j is the mean of the j-th dimension of the latent variable output by the encoder, describing the central position of this dimension; Define the total loss: The total loss is the sum of the reconstruction loss and the KL divergence loss, and is obtained by averaging the losses of all samples; The total loss function is minimized during training to simultaneously optimize the reconstruction quality and the regularization of the latent variable distribution; L = L1 + L2 (3) In Equation (3), L1 is the reconstruction loss term, such as Equation (1); L2 is the KL divergence loss term, such as Equation (2); (b) Define the encoder The encoder consists of an input layer, an LSTM layer, and a fully connected layer; The preprocessed data is input from the input, and then the input sequence undergoes feature extraction through two layers of LSTM, and the extracted features are mapped to a low-dimensional latent space, which is parameterized by the mean and log variance; (c) Define the decoder The decoder includes: an input layer, a RepeatVector layer, an LSTM layer, and a TimeDistributed fully connected layer; the decoder accepts a vector in the latent space as input and passes it into the input layer. The RepeatVector layer matches the length of the input vector to the original input sequence, processes the sequence through two LSTM layers, and uses the TimeDistributed fully connected layer to generate the output sequence. Finally, the output sequence matches the original input sequence in terms of shape and feature dimensions. (d) Reparameterization The encoder outputs two vectors, namely the mean vector μ of the latent space and the log variance vector log(σ 2 ) of the latent space. The reparameterization first samples a random noise ε from a standard normal distribution N(0, I), where I is the identity matrix; then calculates the latent vector z through the mean vector μ, the standard deviation vector σ, and the random noise ε. z = μ + σ ⊙ ε (4) In Equation (4), z is the latent vector; μ is the mean vector; σ is the standard deviation vector; ⊙ represents element-wise multiplication; and ε is the random noise. (e) Model training The parameter settings include: the input sequence length SEQ_LENGTH = 30, the latent space dimension LATENT_DIM = 10, the number of epochs EPOCHS = 100, the batch size BATCH_SIZE = 32. After training the model, the data augmentation results are returned.
3. A method for optimizing a carbon prediction model based on data augmentation according to claim 1, characterized in that: In the above S2.2: When constructing the decision tree regression LightGBM model: first, initialize the LightGBM regressor, calculate the importance based on the contribution of features in the model, i.e., importance_type = "gain"; define the parameter grid, select "gbdt" and "goss" for boosting_type, uniformly take 5 values for learning_rate between "0.01" and "0.1", take 4 values for the maximum depth of the tree max_depth from "3" to "7", the minimum number of samples required for each leaf node min_child_samples is from "1" to "2", and control the verbosity of the output to "-1" to suppress the output; use GridSearchCV for parameter tuning, specify the scoring criterion as the negative mean absolute percentage error, and use 3-fold cross-validation to evaluate the performance of each parameter combination. When constructing the time series regression ARDL model: first, determine the endogenous variables, exogenous / supplementary variables, and add them to the model; use the ardl_select_order function to select the best lag order of the autoregressive distributed lag ARDL model; the information criterion ic = "aic"; test whether there is autocorrelation in the residuals; test whether there is heteroscedasticity. When constructing the linear regression LR model: first, initialize the linear regression model, with fit_intercept as "True"; use the training data to fit the linear regression model; create a dictionary of feature coefficients; update the dictionary to include the intercept term; save the model and its related information. When constructing the Holt exponential smoothing method Holt prediction model: First, define the parameter grid. The range of smoothing_slope is from "0.8" to "1", and the range of smoothing_level is from "0.8" to "1.5". Use ParameterSampler for parameter sampling. Initialize the best parameters and errors. Traverse the parameter list and evaluate the model. Train the Holt model according to the given parameters and return the error, test set evaluation results, and predicted values. Finally, update the minimum error and the best parameter combination.
4. A method for optimizing a carbon prediction model based on data augmentation according to claim 1, characterized in that: When performing model training in S2.3, first, in the parallel execution mode of Joblib, distribute the training tasks of different machine learning methods to multiple CPU cores for execution and training simultaneously. The specific steps are as follows: S2.3.
1. Create a class named TimeSeriesModel to encapsulate the logic related to time series analysis. S2.3.
2. Define the __init__ method in the TimeSeriesModel class to initialize the instance. S2.3.
3. Inside this method, create an empty dictionary named self.results to store the results of parallel computing later. S2.3.
4. Define the run_parallel method in the TimeSeriesModel class to execute the above-defined machine learning methods in parallel. S2.3.
5. Define a list named tasks, where each element is a tuple containing the method object to be executed and the corresponding parameter dictionary. S2.3.
6. Use the Parallel and delayed functions of the joblib library to execute the tasks in parallel, specifying the number of parallel tasks n_jobs = 2. S2.3.
7. The results of parallel execution are collected and converted into dictionary form, stored in self.results, and the method returns a dictionary containing all the results.
5. A method for optimizing a carbon prediction model based on data augmentation according to claim 1, characterized in that: In S3.1, the carbon emission measurement deviation rate MAPE needs to be used as the evaluation value. The deviation rate formula is as follows: In Equation (5), n is the number of test samples; y i is the actual value of the i-th test sample; is the predicted result of the i-th test sample, obtained from the prediction model. The model with the smallest MAPE among the prediction results of the LightGBM, ARDL, LR, and Holt models is taken as the optimal model, and the output result is saved along with the model.
6. The optimization method of a carbon prediction model based on data augmentation according to claim 1, wherein: In S3.2, it is necessary to load the trained model parameters according to the requirements or retrain for carbon prediction. When predicting a single enterprise, read the model and directly calculate. When performing carbon predictions for multiple enterprises, if the number of enterprises exceeds 100, parallel processing is performed.