Power industry carbon emission prediction method and system based on XGBoost algorithm

By applying the carbon emission prediction method based on the XGBoost algorithm in the power industry, the problems of insufficient spatial accuracy and short time scale in the prior art are solved, and carbon emission prediction with higher accuracy and longer time scales are achieved.

CN119539145APending Publication Date: 2025-02-28CHINA ELECTRIC POWER RESEARCH INSTITUTE CO LTD +2

Patent Information

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

Smart Images

  • Figure CN119539145A_ABST
    Figure CN119539145A_ABST
Patent Text Reader

Abstract

The invention discloses a power industry carbon emission prediction method and system based on an XGBoost algorithm, and belongs to the technical field of carbon emission prediction. The method comprises the following steps: acquiring current data related to carbon emission in the power industry; inputting the current data related to the carbon emission in the power industry into a prediction model, and solving the prediction model to predict the carbon emission of the power industry in a future time period; training samples of the prediction model are a training set and a test set which are generated on the basis of historical data related to carbon emission in the power industry. The XGBoost algorithm is adopted to construct the model for prediction, and the predicted carbon emission is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of carbon emission prediction, and more specifically, to a method and system for predicting carbon emissions in the power industry based on an XGBoost algorithm. Background Art

[0002] With the development of human society, problems such as shortage of traditional fossil energy and serious environmental pollution have become increasingly prominent. "Carbon peak and carbon neutrality" have become the main future path to alleviate the energy crisis. Among them, the power industry, as one of the main sources of energy consumption and carbon emissions, undertakes an important task of emission reduction. Therefore, the development of high-precision carbon emission prediction methods for high-energy-consuming industries has become an important basis for formulating emission reduction policies, evaluating emission reduction effects, and optimizing energy structure.

[0003] Application status of carbon emission prediction models:

[0004] The accuracy of carbon emission forecasting is mainly determined by the richness of the dataset of the forecasting object and the accuracy of the adopted forecasting model. As far as the forecasting object is concerned, due to the relatively rich data provided by various provinces and regions, most of the existing carbon emission forecasting research is carried out on such large regions, and there are relatively few studies on carbon emission forecasting for specific industries. The power industry consumes a lot of energy and electricity, and there are large differences at different time and space scales, so it is difficult to obtain carbon emission data. As for the forecasting models used in carbon emission forecasting, they mainly include STIRPAT model, LEAP model, BP neural network model, etc., all of which predict the future carbon emission trend of the entire region through comprehensive analysis of economic activities, energy use, technological progress and policy impact. The current research status is summarized as follows:

[0005] Regional carbon emission prediction method based on STIRPAT model:

[0006] The regional carbon emission prediction method based on the STIRPAT model uses the analysis of environmental impact as the driving factor, and uses statistical methods to study the impact of population, affluence and technology on the environment, thereby achieving the prediction of carbon emissions in large regions. However, since the model introduces many variables and there are nonlinear relationships between most variables, the model complexity is high and the calculation is relatively complicated. At the same time, the model assumes that each factor is independent by default, ignoring the complex interactions between the variables, and the carbon emission prediction accuracy is relatively low.

[0007] Regional carbon emission prediction method based on LEAP model:

[0008] The regional carbon emission forecasting method based on the LEAP model uses system dynamics and integrated modeling methods to comprehensively consider multiple factors, evaluate the long-term impact of energy policies, and provide a scientific basis for decision-making. However, the forecast results of the LEAP model are highly dependent on input data, and insufficient or low-quality data may affect its accuracy. In addition, the uncertainty of future technological advances and policy changes may lead to forecast bias, and the model is difficult to respond quickly to market changes or emergencies.

[0009] Regional carbon emission prediction method based on BP neural network:

[0010] The regional carbon emission prediction method based on BP neural network is a prediction model based on the back propagation algorithm of BP neural network. It minimizes the output error by adjusting weights and biases, and continuously adjusts parameters to approximate the objective function. However, the training process of this model for large data sets and complex networks may be very time-consuming. In addition, the gradient descent method may fall into a local minimum, thus affecting the overall performance of the model. In addition, the hyperparameter tuning process is relatively complicated and requires adjusting multiple hyperparameters. Especially in multi-layer networks, the gradient may gradually disappear during back propagation, thus affecting the training effect.

[0011] The current problems are as follows:

[0012] 1) The spatial precision of carbon emission prediction methods is insufficient. Most existing carbon emission prediction methods estimate carbon emissions in larger geographical areas and fail to carefully consider local factors, such as differences in urban development, industrial structure, and transportation patterns. This rough spatial resolution may lead to deviations in prediction results.

[0013] 2) The time scale of carbon emission prediction methods is short. Existing carbon emission prediction methods tend to focus on short-term time scales, usually only predicting emission trends in the next few years. This short-term perspective limits the comprehensive understanding of the long-term impact of climate change and cannot effectively capture the long-term impact of factors such as economic growth, technological progress and policy changes on emissions.

[0014] 3) There are few carbon emission prediction methods for the power industry. Most of the existing carbon emission prediction methods predict carbon emissions in large regions from a macro perspective, and do not carry out targeted designs for specific power industries, and cannot fully consider the rapid development of renewable energy and changes in the power market. Summary of the invention

[0015] In view of the above problems, the present invention proposes a carbon emission prediction method for the power industry based on the XGBoost algorithm, comprising:

[0016] Obtain current data related to carbon emissions in the power industry;

