Carbon emission model prediction cross validation and fusion optimization improvement system and method
By constructing multiple machine learning models and combining cross-validation and particle swarm optimization algorithms, the accuracy and stability issues of carbon emission prediction in the new energy vehicle and lithium battery industries were solved, achieving high-precision and efficient carbon emission prediction.
Patent Information
- Application Number
- CN202511512365.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-02-06
AI Technical Summary
Existing carbon emission prediction technologies suffer from insufficient prediction accuracy and poor stability in the new energy vehicle and lithium battery industries. They are unable to adapt to highly dynamic changes in energy consumption data and lack industry-specific optimization, making it difficult to effectively integrate the complementary advantages of multiple models.
A model is built using multiple machine learning algorithms, hyperparameters are optimized using cross-validation, and the parameter configurations of the base learner and meta-learner are adjusted using Stacking ensemble learning units and particle swarm optimization algorithm to form a fused and optimized prediction model.
It improves the accuracy and stability of carbon emission prediction, enhances the robustness and generalization ability of the model, and achieves high-precision and high-efficiency carbon emission prediction.
Smart Images

Figure CN121481564A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of carbon emission prediction technology, specifically to a carbon emission model prediction cross-validation and fusion optimization system and method. Background Technology
[0002] As the global goals of carbon peaking and carbon neutrality are further advanced, the accuracy and reliability of carbon emission predictions for the new energy vehicle and lithium battery industries, as key areas of energy transition, are crucial for energy conservation, emission reduction, and industry regulation. However, existing carbon emission prediction technologies mostly employ single algorithm models, such as regression models or neural networks. These methods are limited by inherent model biases and complex industry characteristics, often resulting in insufficient prediction accuracy and poor stability. They are also difficult to adapt to highly dynamic changes in energy consumption data. Although some studies have introduced various machine learning algorithms and attempted to improve performance through cross-validation and ensemble learning, there is still a lack of dedicated optimization for specific industries such as new energy vehicles and lithium batteries. This makes it impossible to effectively integrate the complementary advantages of multiple models to fully utilize data characteristics. Summary of the Invention
[0003] The purpose of this invention is to provide a carbon emission model prediction cross-validation and fusion optimization system and method. This invention achieves high-precision and stable prediction of carbon emissions in the new energy vehicle and lithium battery industries, and improves the accuracy and stability of carbon emission prediction.
[0004] To achieve this objective, the present invention provides a carbon emission model prediction cross-validation and fusion optimization improvement system, which includes: The model building module is used to build various types of prediction models based on preprocessed historical energy consumption data and corresponding historical carbon emission data; The cross-validation optimization module is used to divide the training set from the preprocessed historical energy consumption data and the corresponding historical carbon emission data. The hyperparameters of the various types of prediction models are optimized by cross-validation technology and combined with the training set to obtain the optimal hyperparameter set of each prediction model. The optimal hyperparameter set of each prediction model is used to obtain the corresponding optimized prediction model. The model fusion module uses a Stacking ensemble learning unit to divide all optimized prediction models into multiple base learners and a meta learner. Each base learner is trained on the training set to obtain a corresponding preliminary predicted carbon emission. The preliminary predicted carbon emissions of all base learners are combined with the training set to obtain a feature matrix. The meta learner is trained using the feature matrix, and the parameter configuration of the base learners and meta learners is dynamically adjusted during the training process using a particle swarm optimization algorithm, ultimately obtaining a fused and optimized prediction model.
[0005] Preferably, the specific method for obtaining preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: After processing missing values and standardizing the collected historical energy consumption data and corresponding historical carbon emission data, features with a correlation coefficient with carbon emissions higher than a set threshold are selected.
[0006] Preferably, the various types of prediction models include random forest models, support vector machine models, additive models, and gradient boosting models.
[0007] Preferably, the specific process of constructing a random forest model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. A random forest model, Random Forest, is constructed based on the sample set. S samples are randomly selected from the sample set to train the decision tree. At each node split, the optimal split point is selected according to the splitting criterion. The node is recursively split until the stopping condition is met. The final carbon emission prediction output by the random forest model is the average of the carbon emission predictions output by all decision trees, as shown in the following expression: in, This represents the predicted carbon emissions of the m-th decision tree, where M represents the number of decision trees. This represents the carbon emission prediction value of the random forest model.
[0008] Preferably, the specific process of constructing a support vector machine model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. A support vector machine model (SVR) is constructed based on the sample set. For a given sample set : in, This represents the first sample. Indicates the first One sample, Indicates the first Historical energy consumption data for each sample Indicates the first Historical carbon emission data for each sample Indicates that there are a total of One sample, express Historical energy consumption data of wei , Represents the set of real numbers; Sample set The least squares vector machine regression is represented as: in, This indicates that the objective function minimize, Describes the normal vector of the hyperplane. This represents the transpose of the normal vector of the hyperplane. For regularization terms, Indicates the penalty coefficient. Indicates the first The error between the predicted carbon emissions of a sample and historical carbon emissions data. Represents the loss function of the SVR model; As constraints, we can obtain the predicted carbon emissions. ; Represents the kernel function. Represents the bias vector; objective function Lagrange function The expression is: in, Represents the Lagrange multipliers; Using sample sets For the Lagrange function Find the partial derivatives and set them to zero to obtain the optimal parameters. and This allows us to obtain the final predicted carbon emissions and complete the SVR model.
[0009] Preferably, the specific process of constructing an additive model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. An additive model, XGBoost, is constructed based on the sample set. Using trees as base classifiers, and employing a greedy algorithm, we iteratively construct multiple decision tree ensemble models with minimum cost. The initial XGBoost model is represented as follows: in, Indicates sample The predicted carbon emissions M The number of decision trees. For the first m The decision tree ensemble model after the next iteration; When building to the th n A decision tree, making the loss function At its minimum, the XGBoost model expression is: in, Represents the regularization term, Represents the loss function; This yields the final predicted carbon emissions, thus completing the XGBoost model.
[0010] Preferably, the specific process of constructing a gradient boosting model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. A gradient boosting model LightGBM is constructed based on the sample set. First, establish an initial gradient boosting model, the expression... as follows: in, Let be the loss function for the initial gradient boosting model. Indicates the first Historical carbon emission data for each sample c Indicates the baseline value; In the current iteration round m, for each sample Calculate the pseudo residual of the loss function with respect to the current gradient boosting model predictions. r im : in, For the sample loss function, For the current gradient boosting model on the samples The predicted carbon emissions Indicates the first i One sample, loss function Regarding the current gradient boosting model for samples carbon emission forecast The partial derivatives, This indicates that the partial derivative is calculated at the carbon emission prediction value of the model after the (m-1)th iteration; Use the current gradient to boost the negative gradient of the model's predicted values. r im As the new target value, train a new regression tree model. h m (x) : in, This indicates that the regression tree model h represents the sample The predicted carbon emissions; Find the optimal step size using line search. r m : in, This indicates that after the (m-1)th iteration, the entire model has a high degree of understanding of the samples. The predicted carbon emissions This indicates that the m-th regression tree model is effective for the sample. The predicted carbon emissions Represents the optimization variable; Optimal step size r m Add ensemble model, ensemble model f m (x) The expression is as follows: in, v For learning rate, This represents the ensemble model after the (m-1)th iteration. Finally, the gradient boosting model is obtained. for: Gradient boosting model The final carbon emission forecast is obtained.
[0011] Preferably, a training set is drawn from the preprocessed historical energy consumption data and the corresponding historical carbon emission data. The hyperparameters of the various prediction models are then optimized using cross-validation techniques and the training set to obtain the optimal hyperparameter set for each prediction model. The specific process of obtaining the corresponding optimized prediction model using the optimal hyperparameter set for each prediction model is as follows: sample set The random forest model, support vector machine model, additive model, and gradient boosting model are randomly divided into training and test sets according to a preset ratio (which can be set to 9:1). Hyperparameters are then optimized using K-fold cross-validation and the training set. The training set is divided into K equal datasets. Each time, one dataset is selected from the K datasets as the validation set, and the remaining K-1 datasets are used as the training subset. For each prediction model, different hyperparameter combinations are used for training on the training subset. The error index of the prediction model under the corresponding hyperparameter combination is calculated using the validation set. After completing K iterations, the average error of each hyperparameter combination in K rounds of validation is calculated. The hyperparameter combination with the smallest average error is selected as the optimal hyperparameter set for the corresponding prediction model, thus obtaining the corresponding optimized prediction models.
[0012] Preferably, the specific process for obtaining the fused and optimized prediction model is as follows: Stacking ensemble learning units were used to compare and analyze the performance of the optimized random forest model, support vector machine model, additive model and gradient boosting model. The random forest model, additive model and gradient boosting model in all optimized prediction models were used as base learners, and the support vector machine model was used as meta learner. The historical carbon emission data of each sample in the training set is used as the real carbon emission label. Each base learner is trained independently using the training set to generate preliminary predicted carbon emissions. The preliminary predicted carbon emissions of all base learners are combined with the training set to form a feature matrix. The rows of the feature matrix correspond to the samples in the training set, and the columns correspond to the predicted values of all base learners. The real carbon emission labels of each sample in the training set are used as the training target of the meta-learner. The meta-learner performs supervised learning with the real carbon emission labels as the target through the feature matrix. Particle swarm optimization is performed simultaneously during the training process. The MAPE or RMSE of each base learner and meta-learner is used as the fitness function to adjust the parameter configuration of the corresponding base learner and meta-learner in real time, so as to minimize the error index of MAPE or RMSE of each base learner and meta-learner, thereby determining the optimal parameter configuration of each base learner and meta-learner, completing the particle swarm optimization, and obtaining the fused and optimized prediction model.
[0013] A method for cross-validation and fusion optimization of carbon emission model predictions includes the following steps: Various types of prediction models are constructed based on preprocessed historical energy consumption data and corresponding historical carbon emission data. A training set is divided from the preprocessed historical energy consumption data and the corresponding historical carbon emission data. The hyperparameters of the various types of prediction models are optimized by cross-validation and in combination with the training set to obtain the optimal hyperparameter set of each prediction model. The corresponding optimized prediction models are obtained by using the optimal hyperparameter set of each prediction model. Stacking ensemble learning units are used to divide all optimized prediction models into multiple base learners and one meta learner. Each base learner is trained on the training set to obtain the corresponding preliminary predicted carbon emissions. The preliminary predicted carbon emissions of all base learners are combined with the training set to obtain a feature matrix. The meta learner is trained using the feature matrix. During the training process, the parameter configuration of the base learners and meta learners is dynamically adjusted using the particle swarm optimization algorithm to finally obtain the fused and optimized prediction model.
[0014] The beneficial effects of this invention are: This invention integrates multiple machine learning models and employs cross-validation to optimize model hyperparameters. This not only avoids the inherent biases of a single model but also improves the stability of model training, enhancing the accuracy and robustness of carbon emission prediction. Furthermore, this invention utilizes Stacking ensemble learning units to combine the advantages of various base learners and meta-learners, performing fusion analysis on the prediction results to effectively reduce overall error. Finally, by introducing particle swarm optimization (PSO) to automatically adjust the parameter configurations of base and meta-learners, this invention improves parameter tuning efficiency, enabling the model to quickly adapt to complex data. Ultimately, this achieves high-precision, high-efficiency carbon emission prediction, enhancing its accuracy and stability. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of the structure of the present invention; Figure 2 This is a flowchart of the present invention; Figure 3 The carbon emission prediction curves for the new energy vehicle industry are based on the gradient boosting model LightGBM, the additive model XGBoost, the random forest model RF, and the support vector machine model SVR, respectively. Figure 4 The carbon emission prediction results for a single model in the new energy vehicle industry; Figure 5 The figure shows the carbon emission prediction results of the PSO-Stacking model in the new energy vehicle industry. Figure 6 The carbon emission prediction curves for the lithium battery industry are based on the gradient boosting model LightGBM, the additive model XGBoost, the random forest model RF, and the support vector machine model SVR, respectively. Figure 7 The carbon emission prediction results for a single model in the lithium battery industry; Figure 8 The carbon emission prediction results for the PSO-Stacking model in the lithium battery industry. Detailed Implementation
[0016] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments: Example 1 A carbon emission model prediction cross-validation and fusion optimization system, such as Figure 1 As shown, it includes: The model building module is used to build various types of prediction models based on preprocessed historical energy consumption data and corresponding historical carbon emission data. This design achieves comprehensive capture of multi-dimensional features of historical energy consumption data and corresponding historical carbon emission data by building various types of prediction models (such as random forest model, support vector machine model, additive model and gradient boosting model), which can improve the prediction model's ability to represent complex energy consumption patterns. The cross-validation optimization module is used to divide the training set from the preprocessed historical energy consumption data and the corresponding historical carbon emission data. By using cross-validation technology and combining the training set, the hyperparameters of the various types of prediction models are optimized to obtain the optimal hyperparameter set for each prediction model. The optimal hyperparameter set of each prediction model is used to obtain the corresponding optimized prediction models. This design divides the training set into K parts using K-fold cross-validation technology, and takes the average error as the evaluation index after K iterations. This reduces the variance caused by the randomness of a single data partitioning. Through multiple training iterations, the prediction model is prevented from underfitting or overfitting, which can significantly improve the robustness and generalization ability of the prediction model and avoid evaluation bias caused by the randomness of data partitioning. The model fusion module employs a Stacking ensemble learning unit (a high-level ensemble learning method that fuses multiple optimized prediction models through a hierarchical learning architecture to generate a powerful fused prediction model). This module divides all optimized prediction models into multiple base learners and a meta-learner. Each base learner is trained on the training set to obtain a preliminary predicted carbon emission. The preliminary predicted carbon emissions from all base learners are combined with the training set to obtain a feature matrix. The meta-learner is trained using this feature matrix, and during training, the particle swarm optimization algorithm dynamically adjusts the parameter configurations of the base and meta-learners. This ultimately yields the fused and optimized prediction model. This design, through the hierarchical learning mechanism of the Stacking ensemble learning unit, effectively reduces the systematic error of a single model. By using MAPE or RMSE as the fitness function, PSO adjusts the parameter configurations of the base and meta-learners in real time, avoiding local optima and ensuring that the fused and optimized prediction model reaches the globally optimal configuration.
[0017] The specific method for obtaining preprocessed historical energy consumption data and corresponding historical carbon emission data in the above technical solution is as follows: After processing the collected historical energy consumption data and corresponding historical carbon emission data by handling missing values (using imputation or deletion methods) and standardization, features with a correlation coefficient with carbon emissions higher than a set threshold (the set threshold ranges from 0.5 to 0.7, and can be set to 0.7) are selected. The above design, through missing value processing, standardization, and feature selection, can ensure data integrity, and removing redundant features can avoid the prediction model from over-relying on irrelevant variables. The specific process of the standardization process is as follows: Z-score standardization transforms the original data (after handling missing values) into a distribution with a mean of 0 and a standard deviation of 1, as shown in the following formula: in, This represents the original historical energy consumption data and the corresponding historical carbon emission data. This represents the average of the original historical energy consumption data and the corresponding historical carbon emission data. This represents the standard deviation of the original historical energy consumption data and the corresponding historical carbon emission data. This represents standardized historical energy consumption data and corresponding historical carbon emission data.
[0018] In the above technical solution, the various types of prediction models include random forest models, support vector machine models, additive models, and gradient boosting models. The above design integrates random forest models, support vector machine models, additive models (such as XGBoost), and gradient boosting models (such as LightGBM) to more comprehensively capture the complex nonlinear relationship between historical energy consumption data and historical carbon emission data, reduce the bias and overfitting risk of a single model, and achieve high-precision prediction.
[0019] In the above technical solution, the specific process of constructing a random forest model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. A random forest model, Random Forest, is constructed based on the sample set. S samples are randomly selected from the sample set to train the decision tree. At each node split, the optimal split point is selected according to the splitting criterion. The node is split recursively until the stopping condition is met (the stopping condition is reaching the maximum depth or the number of node samples is less than a set value (the set value is determined by K-fold cross-validation)). The final carbon emission prediction value output by the random forest model is the average of the carbon emission prediction values output by all decision trees, as expressed below: in, This represents the predicted carbon emissions of the m-th decision tree, where M represents the number of decision trees. This represents the carbon emission prediction value of the random forest model. The above design effectively reduces the risk of overfitting or bias that may exist in a single decision tree by averaging the output of multiple decision trees, making the carbon emission prediction results closer to the real carbon emission value (i.e., historical carbon emission data), and improving the accuracy, stability and generalization ability of carbon emission prediction.
[0020] In the above technical solution, the specific process of constructing a support vector machine model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. A support vector machine model (SVR) is constructed based on the sample set. For a given sample set : in, This represents the first sample. Indicates the first One sample, Indicates the first Historical energy consumption data for each sample Indicates the first Historical carbon emission data for each sample Indicates that there are a total of One sample, express Historical energy consumption data of wei , Represents the set of real numbers; Sample set The least squares vector machine regression is represented as: in, This indicates that the objective function minimize, Describes the normal vector of the hyperplane. This represents the transpose of the normal vector of the hyperplane. For regularization terms, Indicates the penalty coefficient. Indicates the first The error between the predicted carbon emissions of a sample and historical carbon emissions data. Represents the loss function of the SVR model; As constraints, we can obtain the predicted carbon emissions. ; Represents the kernel function. Represents the bias vector; objective function Lagrange function The expression is: in, Represents the Lagrange multipliers; Using sample sets For the Lagrange function Find the partial derivatives and set them to zero to obtain the optimal parameters. and This allows us to obtain the final carbon emission prediction value and complete the SVR model. The above design, by constructing a high-precision support vector machine model with strong generalization ability, can effectively capture the complex patterns of carbon emissions from complex historical energy consumption data, thereby improving the accuracy and reliability of carbon emission prediction results.
[0021] In the above technical solution, the specific process of constructing an additive model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. An additive model, XGBoost, is constructed based on the sample set. Using trees as base classifiers, and employing a greedy algorithm, we iteratively construct multiple decision tree ensemble models with minimum cost. The initial XGBoost model is represented as follows: in, Indicates sample The predicted carbon emissions M The number of decision trees. For the first m The decision tree ensemble model after the next iteration; When building to the th n A decision tree, making the loss function At its minimum, the XGBoost model expression is: in, Represents the regularization term, Represents the loss function; This yields the final predicted carbon emissions, completing the XGBoost model. The above design, through iterative construction and regularization optimization of the additive XGBoost model, can improve the generalization ability and stability of the prediction model, achieving high-precision prediction of carbon emissions.
[0022] In the above technical solution, the specific process of constructing a gradient enhancement model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. A gradient boosting model LightGBM is constructed based on the sample set. First, establish an initial gradient boosting model, the expression... as follows: in, Let be the loss function for the initial gradient boosting model. Indicates the first Historical carbon emission data for each sample c Indicates the baseline value; In the current iteration round m, for each sample Calculate the pseudo residual of the loss function with respect to the current gradient boosting model predictions. r im : in, For the sample loss function, For the current gradient boosting model on the samples The predicted carbon emissions Indicates the first i One sample, loss function Regarding the current gradient boosting model for samples carbon emission forecast The partial derivatives, This indicates that the partial derivative is calculated at the carbon emission prediction value of the model after the (m-1)th iteration; Use the current gradient to boost the negative gradient of the model's predicted values. r im As the new target value, train a new regression tree model. h m (x) : in, This indicates that the regression tree model h represents the sample The predicted carbon emissions; Find the optimal step size using line search. r m : in, This indicates that after the (m-1)th iteration, the entire model has a high degree of understanding of the samples. The predicted carbon emissions This indicates that the m-th regression tree model is effective for the sample. The predicted carbon emissions Represents the optimization variable; Optimal step size r m Add ensemble model, ensemble model f m (x) The expression is as follows: in, v For learning rate, This represents the ensemble model after the (m-1)th iteration. Finally, the gradient boosting model is obtained. for: Gradient boosting model The final carbon emission prediction value is obtained. In the above design, the gradient boosting model starts from the initial baseline value, calculates the pseudo residual (negative gradient) of the loss function in each iteration, and trains a new regression tree with this as the target. After determining the optimal step size through line search, the ensemble model is updated, so that the gradient boosting model can continuously reduce the prediction error and gradually approach the real carbon emission value. The final output of the gradient boosting model is the weighted sum of the prediction values of all weak learners, which ensures the stability and reliability of the carbon emission prediction results.
[0023] In the above technical solution, a training set is divided from the preprocessed historical energy consumption data and the corresponding historical carbon emission data. The hyperparameters of the various prediction models are optimized using cross-validation techniques and the training set to obtain the optimal hyperparameter set for each prediction model. The specific process of obtaining the corresponding optimized prediction model using the optimal hyperparameter set for each prediction model is as follows: sample set The random forest model, support vector machine model, additive model, and gradient boosting model are randomly divided into training and test sets according to a preset ratio. Hyperparameter optimization is then performed on these models using K-fold cross-validation and in conjunction with the training set. The hyperparameter set of the random forest model includes the learning rate, maximum tree depth, number of leaf nodes, and minimum number of data points in a leaf node. The hyperparameter set of the support vector machine model includes the learning rate, split threshold (gamma), maximum tree depth, minimum child weight, subsample ratio, and colsample bytree ratio. The hyperparameter set of the additive model includes the minimum number of samples for node splitting (min_sample_split), maximum tree depth, and number of weak learners (n_estimators). The hyperparameter set of the gradient boosting model includes the radial basis function, penalty coefficient, kernel function coefficient, and epsilon (insensitive loss parameter). The training set is divided into K equal parts. Each time, one part is selected from the K parts as the validation set, and the remaining K-1 parts are used as the training subset. For each prediction model, different combinations of hyperparameters are used for training on the training subset. The error index of the prediction model under the corresponding hyperparameter combination is calculated using the validation set. After K iterations, the average error of each hyperparameter combination in K rounds of validation is calculated. The hyperparameter combination with the smallest average error is selected as the optimal hyperparameter set for the corresponding prediction model, thus obtaining the corresponding optimized prediction models. The above design optimizes the hyperparameters of multiple prediction models using K-fold cross-validation technology, ensuring that each prediction model achieves the best performance on the training data. This improves the accuracy, robustness, and generalization ability of the carbon emission prediction model, and automates the hyperparameter search process, thereby improving the efficiency of model development.
[0024] In the above technical solution, the specific process of obtaining the fused and optimized prediction model is as follows: Stacking ensemble learning units were used to compare and analyze the performance of the optimized random forest model, support vector machine model, additive model and gradient boosting model. The random forest model, additive model and gradient boosting model in all optimized prediction models were used as base learners, and the support vector machine model was used as meta learner. Historical carbon emission data for each sample in the training set serves as the true carbon emission label. Each base learner is trained independently using the training set to generate preliminary carbon emission predictions. The preliminary carbon emission predictions from all base learners are combined with the training set to form a feature matrix. Rows of the feature matrix correspond to samples in the training set, and columns correspond to the predicted values of all base learners. The true carbon emission labels for each sample in the training set are used as the training target for the meta-learner. The meta-learner performs supervised learning using the feature matrix with the true carbon emission labels as the target, and particle swarm optimization (PSO) is performed simultaneously during training. The MAPE (Mean Absolute Percentage Error) or RMSE (Root Mean Square) of each base learner and meta-learner is used to measure the deviation between predicted and actual carbon emissions, expressed as a percentage. The abbreviation for Error, or Root Mean Square Error (RMSE), is an absolute error metric used to measure the square root of the average of the squared errors in carbon emission prediction (emphasizing the penalty for larger errors). As a fitness function, it adjusts the parameter configurations of the base learners and meta-learners in real time to minimize the error indices (MAPE or RMSE) of each base learner and meta-learner, thereby determining the optimal parameter configurations for each base learner and meta-learner, completing particle swarm optimization, and obtaining a fused and optimized prediction model. The base learners with the optimal parameter configurations in the fused and optimized prediction model are trained to obtain optimized predicted carbon emissions. These optimized predicted carbon emissions are combined with the training set to form an optimized feature matrix. The meta-learners with the optimal parameter configurations learn from this optimized feature matrix to obtain the final predicted carbon emissions. In the fused and optimized prediction model... The base learner with optimal parameter configuration is trained to obtain optimized predicted carbon emissions. The optimized predicted carbon emissions are combined with the training set to form an optimized feature matrix. The meta-learner with optimal parameter configuration learns from the optimized feature matrix to obtain the final predicted carbon emissions. The above design employs a stacking ensemble learning unit to design a multi-level learning and prediction fusion, enabling the prediction model to capture the complex nonlinear patterns between historical energy consumption data and historical carbon emission data, reducing the bias of a single model and outputting more accurate carbon emission prediction results. Particle swarm optimization is used to ensure that the prediction model parameters are globally optimal, avoiding the subjectivity of manual parameter tuning and the problem of local optima, improving the stability and efficiency of the prediction model. Through the combination of stacking ensemble learning unit and particle swarm optimization, a fused and optimized prediction model is finally obtained. The specific process of using the MAPE or RMSE of each base learner and meta learner as a fitness function to adjust the parameter configuration of the corresponding base learner and meta learner in real time, so as to minimize the error index of the MAPE or RMSE of each base learner and meta learner, and thus determine the optimal parameter configuration of each base learner and meta learner, is as follows: Initialize the particle swarm, where each particle represents a parameter configuration vector in the base learner and meta-learner. The initial position and initial velocity of each particle are randomly generated, but must be constrained within a reasonable range of parameters (e.g., the sum of weights is 1). For each particle, use the parameter configuration corresponding to that particle to train the base learner and meta-learner. Calculate the performance of the fitness function (MAPE or RMSE) on the validation set. In each iteration, the particle updates its position and velocity based on its individual historical best and the swarm's global best, obtaining a new parameter configuration. Train the base learner and meta-learner with the new parameter configuration, calculate the value of the fitness function, and compare the current fitness function value with the value of the fitness function when the particle was historically best. If the current fitness function value is less than the value of the fitness function when the particle was historically best, then update the particle's historical best. Select the global best from all particles, i.e., the parameter configuration corresponding to the minimum value of the fitness function, thereby determining the optimal parameter configuration for each base learner and meta-learner.
[0025] Example 2 A method for cross-validation and fusion optimization of carbon emission model predictions, such as... Figure 2 As shown, multiple prediction models are constructed based on preprocessed historical energy consumption data and corresponding historical carbon emission data. By dividing the training set and applying cross-validation technology, the optimal hyperparameter set of each prediction model and each optimized prediction model are obtained. Stacking ensemble learning is used to divide all optimized prediction models into base learners and meta learners. The base learners are trained on the training set to obtain preliminary carbon emission predictions and combine them into a feature matrix. The meta learners are trained on the feature matrix, and the parameter configuration of the base learners and meta learners is dynamically adjusted using the particle swarm optimization algorithm to finally obtain the fused and optimized prediction model.
[0026] The specific methods for cross-validation and fusion optimization of carbon emission model predictions include the following steps: Various types of prediction models are constructed based on preprocessed historical energy consumption data and corresponding historical carbon emission data. A training set is divided from the preprocessed historical energy consumption data and the corresponding historical carbon emission data. The hyperparameters of the various types of prediction models are optimized by cross-validation and in combination with the training set to obtain the optimal hyperparameter set of each prediction model. The corresponding optimized prediction models are obtained by using the optimal hyperparameter set of each prediction model. Stacking ensemble learning units are used to divide all optimized prediction models into multiple base learners and one meta learner. Each base learner is trained on the training set to obtain the corresponding preliminary predicted carbon emissions. The preliminary predicted carbon emissions of all base learners are combined with the training set to obtain a feature matrix. The meta learner is trained using the feature matrix. During the training process, the parameter configuration of the base learners and meta learners is dynamically adjusted using the particle swarm optimization algorithm to finally obtain the fused and optimized prediction model.
[0027] Example 3 Carbon emission forecasting for the new energy vehicle industry: This example studies cross-validation techniques for various data-driven carbon emission prediction methods. The initial hyperparameter sets for the gradient boosting model LightGBM, the additive model XGBoost, the random forest model RF, and the support vector machine model SVR, applicable to the new energy vehicle industry, and the optimal hyperparameter sets optimized using cross-validation techniques (K-fold cross-validation, or K-CV for short) are as follows: Figure 3 The figures show the carbon emission prediction curves for the new energy vehicle industry based on the gradient boosting model LightGBM, the additive model XGBoost, the random forest model RF, and the support vector machine model SVR, respectively. The prediction error indices for the new energy vehicle industry based on different models are as follows: For the new energy vehicle industry, as shown in the table above, when searching for hyperparameters of LightGBM, XGBoost, RF, and SVR using K-fold cross-validation, XGBoost showed the best prediction performance, while LightGBM showed the worst.
[0028] In this example, we study the prediction model fusion optimization technique for carbon emission prediction methods driven by electricity data. We employ the Stacking ensemble learning method to obtain a Stacking model, and then introduce the Particle Swarm Optimization (PSO) algorithm to optimize the Stacking model, resulting in a PSO-Stacking model. (1) Data preprocessing: Data on electricity consumption, natural gas consumption, and diesel consumption involved in the production of new energy vehicles were collected and preprocessed to ensure data quality and consistency.
[0029] (2) Divide the training set and the test set: Based on the size of the data, the training set and the test set are randomly divided according to a certain ratio (e.g., 9:1) to ensure the effectiveness of model training and validation.
[0030] (3) Model training: K-fold cross-validation was used to optimize the hyperparameters of LightGBM, XGBoost, RF, and SVR. The Stacking model was trained by using LightGBM, XGBoost, and RF as base learners and SVR as meta learner through Stacking ensemble learning. Particle swarm optimization (PSO) was performed on the Stacking model, and MAPE or RMSE error was used as the error index. The model was iteratively trained until the fused and optimized prediction model (PSO-Stacking model) was obtained.
[0031] (4) Performance evaluation: The prediction accuracy of the fused and optimized prediction model (PSO-Stacking model) was evaluated using a test set. The superiority of the PSO-Stacking model in carbon emission prediction for the new energy vehicle industry was verified by comparing the unoptimized single model with the Stacking model. Figure 4 The image shows the carbon emission prediction results for a single model in the new energy vehicle industry. Figure 5 The figure shows the carbon emission prediction results of the PSO-Stacking model in the new energy vehicle industry.
[0032] The prediction error metrics for the PSO-Stacking model in the new energy vehicle industry are as follows: As shown in the table, the PSO-Stacking model significantly improves upon other single models and the unoptimized Stacking model in both key evaluation metrics, MAPE and RMSE. Specifically, compared to the best-performing SVR model, the PSO-Stacking model reduces MAPE by 2.93% and RMSE by 29.67 tons; compared to the unoptimized Stacking model, the PSO-Stacking model reduces MAPE by 2.53% and RMSE by 21.77 tons. This indicates that PSO optimization not only improves the predictive power of the PSO-Stacking model but also enhances its robustness and generalization ability.
[0033] Example 4 Carbon emission forecasting for the lithium battery industry: This example studies cross-validation techniques for various data-driven carbon emission prediction methods. The initial hyperparameter sets for the gradient boosting model LightGBM, the additive model XGBoost, the random forest model RF, and the support vector machine model SVR, applicable to the lithium battery industry, and the optimal hyperparameter sets optimized using cross-validation techniques (K-fold cross-validation, or K-CV) are as follows: Figure 6 The figures show the carbon emission prediction curves for the lithium battery industry based on the gradient boosting model LightGBM, the additive model XGBoost, the random forest model RF, and the support vector machine model SVR, respectively. The prediction error metrics for the lithium battery industry based on different models are as follows: For the lithium battery industry, as shown in the table above, using K-fold cross-validation to search for hyperparameters of LightGBM, XGBoost, RF, and SVR, XGBoost showed the best prediction performance, while LightGBM showed the worst. Although XGBoost performed best in MAPE (5.4021%), its RMSE (665.37) was higher than RF's RMSE (488.21). This is mainly because RMSE is more sensitive to larger prediction errors and may be affected by a few outliers or extreme values, while MAPE better reflects the overall relative error. Therefore, although XGBoost has better relative accuracy in most samples, larger errors on some samples lead to a higher RMSE.
[0034] In this example, we study the prediction model fusion optimization technique for carbon emission prediction methods driven by electricity data. We employ the Stacking ensemble learning method to obtain a Stacking model, and then introduce the Particle Swarm Optimization (PSO) algorithm to optimize the Stacking model, resulting in a PSO-Stacking model. (1) Data preprocessing: Data on electricity and natural gas consumption involved in lithium battery production were compiled and preprocessed to ensure data quality and consistency.
[0035] (2) Divide the training set and the test set: Based on the size of the data, the training set and the test set are randomly divided according to a certain ratio (e.g., 9:1) to ensure the effectiveness of model training and validation.
[0036] (3) Model training: K-fold cross-validation was used to optimize the hyperparameters of LightGBM, XGBoost, RF, and SVR. The Stacking model was trained by using LightGBM, XGBoost, and RF as base learners and SVR as meta learner through Stacking ensemble learning. Particle swarm optimization (PSO) was performed on the Stacking model, and MAPE or RMSE error was used as the error index. The model was iteratively trained until the fused and optimized prediction model (PSO-Stacking model) was obtained.
[0037] (4) Performance evaluation: The prediction accuracy of the fused and optimized prediction model (PSO-Stacking model) was evaluated using a test set. The superiority of the PSO-Stacking model in predicting carbon emissions in the lithium battery industry was verified by comparing the unoptimized single model with the Stacking model. Figure 7 The image shows the carbon emission prediction results for a single model in the lithium battery industry. Figure 8 The figure shows the carbon emission prediction results of the PSO-Stacking model for the lithium battery industry.
[0038] The prediction error metrics for the PSO-Stacking model in the new energy vehicle industry are as follows: As shown in the table, the PSO-Stacking model significantly improves upon other single models and the unoptimized Stacking model in both key evaluation metrics, MAPE and RMSE. Specifically, compared to the best-performing SVR model, the PSO-Stacking model reduces MAPE by 1.63% and RMSE by 947.85 tons; compared to the unoptimized Stacking model, the PSO-Stacking model reduces MAPE by 0.46% and RMSE by 230.67 tons. This indicates that PSO optimization not only improves the predictive power of the PSO-Stacking model but also enhances its robustness and generalization ability.
[0039] The contents not described in detail in this specification are existing technologies known to those skilled in the art.
Claims
1. A carbon emission model prediction cross-validation and fusion optimization system, characterized in that, It includes: The model building module is used to build various types of prediction models based on preprocessed historical energy consumption data and corresponding historical carbon emission data; The cross-validation optimization module is used to divide the training set from the preprocessed historical energy consumption data and the corresponding historical carbon emission data. The hyperparameters of the various types of prediction models are optimized by cross-validation technology and combined with the training set to obtain the optimal hyperparameter set of each prediction model. The optimal hyperparameter set of each prediction model is used to obtain the corresponding optimized prediction model. The model fusion module uses a Stacking ensemble learning unit to divide all optimized prediction models into multiple base learners and a meta learner. Each base learner is trained on the training set to obtain a corresponding preliminary predicted carbon emission. The preliminary predicted carbon emissions of all base learners are combined with the training set to obtain a feature matrix. The meta learner is trained using the feature matrix, and the parameter configuration of the base learners and meta learners is dynamically adjusted during the training process using a particle swarm optimization algorithm, ultimately obtaining a fused and optimized prediction model.
2. The carbon emission model prediction cross-validation and fusion optimization system according to claim 1, characterized in that: The specific method for obtaining preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: After processing missing values and standardizing the collected historical energy consumption data and corresponding historical carbon emission data, features with a correlation coefficient with carbon emissions higher than a set threshold are selected.
3. The carbon emission model prediction cross-validation and fusion optimization system according to claim 1, characterized in that: The various types of prediction models include random forest models, support vector machine models, additive models, and gradient boosting models.
4. The carbon emission model prediction cross-validation and fusion optimization system according to claim 3, characterized in that: The specific process of constructing a random forest model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. A random forest model, Random Forest, is constructed based on the sample set. S samples are randomly selected from the sample set to train the decision tree. At each node split, the optimal split point is selected according to the splitting criterion. The node is recursively split until the stopping condition is met. The final carbon emission prediction output by the random forest model is the average of the carbon emission predictions output by all decision trees, as shown in the following expression: in, This represents the predicted carbon emissions from the m-th decision tree, where M represents the number of decision trees. This represents the carbon emission prediction value of the random forest model.
5. The carbon emission model prediction cross-validation and fusion optimization system according to claim 3, characterized in that: The specific process of constructing a support vector machine model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. A support vector machine model (SVR) is constructed based on the sample set. For a given sample set : in, This represents the first sample. Indicates the first One sample, Indicates the first Historical energy consumption data for each sample Indicates the first Historical carbon emission data for each sample Indicates that there are a total of One sample, express Historical energy consumption data of wei , Represents the set of real numbers; Sample set The least squares vector machine regression is represented as: in, This indicates that the objective function minimize, Describes the normal vector of the hyperplane. This represents the transpose of the normal vector of the hyperplane. For regularization terms, Indicates the penalty coefficient. Indicates the first The error between the predicted carbon emissions of a sample and historical carbon emissions data. Represents the loss function of the SVR model; As constraints, we can obtain the predicted carbon emissions. ; Represents the kernel function. Represents the bias vector; objective function Lagrange function The expression is: in, Represents the Lagrange multipliers; Using sample sets For the Lagrange function Find the partial derivatives and set them to zero to obtain the optimal parameters. and This allows us to obtain the final predicted carbon emissions and complete the SVR model.
6. The carbon emission model prediction cross-validation and fusion optimization system according to claim 3, characterized in that: The specific process of constructing an additive model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. An additive model, XGBoost, is constructed based on the sample set. Using trees as base classifiers, and employing a greedy algorithm, we iteratively construct multiple decision tree ensemble models with minimum cost. The initial XGBoost model is represented as follows: in, Indicates sample The predicted carbon emissions M The number of decision trees. For the first m The decision tree ensemble model after the next iteration; When building to the th n A decision tree, making the loss function At its minimum, the XGBoost model expression is: in, Represents the regularization term, Represents the loss function; This yields the final predicted carbon emissions, thus completing the XGBoost model.
7. The carbon emission model prediction cross-validation and fusion optimization system according to claim 3, characterized in that: The specific process of constructing a gradient boosting model based on preprocessed historical energy consumption data and corresponding historical carbon emission data is as follows: A set of preprocessed historical energy consumption data and its corresponding historical carbon emission data constitutes a sample. A gradient boosting model, LightGBM, is constructed based on the sample set. First, establish an initial gradient boosting model, the expression... as follows: in, Let be the loss function for the initial gradient boosting model. Indicates the first Historical carbon emission data for each sample c Indicates the baseline value; In the current iteration round m, for each sample Calculate the pseudo residual of the loss function with respect to the current gradient boosting model predictions. r im : in, For the sample loss function, For the current gradient boosting model on the samples The predicted carbon emissions Indicates the first i One sample, loss function Regarding the current gradient boosting model for samples carbon emission forecasts The partial derivatives, This indicates that the partial derivative is calculated at the carbon emission prediction value of the model after the (m-1)th iteration; Use the current gradient to boost the negative gradient of the model's predicted values. r im As the new target value, train a new regression tree model. h m (x) : in, This indicates that the regression tree model h represents the sample The predicted carbon emissions; Find the optimal step size using line search. r m : in, This indicates that after the (m-1)th iteration, the entire model has a high degree of understanding of the samples. The predicted carbon emissions This indicates that the m-th regression tree model is effective for the sample. The predicted carbon emissions Represents the optimization variable; Optimal step size r m Add ensemble model, ensemble model f m (x) The expression is as follows: in, v For learning rate, This represents the ensemble model after the (m-1)th iteration. Finally, the gradient boosting model is obtained. for: Gradient boosting model The final carbon emission forecast is obtained.
8. A carbon emission model prediction cross-validation and fusion optimization system according to claim 4, 5, 6, or 7, characterized in that: A training set is drawn from the preprocessed historical energy consumption data and corresponding historical carbon emission data. The hyperparameters of the various prediction models are optimized using cross-validation techniques and the training set to obtain the optimal hyperparameter set for each prediction model. The specific process of obtaining the corresponding optimized prediction model using the optimal hyperparameter set for each prediction model is as follows: sample set The random forest model, support vector machine model, additive model, and gradient boosting model are randomly divided into training and test sets according to a preset ratio. Hyperparameter optimization is then performed on these models using K-fold cross-validation and in conjunction with the training set. The training set is divided into K equal datasets. Each time, one dataset is selected from the K datasets as the validation set, and the remaining K-1 datasets are used as the training subset. For each prediction model, different hyperparameter combinations are used for training on the training subset. The error index of the prediction model under the corresponding hyperparameter combination is calculated using the validation set. After completing K iterations, the average error of each hyperparameter combination in K rounds of validation is calculated. The hyperparameter combination with the smallest average error is selected as the optimal hyperparameter set for the corresponding prediction model, thus obtaining the corresponding optimized prediction models.
9. A carbon emission model prediction cross-validation and fusion optimization system according to claim 1 or 8, characterized in that: The specific process for obtaining the fused and optimized prediction model is as follows: Stacking ensemble learning units were used to compare and analyze the performance of the optimized random forest model, support vector machine model, additive model and gradient boosting model. The random forest model, additive model and gradient boosting model in all optimized prediction models were used as base learners, and the support vector machine model was used as meta learner. The historical carbon emission data of each sample in the training set is used as the real carbon emission label. Each base learner is trained independently using the training set to generate preliminary predicted carbon emissions. The preliminary predicted carbon emissions of all base learners are combined with the training set to form a feature matrix. The rows of the feature matrix correspond to the samples in the training set, and the columns correspond to the predicted values of all base learners. The real carbon emission labels of each sample in the training set are used as the training target of the meta-learner. The meta-learner performs supervised learning with the real carbon emission labels as the target through the feature matrix. Particle swarm optimization is performed simultaneously during the training process. The MAPE or RMSE of each base learner and meta-learner is used as the fitness function to adjust the parameter configuration of the corresponding base learner and meta-learner in real time, so as to minimize the error index of MAPE or RMSE of each base learner and meta-learner, thereby determining the optimal parameter configuration of each base learner and meta-learner, completing the particle swarm optimization, and obtaining the fused and optimized prediction model.
10. A method for cross-validation and fusion optimization of carbon emission model predictions, characterized in that, It includes the following steps: Various types of prediction models are constructed based on preprocessed historical energy consumption data and corresponding historical carbon emission data. A training set is divided from the preprocessed historical energy consumption data and the corresponding historical carbon emission data. The hyperparameters of the various types of prediction models are optimized by cross-validation and in combination with the training set to obtain the optimal hyperparameter set of each prediction model. The corresponding optimized prediction models are obtained by using the optimal hyperparameter set of each prediction model. Stacking ensemble learning units are used to divide all optimized prediction models into multiple base learners and one meta learner. Each base learner is trained on the training set to obtain the corresponding preliminary predicted carbon emissions. The preliminary predicted carbon emissions of all base learners are combined with the training set to obtain a feature matrix. The meta learner is trained using the feature matrix. During the training process, the parameter configuration of the base learners and meta learners is dynamically adjusted using the particle swarm optimization algorithm to finally obtain the fused and optimized prediction model.
Citation Information
Cited By
Method for predicting the adsorption weight of a filter material
CN122389000A