[0017] Inputting the current data related to carbon emissions of the power industry into a prediction model, and solving the prediction model to predict the carbon emissions of the power industry in future periods;

[0018] The training samples of the prediction model are training sets and test sets generated based on historical data related to the history of the power industry and carbon emissions.

[0019] Optional, historical data related to carbon emissions in the power industry, including:

[0020] Carbon emission data, economic activity related data, energy usage data and policy information data.

[0021] Optionally, the method further includes:

[0022] Based on the historical data, a data set is generated, and the data set is divided into a training set and a test set according to a preset ratio;

[0023] The prediction model is trained based on the training set and the test set.

[0024] Optionally, generating a data set based on the historical data includes:

[0025] Cleaning the historical data to filter out abnormal values ​​and fill in missing values ​​to obtain cleaned data;

[0026] The cleaned data are screened to obtain key variable data affecting carbon emissions, and the key variable data affecting carbon emissions are normalized to generate a data set.

[0027] Optionally, training the prediction model based on the training set and the test set includes:

[0028] The XGBoost algorithm is trained with the training set to generate an initial prediction model, and the performance of the initial prediction model is tested with the test set. The model parameters of the prediction model are adjusted according to the test results to obtain the prediction model.

[0029] Optionally, the XGBoost algorithm is trained with the training set to generate an initial prediction model, including:

[0030] The average value of carbon emissions in the power industry is selected as the initial prediction value of carbon emissions to define an initial model, the initial model is iteratively trained based on the XGBoost algorithm to generate an iterative model, an objective function is established based on the iterative model, and an initial prediction model is generated based on the objective function.

[0031] Optionally, during the iterative training process, a decision tree is added in each iteration and updated to obtain the latest prediction value.

[0032] Optionally, the output of the iterative model is as follows:

[0033]

[0034] in, is the predicted value of carbon emissions, t is the number of weak classifiers, f k (x i ) is the predicted value of the kth weak classifier for sample xi.

[0035] Optional, objective function, as follows:

[0036]

[0037] in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; y i is the model prediction value; y i t-1 is the actual value or the value of the previous moment; L is the loss function, which measures the model prediction value y i The actual value or the value y at the previous moment i t-1 The difference between i is the first-order derivative of the loss function; f t (x) is the predicted value of the model in the current t-th iteration; h i is the second-order derivative of the loss function; is the second-order gradient correction term; Ω(f t ) is a regularization term. In the decision tree model, Ω(f t ) By adjusting the number and weight of leaf nodes in the tree, the model can be made simpler and more effective; constant is a constant term.

[0038] Optionally, transform the objective function, and establish an initial prediction model based on the transformed objective function;

[0039] Among them, the converted objective function is as follows:

[0040]

[0041] in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; T is the total dimension or the number of leaf nodes, which indicates the number of items summed in this round of iteration, and is the upper bound of the sum in the formula; is the square of the sum of the first-order derivatives of the loss function; H j is the second-order derivative of the loss function; λ is the regularization term, which can make H j Avoid numerical instability when the value is too small.

[0042] Optionally, solving the prediction model includes: solving the prediction model by solving the change of information gain Gain before and after the node splitting, so as to predict the carbon emissions of the power industry in the future period;

[0043] Among them, the calculation formula for the change of information gain Gain is as follows:

[0044]

[0045] Among them, Gain is information gain; is the objective function, which is the function to be optimized in the prediction model, and is the objective function value of the bjth node; G L is the gradient sum of the left child node, which means the accumulated value of the gradient on the left subtree after the current node is split; G R is the gradient sum of the right child node, indicating the accumulated value of the gradient on the right subtree after the current node is split; H L is the Hessian sum of the left child node, which represents the sum of the second-order derivatives and is used to adjust the update step size. λ is the regularization term, which is used to adjust the regularization parameter in the growth process of the tree. By penalizing the complexity of the split node, the model remains simple and avoids overfitting. R is the Hessian sum of the right child node, which represents the sum of the second-order derivatives and is used for curvature control during the update process.

[0046] On the other hand, the present invention also proposes a carbon emission prediction system for the power industry based on the XGBoost algorithm, comprising:

[0047] A data acquisition unit, used to acquire current data related to carbon emissions in the power industry;

[0048] A solution unit, inputting the current data related to carbon emissions of the power industry into a prediction model, and solving the prediction model to predict the carbon emissions of the power industry in a future period;

[0049] The training samples of the prediction model are training sets and test sets generated based on historical data related to the history of the power industry and carbon emissions.

[0050] Optional, historical data related to carbon emissions in the power industry, including:

[0051] Carbon emission data, economic activity related data, energy usage data and policy information data.

[0052] Optionally, the solver unit is also used to:

[0053] Based on the historical data, a data set is generated, and the data set is divided into a training set and a test set according to a preset ratio;

[0054] The prediction model is trained based on the training set and the test set.

[0055] Optionally, generating a data set based on the historical data includes:

[0056] Cleaning the historical data to filter out abnormal values ​​and fill in missing values ​​to obtain cleaned data;

[0057] The cleaned data are screened to obtain key variable data affecting carbon emissions, and the key variable data affecting carbon emissions are normalized to generate a data set.

[0058] Optionally, training the prediction model based on the training set and the test set includes:

[0059] The XGBoost algorithm is trained with the training set to generate an initial prediction model, and the performance of the initial prediction model is tested with the test set. The model parameters of the prediction model are adjusted according to the test results to obtain the prediction model.

[0060] Optionally, the XGBoost algorithm is trained with the training set to generate an initial prediction model, including:

[0061] The average value of carbon emissions in the power industry is selected as the initial prediction value of carbon emissions to define an initial model, the initial model is iteratively trained based on the XGBoost algorithm to generate an iterative model, an objective function is established based on the iterative model, and an initial prediction model is generated based on the objective function.

[0062] Optionally, during the iterative training process, a decision tree is added in each iteration and updated to obtain the latest prediction value.

[0063] Optionally, the output of the iterative model is as follows:

[0064]

[0065] in, is the predicted value of carbon emissions, t is the number of weak classifiers, f k (x i ) is the predicted value of the kth weak classifier for sample xi.

[0066] Optional, objective function, as follows:

[0067]

[0068] in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; yi is the model prediction value; y i t-1 is the actual value or the value of the previous moment; L is the loss function, which measures the model prediction value y i The actual value or the value y at the previous moment i t-1 The difference between i is the first-order derivative of the loss function; f t (x) is the predicted value of the model in the current t-th iteration; h i is the second-order derivative of the loss function; is the second-order gradient correction term; Ω(f t ) is a regularization term. In the decision tree model, Ω(f t ) By adjusting the number and weight of leaf nodes in the tree, the model can be made simpler and more effective; constant is a constant term.

[0069] Optionally, transform the objective function, and establish an initial prediction model based on the transformed objective function;

[0070] Among them, the converted objective function is as follows:

[0071]

[0072] in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; T is the total dimension or the number of leaf nodes, which indicates the number of items summed in this round of iteration, and is the upper bound of the sum in the formula; is the square of the sum of the first-order derivatives of the loss function; H j is the second-order derivative of the loss function; λ is the regularization term, which can make H j Avoid numerical instability when the value is too small.

[0073] Optionally, the solving unit solves the prediction model, including: solving the prediction model by solving the change of information gain Gain before and after the node splitting, so as to predict the carbon emissions of the power industry in the future period;

[0074] Among them, the calculation formula for the change of information gain Gain is as follows:

[0075]

[0076] Among them, Gain is information gain; is the objective function, which is the function to be optimized in the prediction model, and is the objective function value of the bjth node; G L is the gradient sum of the left child node, which means the accumulated value of the gradient on the left subtree after the current node is split; G Ris the gradient sum of the right child node, indicating the accumulated value of the gradient on the right subtree after the current node is split; H L is the Hessian sum of the left child node, which represents the sum of the second-order derivatives and is used to adjust the update step size. λ is the regularization term, which is used to adjust the regularization parameter in the growth process of the tree. By penalizing the complexity of the split node, the model is kept simple and overfitting is avoided. R is the Hessian sum of the right child node, which represents the sum of the second-order derivatives and is used for curvature control during the update process.

[0077] In yet another aspect, the present invention further provides a computing device, comprising: one or more processors;

[0078] a processor for executing one or more programs;

[0079] When the one or more programs are executed by the one or more processors, the above-described method is implemented.

[0080] In yet another aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed, the method described above is implemented.

[0081] Compared with the prior art, the present invention has the following beneficial effects:

[0082] The present invention proposes a method for predicting carbon emissions in the power industry based on the XGBoost algorithm, including: obtaining data related to carbon emissions in the power industry; inputting the data related to carbon emissions in the power industry into a prediction model, and solving the prediction model to predict the carbon emissions of the power industry in the future period; the training samples of the prediction model are training sets and test sets generated based on historical data related to carbon emissions in the power industry. The present invention uses the XGBoost algorithm to build a model for prediction, and the predicted carbon emissions are more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0083] Figure 1 is a flow chart of the method of the present invention;

[0084] Figure 2 The decision tree principle diagram of the method of the present invention using the XGBoost algorithm;

[0085] Figure 3 An example diagram showing input data for the power industry required by the method of the present invention;

[0086] Figure 4 It is a structural diagram of the system of the present invention. DETAILED DESCRIPTION

[0087] Now, exemplary embodiments of the present invention are described with reference to the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. These embodiments are provided to disclose the present invention in detail and completely and to fully convey the scope of the present invention to those skilled in the art. The terms used in the exemplary embodiments shown in the accompanying drawings are not intended to limit the present invention. In the accompanying drawings, the same units / elements are marked with the same reference numerals.

[0088] Unless otherwise specified, the terms (including technical terms) used herein have the commonly understood meanings to those skilled in the art. In addition, it is understood that the terms defined in commonly used dictionaries should be understood to have the same meanings as those in the context of the relevant fields, and should not be understood as idealized or overly formal meanings.

[0089] Embodiment 1:

[0090] The present invention proposes a carbon emission prediction method for the power industry based on the XGBoost algorithm. Figure 1 As shown, including:

[0091] Step 1: Obtain current data related to carbon emissions in the power industry;

[0092] Step 2: inputting the current data related to carbon emissions of the power industry into the prediction model, and solving the prediction model to predict the carbon emissions of the power industry in the future period;

[0093] The training samples of the prediction model are training sets and test sets generated based on historical data related to the history of the power industry and carbon emissions.

[0094] Among them, historical data related to carbon emissions in the power industry include:

[0095] Carbon emission data, economic activity related data, energy usage data and policy information data.

[0096] The method further includes:

[0097] Based on the historical data, a data set is generated, and the data set is divided into a training set and a test set according to a preset ratio;

[0098] The prediction model is trained based on the training set and the test set.

[0099] Wherein, generating a data set based on the historical data includes:

[0100] Cleaning the historical data to filter out abnormal values ​​and fill in missing values ​​to obtain cleaned data;

[0101] The cleaned data are screened to obtain key variable data affecting carbon emissions, and the key variable data affecting carbon emissions are normalized to generate a data set.

[0102] Wherein, training the prediction model based on the training set and the test set includes:

[0103] The XGBoost algorithm is trained with the training set to generate an initial prediction model, and the performance of the initial prediction model is tested with the test set. The model parameters of the prediction model are adjusted according to the test results to obtain the prediction model.

[0104] The XGBoost algorithm is trained with the training set to generate an initial prediction model, including:

[0105] The average value of carbon emissions in the power industry is selected as the initial prediction value of carbon emissions to define an initial model, the initial model is iteratively trained based on the XGBoost algorithm to generate an iterative model, an objective function is established based on the iterative model, and an initial prediction model is generated based on the objective function.

[0106] During the iterative training process, a decision tree is added in each iteration and updated to obtain the latest prediction value.

[0107] Among them, the output of the iterative model is as follows:

[0108]

[0109] in, is the predicted value of carbon emissions, t is the number of weak classifiers, f k (x i ) is the predicted value of the kth weak classifier for sample xi.

[0110] Among them, the objective function is as follows:

[0111]

[0112] in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; y i is the model prediction value; y i t-1 is the actual value or the value of the previous moment; L is the loss function, which measures the model prediction value y i The actual value or the value y at the previous moment i t-1 The difference between i is the first-order derivative of the loss function; f t(x) is the predicted value of the model in the current t-th iteration; h i is the second-order derivative of the loss function; is the second-order gradient correction term; Ω(f t ) is a regularization term. In the decision tree model, Ω(f t ) By adjusting the number and weight of leaf nodes in the tree, the model can be made simpler and more effective; constant is a constant term.

[0113] Among them, the objective function is transformed, and an initial prediction model is established based on the transformed objective function;

[0114] Among them, the converted objective function is as follows:

[0115]

[0116] in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; T is the total dimension or the number of leaf nodes, which indicates the number of items summed in this round of iteration, and is the upper bound of the sum in the formula; is the square of the sum of the first-order derivatives of the loss function; H j is the second-order derivative of the loss function; λ is the regularization term, which can make H j Avoid numerical instability when the value is too small.

[0117] The prediction model is solved, including: solving the prediction model by solving the change of information gain Gain before and after the node splitting, so as to predict the carbon emissions of the power industry in the future period;

[0118] Among them, the calculation formula for the change of information gain Gain is as follows:

[0119]

[0120] Among them, Gain is information gain; is the objective function, which is the function to be optimized in the prediction model, and is the objective function value of the bjth node; G L is the gradient sum of the left child node, which means the accumulated value of the gradient on the left subtree after the current node is split; G R is the gradient sum of the right child node, indicating the accumulated value of the gradient on the right subtree after the current node is split; H L is the Hessian sum of the left child node, which represents the sum of the second-order derivatives and is used to adjust the update step size. λ is the regularization term, which is used to adjust the regularization parameter in the growth process of the tree. By penalizing the complexity of the split node, the model is kept simple and overfitting is avoided. R is the Hessian sum of the right child node, which represents the sum of the second-order derivatives and is used for curvature control during the update process.

[0121] Among them, establishing a prediction model specifically includes:

[0122] The present invention comprehensively considers the impact of economic activities, energy use and policy changes on the power industry, uses the XGBoost algorithm to analyze the historical data of the power industry over a long period of time, clarifies the multi-dimensional key influencing factors of carbon emissions in the power industry, and models and analyzes the weights of the influence of each variable, thereby constructing a time series prediction model for carbon emissions in the power industry, and conducting higher spatial accuracy and longer time scale predictions for future carbon emissions. The main steps include:

[0123] Step 1: Define the initial model and iterative model.

[0124] The average value of the existing carbon emission data of the power industry is selected as the initial prediction value of carbon emissions. At the same time, iterative training is carried out. Each iteration will add a new decision tree to the model and update the latest prediction value. The specific iterative process is shown in formula (1):

[0125]

[0126] Where: is the predicted value of carbon emissions;

[0127] x i is the feature vector of carbon emission samples;

[0128] is the initial forecast value of carbon emissions;

[0129] f t (x i ) is the predicted value of the tth weak classifier for sample xi;

[0130] Finally, the model's prediction value for a particular sample is obtained by summing up the prediction results of all decision trees. The output of the model results is as follows:

[0131] Step 2: Set the objective function.

[0132] In the process of carbon emission prediction in the power industry based on the XGBoost algorithm, the objective function consists of model error and structural error. Model error, also known as loss function, is determined by the difference between the true value of power industry data and the model prediction value; the structural error controls the complexity of the model and prevents overfitting. The objective function can be expressed by formula (2):

[0133]

[0134] Substituting formula (1) into formula (2), the objective function can be further expressed as:

[0135]

[0136] Assuming that the model error (loss function) is a square loss function and the final number of fitting iterations is t, the prediction model will contain t decision trees, and its error is composed of the sum of the errors of the selected n data samples in the tth decision tree, the structural error of the tth decision tree, and the structural error of the first t-1 decision trees. Considering that the structure of the first t-1 decision trees is known, their structural errors can be regarded as constants. Therefore, the objective function It can be further expressed as:

[0137]

[0138] Among them, the variable f t It can be processed by second-order Taylor expansion and expressed as:

[0139]

[0140] Substituting into formula (4), the objective function It can be expressed as:

[0141]

[0142] in, and They are The first and second derivatives of . When assuming that the model error (loss function) is a squared loss function,

[0143] Furthermore, considering that L(y) represents the sum of the errors between the data sample and the t-1th decision tree, it can be regarded as a constant term. Therefore, the objective function can be expressed as t (x), and f t (x) is a function of the output w of the decision tree leaf node. Therefore, the objective function can be completely converted into a function of w, expressed as:

[0144]

[0145] make Then the objective function can be converted to:

[0146]

[0147] In the formula, j represents the jth node, and i represents the ith sample. Considering that the objective function is a quadratic function of w (i.e., the number of leaf node branches), in order to optimize the objective function, it is necessary to further solve the optimal solution of w. The derivation yields:

[0148]

[0149] Substituting the w' solution set, the objective function can be further transformed into:

[0150]

[0151] It can be obtained from the formula that when solving the objective function of the binary decision tree, the objective function can be solved by obtaining the first-order derivative and second-order derivative of the loss function and the distribution of sample data.

[0152] Furthermore, based on the objective function obtained by solving, the splitting of the feature node can be analyzed by solving the change of information gain Gain before and after the node split. If the current information gain > 0, it is considered that the node will split; if the gain is not greater than 0, the node will not split. Information gain can be expressed as follows

[0153]

[0154] It should be noted that in the process of carbon emission prediction in the power industry based on the XGBoost algorithm, the node splitting method can be divided into node splitting based on the greedy strategy and node splitting based on the approximate strategy. Node splitting based on the greedy strategy exhaustively searches each feature point and each possible value, calculates the gain before and after the split, and selects the feature value with the largest gain as the split point. This method is accurate but the amount of calculation is large. In order to improve the calculation efficiency, the node splitting method based on the approximate strategy is usually adopted in the solution process. The idea of ​​feature bucketing is adopted to distribute the feature values ​​to different feature buckets according to the quantile, and only consider the boundary values ​​of the bucket as candidates for splitting nodes.

[0155] Combining the above initial model, iterative model and objective function, inputting the existing data related to carbon emissions in the power industry, and after multiple fitting and solving, it is possible to achieve higher spatial accuracy and longer time scale prediction of future carbon emissions in the power industry based on the XGBoost algorithm.

[0156] The following is an example of a specific case. The specific steps include:

[0157] like Figure 1 The figure shows a flow chart of the implementation of the carbon emission prediction method for the power industry based on the XGBoost algorithm and multidimensional data set analysis according to the present invention, which specifically includes the following steps:

[0158] S101: Carbon emissions and multi-dimensional data collection. Key factors affecting carbon emissions include historical carbon emissions, economic indicators (such as GDP, industrial output value), energy use (such as coal, natural gas, renewable energy consumption), population data, and policies and regulations. This example uses data from reliable sources such as government statistics bureaus, academic research, and industry reports. This example selects monthly data on thermal power generation, power generation growth percentage, cumulative power generation, current power generation, asset investment in the power industry, fiscal budget, and other dimensions from January 1990 to December 2020 on the official website of the National Bureau of Statistics as the original data.

[0159] S102: Carbon emission data preprocessing. Preprocessing usually includes the following key steps: 1) Identify missing entries in the data set, select and delete records with missing values, or use interpolation, mean filling or other appropriate methods to fill them; 2) Analyze the historical data of the power industry over a long time scale, and select the multi-dimensional key influencing factors of carbon emissions in the power industry as characteristic variables; 3) Normalize or standardize the input power industry carbon emission data.

[0160] S103: Carbon emission data partitioning. The model needs to divide the entire data set into a training set and a test set to ensure that the model can be effectively evaluated on unseen data to avoid overfitting. The common division ratio is 70%-90% for training and 10%-30% for testing, which can be adjusted according to the scale and characteristics of the specific data set. In this example, 10% is selected as the test set ratio to make the fitting results as accurate as possible. The data set is divided using tool functions such as train_test_split to ensure that the training set and the test set are similar in feature distribution. This example uses the XGBoost algorithm to train the model, adjusts the model parameters through repeated iterations, minimizes the loss function, and uses cross-validation to evaluate the generalization ability of the model during training to help select the best hyperparameter settings.

[0161] S104: Reliability evaluation of the carbon emission data test set. After training, the test set is used to evaluate the final performance of the model, the mean square error (RMSE), R 2 Indicators such as mean square error (MSE), root mean square error (RMSE), mean absolute error (MAE), and mean absolute percentage error (MAPE) are used to ensure the predictive ability of the model.

[0162] S105: Future carbon emission prediction of the power industry. After completing the model training, the trained XGBoost model was used to predict future data, input new data and obtain the corresponding prediction results.

[0163] S106: Analysis of the forecast results of carbon emissions in the future power industry. By conducting a time series analysis of the forecast results, the changing trend of carbon emissions is identified. The result of this example is that carbon emissions no longer show a clear upward trend, and carbon emissions have been significantly eased, which also confirms that the goals of carbon peak and carbon neutrality are being gradually achieved.

[0164] Figure 2 It represents the decision tree principle diagram of the XGBoost algorithm adopted by the carbon emission prediction method for the power industry proposed in the present invention. Different from the traditional machine learning algorithm, the main difference of the XGBoost algorithm lies in the number of sub-decision tree models introduced in the calculation process, which is also the main reason why it can achieve higher spatial resolution and longer time scale carbon emission prediction. When using XGBoost for data prediction, based on the gradient boosting algorithm, the accuracy of the prediction results is gradually improved through continuous iteration. At the same time, during the training process, each decision tree node of the data obtained by calculation will be split into two sub-nodes, and each sub-node corresponds to a new decision tree model. Therefore, each node in XGBoost is part of a decision tree model, rather than a separate decision tree. Therefore, this method can effectively utilize the existing decision tree model, speed up the training speed of the model, and improve the accuracy of the model.

[0165] Figure 3 An example display diagram of the input data of the power industry required for the carbon emission forecast of the power industry using the present invention is shown. The design data of this model comes from the official website of the National Bureau of Statistics. According to the requirements of model building, the input data not only includes carbon emissions, but also needs to cover other related dimensions that may affect carbon emissions. Therefore, the multi-dimensional monthly data from January 1990 to December 2020 on the official website of the National Bureau of Statistics were selected as the original data, including thermal power generation (HLFD), power generation growth percentage (ZZBFL), cumulative power generation value (FDLJZ), current power generation value (FDDQZ), power industry asset investment (ZCTZ), fiscal budget (CZYS), etc. These multi-dimensional data provide comprehensive input for the model, which helps to improve the accurate prediction and analysis of carbon emissions.

[0166] The present invention comprehensively considers the impact of economic activities, energy use and policy changes on the power industry, and adopts the XGBoost algorithm to analyze the historical data of the power industry over a long period of time. It can achieve higher spatial accuracy and longer time scale predictions of the power industry's future carbon emissions, and provide more refined analysis and decision-making support for the low-carbon transformation of the power industry.

[0167] Embodiment 2:

[0168] The present invention also proposes a carbon emission prediction system 200 for the power industry based on the XGBoost algorithm, such as Figure 4 As shown, including:

[0169] The data acquisition unit 201 is used to acquire the current data related to carbon emissions in the power industry;

[0170] A solution unit 202 inputs the current data related to carbon emissions of the power industry into a prediction model, and solves the prediction model to predict the carbon emissions of the power industry in a future period;

[0171] The training samples of the prediction model are training sets and test sets generated based on historical data related to the history of the power industry and carbon emissions.

[0172] Among them, historical data related to carbon emissions in the power industry include:

[0173] Carbon emission data, economic activity related data, energy usage data and policy information data.

[0174] The solving unit 202 is also used for:

[0175] Based on the historical data, a data set is generated, and the data set is divided into a training set and a test set according to a preset ratio;

[0176] The prediction model is trained based on the training set and the test set.

[0177] Wherein, generating a data set based on the historical data includes:

[0178] Cleaning the historical data to filter out abnormal values ​​and fill in missing values ​​to obtain cleaned data;

[0179] The cleaned data are screened to obtain key variable data affecting carbon emissions, and the key variable data affecting carbon emissions are normalized to generate a data set.

[0180] Wherein, training the prediction model based on the training set and the test set includes:

[0181] The XGBoost algorithm is trained with the training set to generate an initial prediction model, and the performance of the initial prediction model is tested with the test set. The model parameters of the prediction model are adjusted according to the test results to obtain the prediction model.

[0182] The XGBoost algorithm is trained with the training set to generate an initial prediction model, including:

[0183] The average value of carbon emissions in the power industry is selected as the initial prediction value of carbon emissions to define an initial model, the initial model is iteratively trained based on the XGBoost algorithm to generate an iterative model, an objective function is established based on the iterative model, and an initial prediction model is generated based on the objective function.

[0184] During the iterative training process, a decision tree is added in each iteration and updated to obtain the latest prediction value.

[0185] Among them, the output of the iterative model is as follows:

[0186]

[0187] in, is the predicted value of carbon emissions, t is the number of weak classifiers, f k (x i ) is the predicted value of the kth weak classifier for sample xi.

[0188] Among them, the objective function is as follows:

[0189]

[0190] in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; y i is the model prediction value; y i t-1 is the actual value or the value of the previous moment; L is the loss function, which measures the model prediction value y i The actual value or the value y at the previous moment i t-1 The difference between i is the first-order derivative of the loss function; f t (x) is the predicted value of the model in the current t-th iteration; h i is the second-order derivative of the loss function; is the second-order gradient correction term; Ω(f t ) is a regularization term. In the decision tree model, Ω(f t ) By adjusting the number and weight of leaf nodes in the tree, the model can be made simpler and more effective; constant is a constant term.

[0191] Among them, the objective function is transformed, and an initial prediction model is established based on the transformed objective function;

[0192] Among them, the converted objective function is as follows:

[0193]

[0194] in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; T is the total dimension or the number of leaf nodes, which indicates the number of items summed in this round of iteration, and is the upper bound of the sum in the formula; is the square of the sum of the first-order derivatives of the loss function; H j is the second-order derivative of the loss function; λ is the regularization term, which can make H j Avoid numerical instability when the value is too small.

[0195] The solving unit 202 solves the prediction model, including: solving the prediction model by solving the change of information gain Gain before and after the node splitting, so as to predict the carbon emissions of the power industry in the future period;

[0196] Among them, the calculation formula for the change of information gain Gain is as follows:

[0197]

[0198] Among them, Gain is information gain; is the objective function, which is the function to be optimized in the prediction model, and is the objective function value of the bjth node; G L is the gradient sum of the left child node, which means the accumulated value of the gradient on the left subtree after the current node is split; G R is the gradient sum of the right child node, indicating the accumulated value of the gradient on the right subtree after the current node is split; H L is the Hessian sum of the left child node, which represents the sum of the second-order derivatives and is used to adjust the update step size. λ is the regularization term, which is used to adjust the regularization parameter in the growth process of the tree. By penalizing the complexity of the split node, the model remains simple and avoids overfitting. R is the Hessian sum of the right child node, which represents the sum of the second-order derivatives and is used for curvature control during the update process.

[0199] The present invention adopts the XGBoost algorithm to build a model for prediction, and the predicted carbon emissions are more accurate.

[0200] Embodiment 3:

[0201] Based on the same inventive concept, the present invention also provides a computer device, which includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding functions, so as to implement the steps of the method in the above embodiment.

[0202] Embodiment 4:

[0203] Based on the same inventive concept, the present invention also provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both a built-in storage medium in a computer device and an extended storage medium supported by the computer device. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by a processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the steps of the method in the above embodiment.

[0204] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The schemes in the embodiments of the present invention may be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.

[0205] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0206] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0207] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0208] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0209] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A carbon emission prediction method for the power industry based on the XGBoost algorithm, characterized in that: include: Obtain current data related to carbon emissions in the power industry; Inputting the current data related to carbon emissions of the power industry into a prediction model, and solving the prediction model to predict the carbon emissions of the power industry in future periods; The training samples of the prediction model are training sets and test sets generated based on historical data related to the history of the power industry and carbon emissions.

2. The method according to claim 1, characterized in that The historical data related to carbon emissions in the power industry include: Carbon emission data, economic activity related data, energy usage data and policy information data.

3. The method according to claim 1, characterized in that The method further comprises: Based on the historical data, a data set is generated, and the data set is divided into a training set and a test set according to a preset ratio; The prediction model is trained based on the training set and the test set.

4. The method according to claim 3, characterized in that: The step of generating a data set based on the historical data includes: Cleaning the historical data to filter out abnormal values ​​and fill in missing values ​​to obtain cleaned data; The cleaned data are screened to obtain key variable data affecting carbon emissions, and the key variable data affecting carbon emissions are normalized to generate a data set.

5. The method according to claim 3, characterized in that: The step of training the prediction model based on the training set and the test set includes: The XGBoost algorithm is trained with the training set to generate an initial prediction model, and the performance of the initial prediction model is tested with the test set. The model parameters of the prediction model are adjusted according to the test results to obtain the prediction model.

6. The method according to claim 5, characterized in that The step of training the XGBoost algorithm with the training set to generate an initial prediction model includes: The average value of carbon emissions in the power industry is selected as the initial prediction value of carbon emissions to define an initial model, the initial model is iteratively trained based on the XGBoost algorithm to generate an iterative model, an objective function is established based on the iterative model, and an initial prediction model is generated based on the objective function.

7. The method according to claim 6, characterized in that During the iterative training process, a decision tree is added in each iteration and updated to obtain the latest prediction value.

8. The method according to claim 6, characterized in that The output of the iterative model is as follows: in, is the predicted value of carbon emissions, t is the number of weak classifiers, f k (x i ) is the predicted value of the kth weak classifier for sample xi.

9. The method according to claim 6, characterized in that The objective function is as follows: in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; y i is the model prediction value; y i t-1 is the actual value or the value of the previous moment; L is the loss function, which measures the model prediction value y i The actual value or the value y at the previous moment i t-1 The difference between i is the first-order derivative of the loss function; f t (x) is the predicted value of the model in the current t-th iteration; h i is the second-order derivative of the loss function; is the second-order gradient correction term; Ω(f t ) is a regularization term. In the decision tree model, Ω(f t ) By adjusting the number and weight of leaf nodes in the tree, the model can be made simpler and more effective; constant is a constant term.

10. The method according to claim 6, characterized in that The method further comprises: Transform the objective function, and establish an initial prediction model based on the transformed objective function; Among them, the converted objective function is as follows: in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; T is the total dimension or the number of leaf nodes, which indicates the number of items summed in this round of iteration, and is the upper bound of the sum in the formula; is the square of the sum of the first-order derivatives of the loss function; H j is the second-order derivative of the loss function; λ is the regularization term, which can make H j Avoid numerical instability when the value is too small.

11. The method according to claim 1, characterized in that: Solving the prediction model includes: solving the prediction model by solving the change of information gain Gain before and after the node splitting, so as to predict the carbon emissions of the power industry in the future period; Among them, the calculation formula for the change of information gain Gain is as follows: Among them, Gain is information gain; is the objective function, which is the function to be optimized in the prediction model, and is the objective function value of the bjth node; G L is the gradient sum of the left child node, which means the accumulated value of the gradient on the left subtree after the current node is split; G R is the gradient sum of the right child node, indicating the accumulated value of the gradient on the right subtree after the current node is split; H L is the Hessian sum of the left child node, which represents the sum of the second-order derivatives and is used to adjust the update step size. λ is the regularization term, which is used to adjust the regularization parameter in the growth process of the tree. By penalizing the complexity of the split node, the model is kept simple and overfitting is avoided. R is the Hessian sum of the right child node, which represents the sum of the second-order derivatives and is used for curvature control during the update process.

12. A carbon emission prediction system for the power industry based on the XGBoost algorithm, characterized in that: include: A data acquisition unit, used to acquire current data related to carbon emissions in the power industry; A solution unit, inputting the current data related to carbon emissions of the power industry into a prediction model, and solving the prediction model to predict the carbon emissions of the power industry in a future period; The training samples of the prediction model are training sets and test sets generated based on historical data related to the history of the power industry and carbon emissions.

13. The system according to claim 11, characterized in that The historical data related to carbon emissions in the power industry include: Carbon emission data, economic activity related data, energy usage data and policy information data.

14. The system according to claim 12, characterized in that The solving unit is further used for: Based on the historical data, a data set is generated, and the data set is divided into a training set and a test set according to a preset ratio; The prediction model is trained based on the training set and the test set.

15. The system according to claim 14, characterized in that The step of generating a data set based on the historical data includes: Cleaning the historical data to filter out abnormal values ​​and fill in missing values ​​to obtain cleaned data; The cleaned data are screened to obtain key variable data affecting carbon emissions, and the key variable data affecting carbon emissions are normalized to generate a data set.

16. The system according to claim 14, characterized in that The step of training the prediction model based on the training set and the test set includes: The XGBoost algorithm is trained with the training set to generate an initial prediction model, and the performance of the initial prediction model is tested with the test set. The model parameters of the prediction model are adjusted according to the test results to obtain the prediction model.

17. The system according to claim 16, characterized in that The step of training the XGBoost algorithm with the training set to generate an initial prediction model includes: The average carbon emissions of the power industry are selected as the initial prediction value of carbon emissions to define the initial model. oos The t algorithm iteratively trains the initial model to generate an iterative model, establishes an objective function based on the iterative model, and generates an initial prediction model based on the objective function.

18. The system according to claim 17, characterized in that During the iterative training process, a decision tree is added in each iteration and updated to obtain the latest prediction value.

19. The system according to claim 17, characterized in that The output of the iterative model is as follows: in, is the predicted value of carbon emissions, t is the number of weak classifiers, f k (x i ) is the predicted value of the kth weak classifier for sample xi.

20. The system according to claim 17, characterized in that The objective function is as follows: in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; y i is the model prediction value; y i t-1 is the actual value or the value of the previous moment; L is the loss function, which measures the model prediction value y i The actual value or the value y at the previous moment i t-1 The difference between i is the first-order derivative of the loss function; f t (x) is the predicted value of the model in the current t-th iteration; h i is the second-order derivative of the loss function; is the second-order gradient correction term; Ω(f t ) is a regularization term. In the decision tree model, Ω(f t ) By adjusting the number and weight of leaf nodes in the tree, the model can be made simpler and more effective; constant is a constant term.

21. The system according to claim 17, characterized in that The objective function is transformed, and the initial prediction model is established based on the transformed objective function: Among them, the converted objective function is as follows: in, is the objective function, which is the function to be optimized in the prediction model, and is the objective function value for the bjth node; T is the total dimension or the number of leaf nodes, which indicates the number of items summed in this round of iteration, and is the upper bound of the sum in the formula; is the square of the sum of the first-order derivatives of the loss function; H j is the second-order derivative of the loss function; λ is the regularization term, which can make H j Avoid numerical instability when the value is too small.

22. The system according to claim 12, characterized in that The solving unit solves the prediction model, including: solving the prediction model by solving the change of information gain Gain before and after the node splitting, so as to predict the carbon emissions of the power industry in the future period; Among them, the calculation formula for the change of information gain Gain is as follows: Among them, Gain is information gain; is the objective function, which is the function to be optimized in the prediction model, and is the objective function value of the bjth node; G L is the gradient sum of the left child node, which means the accumulated value of the gradient on the left subtree after the current node is split; G R is the gradient sum of the right child node, indicating the accumulated value of the gradient on the right subtree after the current node is split; H L is the Hessian sum of the left child node, which represents the sum of the second-order derivatives and is used to adjust the update step size. λ is the regularization term, which is used to adjust the regularization parameter in the growth process of the tree. By penalizing the complexity of the split node, the model is kept simple and overfitting is avoided. R is the Hessian sum of the right child node, which represents the sum of the second-order derivatives and is used for curvature control during the update process.

23. A computer device, characterized in that: include: one or more processors; a processor for executing one or more programs; When the one or more programs are executed by the one or more processors, the method according to any one of claims 1 to 11 is implemented.

24. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed, the method according to any one of claims 1 to 11 is implemented.

Citation Information

Patent Citations

  • Construction and prediction method of carbon emission prediction model based on Stacking algorithm and medium

    CN115860173A

  • Regional carbon emission prediction method based on XGBoost

    CN117521870A

  • Carbon emission prediction method based on energy data

    CN117634693A

  • Carbon emission prediction method, electronic equipment and computer readable medium

    CN117875481A

Cited By

  • Carbon emission prediction method and device based on relation between capture variables and medium

    CN120087979A

  • Carbon emission trend prediction method and device and nonvolatile storage medium

    CN121072848A

  • Method and system for predicting discharge voltage of voltage-sharing ball-ground gap

    CN121388410A

  • Carbon footprint evaluation method, system and equipment of electrical equipment and storage medium

    CN122047768A