Load forecasting model combination method based on shapley value
By combining load forecasting models based on Shapley values and dynamically updating weight coefficients, the problem of insufficient accuracy of single models in short-term and very short-term forecasting is solved, achieving higher forecast accuracy and robustness, and supporting the development of new power systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTHEAST UNIV
- Filing Date
- 2023-10-07
- Publication Date
- 2026-07-10
AI Technical Summary
Existing load forecasting models are difficult to improve in terms of accuracy in short-term and very short-term user forecasts. Single models have problems such as difficulty in judging load abrupt changes and overfitting, resulting in insufficient forecast accuracy.
A load forecasting model combination method based on Shapley values is adopted. By constructing the historical forecasting errors and weight coefficients of multiple individual forecasting models, the historical contribution of each model is calculated using Shapley values, and the weight coefficients are dynamically updated to optimize the combined forecasting results.
It improves the accuracy of short-term and very short-term load forecasting for users, achieving higher accuracy and robustness with less time cost, and promoting the construction of new power systems.
Smart Images

Figure CN117332880B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power system technology, and relates to power system load forecasting technology, specifically to a method for combining load forecasting models based on Shapley values. Background Technology
[0002] With the rapid development of global energy transition and smart grids, more emerging distributed energy sources are entering the grid, replacing traditional power generation and posing significant challenges to the balance of power supply and demand. Currently, China is vigorously developing power system demand response, which involves encouraging users to adjust their electricity consumption behavior within a specific time frame to alleviate peak load pressure on the power system and improve its reliability and stability. Analyzing historical load data can provide some insight into a user's load situation. Therefore, power grid companies need accurate power load forecasting information to ensure power supply and demand balance and improve operational economics. Simultaneously, a series of power system-related energy optimization issues also require reliable load forecasting as a guarantee, placing higher demands on improving the accuracy of load forecasting.
[0003] Scholars both domestically and internationally have developed various load forecasting schemes, with popular forecasting methods including multiple regression algorithms, artificial neural networks (ANN), support vector machines (SVM), and time series analysis. However, in practical applications of load forecasting, single models often have many drawbacks, such as difficulty in identifying load abrupt changes and the potential for overfitting in complex models, leading to insufficient forecasting accuracy. Summary of the Invention
[0004] To address the aforementioned issues, this invention takes power system user load forecasting as an example, combining the advantages of multiple individual forecasting models and considering the impact of historical weighting coefficients on the combined results. With the objective of minimizing the forecasting error rate, it proposes a load forecasting model combination method based on Shapley values. This invention establishes a model combination framework that considers the historical forecasting errors of multiple individual models and calculates the historical weighted forecasting contribution of each individual model based on Shapley values. By considering the contribution of each model to reducing the overall forecasting error in each weighted combination, and updating the weighting coefficients, higher forecasting accuracy is achieved.
[0005] To achieve the above objectives, the present invention provides the following technical solution:
[0006] The load forecasting model combination method based on Shapley values includes the following steps:
[0007] Multiple single prediction models are built and trained on preprocessed historical data.
[0008] The virtual prediction period is predicted and the prediction results of each individual prediction model are obtained. The initial weight values of the individual models are obtained through the optimal combination method.
[0009] A multi-model linear weighted combination model for short-term load forecasting of power system users is constructed based on the prediction results of a single forecast model and the output contribution.
[0010] In actual forecasting, each individual forecasting model is called to perform short-term forecasts on the forecast date, and the initial weights obtained from the virtual forecast period are weighted to obtain the initial weighted forecast result; the Shapley value of each model is calculated to obtain the contribution of each model, the model weights are updated based on the contribution of each model, and the final forecast result is obtained by linearly weighting the multiple models.
[0011] Furthermore, the ensemble framework consists of data processing, model training, weight initialization, calculation of Shapley values for model history ensembles, and a weighted ensemble module; the multi-model linear weighted ensemble model is shown below:
[0012]
[0013] In the formula P total P is the predicted load value after weighted combination of each individual model on the day to be predicted. i K is the virtual prediction result of the model for the i-th day to be predicted. i These are the combination coefficients of the i-th model for the day to be predicted;
[0014]
[0015] The optimized model for obtaining the initial weights of a single model using the optimal combination method is shown below:
[0016]
[0017] st0≤k i <1 (a2)
[0018]
[0019] In the formula, It is the virtual prediction result of the i-th model at time t. These are the combination coefficients to be determined for the i-th model at time t. It is the actual load value at time t.
[0020] Furthermore, the initial values of the single model weights are obtained using the least squares method.
[0021] Furthermore, the Shapley value is used to determine the contribution of each model to historical predictions.
[0022] Furthermore, the formulas for calculating the Shapley values of each model's historical combinations are as follows:
[0023]
[0024] Where S is the set of all models used for prediction, i is the sample to be explained, and n is the number of models;
[0025] δi(S)=v(S∪{i})-v(S) (a5)
[0026] δi(S) represents the marginal contribution of model i to the reduction of the final prediction error when added to set S, and the value function v(S) represents the contribution of the weighted prediction results obtained from model set S to the reduction of error, i.e.:
[0027]
[0028] In the formula, |S| refers to the number of models in the current set. Based on the Shapley value of each model, the contribution of each model can be determined, i.e.:
[0029]
[0030] Normalizing the contribution of each model yields the following formula for updating the combined model weights K:
[0031]
[0032] Furthermore, in the process of updating model weights, the initial values of the weight coefficients are first obtained through the optimal combination method. After each prediction, the combined weights are iteratively updated based on the model prediction contribution determined by the Shapley value. The contribution of each model to the reduction of the overall prediction error in each model combination is summed to obtain the total contribution of a single model in historical predictions, and the weight coefficients are updated accordingly.
[0033] The present invention also provides a load forecasting model combination device based on Shapley values, including a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to execute the computer program to implement the aforementioned load forecasting model combination method based on Shapley values.
[0034] The present invention also provides a computer-readable storage medium storing a computer program that, when executed, implements the aforementioned method for combining load forecasting models based on Shapley values.
[0035] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0036] 1. This invention addresses the problem that the accuracy of a single model is difficult to further improve in short-term and very short-term load forecasting. It normalizes the weight coefficients obtained from the historical forecasting results of a single model through the optimal combination method to obtain the initial values of the weighting coefficients. Then, by using a load forecasting model combination method based on Shapley values, it fully utilizes the advantages of multiple models and dynamically updates the weights according to the historical weighted contributions, thereby obtaining better load forecasting results.
[0037] 2. This invention can calculate the contribution of different models to the reduction of combined prediction error in historical forecasts, determine the weighting coefficients of the model combination based on the contribution of each model, and then weight them to obtain the final result. Through the calculation method of historical weighted contribution, this invention can adaptively adapt to changes in the overall prediction error of multiple models in weighted prediction, obtaining more accurate prediction results.
[0038] 3. The method of this invention can achieve higher short-term user forecast accuracy with less time cost, further improve the accuracy of short-term and very short-term load forecast, improve the accuracy and robustness of the forecast model in practical applications, and promote the construction of new power systems. Therefore, it has extremely important significance. Attached Figure Description
[0039] Figure 1 This diagram illustrates the training of a single model.
[0040] Figure 2 Update the framework diagram for the combined weight coefficients based on Shapley values.
[0041] Figure 3 The overall flowchart of the load forecasting model combination method based on Shapley values provided by this invention is shown in the figure. Detailed Implementation
[0042] The technical solutions provided by the present invention will be described in detail below with reference to specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention.
[0043] This invention establishes a model combination framework that considers the historical prediction errors of multiple individual models and calculates the historical weighted combination contribution of each individual model based on Shapley values. First, the initial weights of each individual model are determined through an optimal combination scheme. Then, a multi-model linear weighted combination model for short-term load forecasting of power system users is constructed based on the historical combined output contributions of each model. The weight coefficients are dynamically updated during practical application. The combination framework of this invention consists of data processing, model training, weight initialization, calculation of historical combined Shapley values of models, and a weighted combination module. First, the initial weights of each individual model are determined through an optimal combination scheme. Then, a multi-model linear weighted combination model for short-term load forecasting of power system users is constructed based on the historical combined output contributions of each model. The weight coefficients are dynamically updated during practical application.
[0044] The training process of a single model designed in this invention is as follows: Figure 1 As shown, after data processing and feature engineering of data such as the user's historical load and the weather in the user's location, a time series statistical model and a tree model neural network model are constructed and trained.
[0045] like Figure 2 As shown, the framework for updating the combined weight coefficients based on Shapley values includes three steps:
[0046] 1. Obtain the initial values of the weighted combination coefficients using the optimal combination method;
[0047] 2. Calculate the historical weighted prediction contribution of a single model and update the weight coefficients;
[0048] 3. The final prediction result is obtained by weighting the prediction results of the individual models.
[0049] In the process of determining the weight coefficients of the model combination, the initial values of the weight coefficients are first obtained through the optimal combination method. After each prediction, the combination weights are iteratively updated based on the model prediction contribution determined by the Shapley value. The contribution of each model to the reduction of the overall prediction error in each model combination is summed to obtain the total contribution of a single model in historical predictions. The weight coefficients are updated accordingly to improve the accuracy of the combined prediction.
[0050] Based on the established model combination framework Figure 3 The flowchart of the load forecasting model combination method based on Shapley values provided by the present invention includes the following steps:
[0051] First, build and train multiple single prediction models on historical data that has undergone data preprocessing.
[0052] The weight initialization process involves forecasting the virtual forecast period and obtaining the forecast results of each individual model, and then using the least squares method to obtain the initial values of the weighting coefficients of the individual models.
[0053] Finally, model predictions are performed on the predicted date, and model weights are updated based on Shapley values. The final prediction result is obtained by weighting the coefficients.
[0054] Furthermore, the model will be updated when a single model reaches a certain error limit. By ensuring the prediction accuracy of the individual models and setting appropriate weighting coefficients, the prediction accuracy of the final weighted combined model can be improved.
[0055] The final weighted combination model constructed by this invention is shown below:
[0056]
[0057] In the formula P total P is the predicted load value after weighted combination of each individual model on the day to be predicted. i K is the virtual prediction result of the model for the i-th day to be predicted. i It is the combination coefficient of the i-th model for the day to be predicted.
[0058]
[0059] We guarantee that the linear weighting coefficients of each model will be 1 after each iteration, and will be between 0 and 1.
[0060] The optimization model for initializing the K value using the optimal combination method is shown below:
[0061]
[0062] st0≤k i In equation <1 (a2), It is the virtual prediction result of the i-th model at time t. These are the combination coefficients to be determined for the i-th model at time t. It is the actual load value at time t;
[0063]
[0064] The final weighting coefficients are obtained by normalizing the results of each model, ensuring that the linear weighting coefficients of each model are 1 after each iteration, thus improving the weighting robustness.
[0065] The formulas for calculating the Shapley value of each model's historical combination are as follows:
[0066]
[0067] Where S is the set of all models used for prediction, i is the sample to be explained, and n is the number of models. The weights in Equation a4 refer to the total number of n models. Considering the order, these n models have n! combinations. If a certain model i is fixed, then there are (n-|S|-1)! *|S|! combinations remaining.
[0068] δi(S)=v(S∪{i})-v(S) (a5)
[0069] δi(S) represents the marginal contribution of model i to the reduction of the final prediction error when added to set S, and the value function v(S) represents the contribution of the weighted prediction results obtained from model set S to the reduction of error, i.e.:
[0070]
[0071] In the formula, |S| refers to the number of models in the current set. Based on the Shapley value of each model, we can determine the contribution of each model, that is:
[0072]
[0073] Normalizing the contribution of each model yields the following formula for updating the combined model weights K:
[0074]
[0075] This invention implements the overall process of a load forecasting model combination method based on Shapley values using a Python program and multiple open-source machine learning libraries. The algorithm was validated on three different types of user data in a region of Jiangsu Province. Load data, weather data, and date information were used as sample data for load forecasting, including hourly load data for the three users, temperature, air pressure, precipitation, and humidity for the region every three hours, and corresponding date and holiday information.
[0076] Load data is divided into three datasets based on users. Weather data is preprocessed through interpolation to correspond to hourly load data, and the mean absolute error percentage E is selected. MAPE (a9) serves as an evaluation index for load forecasting results.
[0077]
[0078] In this case, the present invention uses eight single models to train the processed data, and dynamically adjusts the weights based on the obtained prediction results to obtain the final output. In this case, the desired result is the user day-ahead load prediction result. Therefore, the weight of the prediction at each time point is determined based on the weighted contribution of the virtual predictions of the previous few days based on the Shapley value.
[0079] First, the weights are initialized using virtual prediction results. Then, the contribution of the initialized weights is iteratively calculated and the weights are updated. In this case, the time period for determining the initial weight values is 1 day, and the time period for calculating the contribution is 10 days.
[0080] Table 1-3 shows the weight coefficients of each model for the three users on the last day:
[0081] Table 1. Weighting coefficients of each model for User 1 on the last day.
[0082]
[0083]
[0084] Table 2 Weighting coefficients of each model for User 2 on the last day
[0085] User 2 Limit Tree Random Forest Xgboost LightGBM AETS Tbats ES AARIMA 0:00 0.13154084 0.191588543 0.072756348 0.107243482 0.025155558 0.1412281 0.114879481 0.215607648 1 o'clock 0.472765812 0.167658773 0.065117417 0.072688881 0.001213483 0.067183408 0.043710875 0.109661349 2 o'clock 0.142916253 0.415259055 0.095154705 0.027542909 0.007838577 0.306328395 0.002480051 0.002480055 3 o'clock 0.480015177 4.28657E-07 0.012095247 0.027835873 7.8202E-07 4.95196E-05 0.400000998 0.080001975 4 o'clock 0.480629683 0.07321486 0.020975641 0.059917906 0.055636561 0.269595848 0.008964735 0.031064766 5 o'clock 0.093085372 0.136003626 0.191582814 0.062036456 0.298345989 0.056302879 0.045381892 0.117260972 6 o'clock 0.147196164 0.03676985 0.089740087 0.001699527 0.222606368 0.466153907 0.000438544 0.035395554 7 o'clock 0.090862631 0.4824 0.090165915 0.002608776 0.002400003 0.326080281 0.002401683 0.003080711 8 o'clock 0.34840834 0.108274378 0.212538055 0.084980634 3.36678E-10 0.063929772 0.11063149 0.07123733 9 o'clock 0.133218115 0.045551169 0.000869887 0.032856813 3.3321E-05 0.548287118 0.110702314 0.128481262 10 o'clock 0.038245011 0.014081327 0.005771978 6.61915E-05 8.90768E-06 0.9007085 0.041105166 1.29183E-05 11 o'clock 9.98655E-07 0.078951658 0.004556727 0.000128 1.27549E-05 0.55356143 0.348796949 0.013991484 12 o'clock 0.012412205 0.003742212 0.00179729 0.094704318 0.004594621 0.880020688 0.000665698 0.00206297 13 o'clock 0.412102785 0.180530122 0.01499624 0.246145013 0.073325096 0.06791169 0.004540259 0.000448795 2 PM 0.337301162 0.451929493 0.015217691 0.042407776 0.000576304 0.145614461 0.004365249 0.002587864 3 PM 0.436166686 0.061046156 0.075416671 0.002940546 0.069734858 0.157428256 0.105135988 0.092130841 4 PM 0.268935239 0.048553813 0.00434936 0.031008819 2.57944E-05 0.44025427 0.029958598 0.176914107 5 PM 0.02633475 0.103416564 0.063138516 0.055354676 0.11667401 0.218637431 0.416177596 0.000266457 6 PM 0.501293208 0.07375483 0.145147355 0.064666111 0.046547717 0.110591999 0.020108912 0.037889869 7 p.m. 0.010889822 0.00053679 0.023759053 0.705790837 0.057410483 0.000610706 0.007830749 0.193171559 8 PM 0.104258628 0.000624052 0.282040727 0.378156851 0.075282792 0.000345253 0.136327162 0.022964535 21 points 0.173162847 0.123125849 0.152744616 0.302034737 0.05778798 0.058514723 0.070294604 0.062334645 10 PM 0.095447936 0.003758698 0.503918969 0.09861757 0.136675183 0.063498117 0.074551978 0.023531548 11 PM 0.001194423 0.41606655 0.382231949 0.080208229 0.003351004 6.6494E-06 0.105289999 0.011651196
[0086] Table 3: Weighting coefficients of each model for User 3 on the last day.
[0087]
[0088]
[0089] As can be seen from the above weight coefficients, the combined weight coefficient update framework based on Shapley values proposed in this invention can effectively select the dominant model at a single point in time and dynamically update to ensure the balance of weight coefficient distribution and the differentiation of weight coefficients at different points in time, thus exhibiting good generalization ability.
[0090] The final results obtained by the three users, showing the percentage of the mean absolute error of the single model's predictions on the test set, are shown in Table 4.
[0091] Table 4 Comparison of Results from Different Prediction Models
[0092]
[0093] The combined method mentioned in this invention and the combined method used for comparison predicting the mean absolute error percentage results are shown in Table 5:
[0094] Table 5 Comparison of results from different prediction combination models
[0095] Average combination Optimal combination This invention combines User 1 18.66% 18.69% 12.60% User 2 9.54% 8.87% 8.52% User 3 2.57% 1.81% 0.90%
[0096] The above results demonstrate that the combined weighting coefficients based on Shapley values proposed in this invention can reduce the error rate of the final weighted prediction result on different datasets, and surpass other combination methods. Therefore, the method proposed in this invention achieves the goal of improving prediction accuracy through weighted combined prediction.
[0097] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0098] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0099] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0100] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0101] The technical means disclosed in this invention are not limited to those disclosed in the above embodiments, but also include technical solutions composed of any combination of the above technical features. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications are also considered within the scope of protection of this invention.
Claims
1. A load forecasting model combination method based on Shapley values, characterized in that, Includes the following steps: Multiple single prediction models are built and trained on preprocessed historical data. The virtual prediction period is predicted and the prediction results of each individual prediction model are obtained. The initial weight values of the individual models are obtained through the optimal combination method. A multi-model linear weighted combination model for short-term load forecasting of power system users is constructed based on the prediction results of a single forecasting model and the output contribution. The multi-model linear weighted combination model is shown below: In the formula It is the predicted load value after weighted combination of each individual model on the date to be predicted. This is the virtual prediction result of the i-th model for the day to be predicted. These are the combination coefficients of the i-th model for the day to be predicted; The optimized model for obtaining the initial weights of a single model using the optimal combination method is shown below: In the formula, It is the virtual prediction result of the i-th model at time t. These are the combination coefficients to be determined for the i-th model at time t. It is the actual load value at time t; For the forecast date, each individual forecasting model is used to perform short-term forecasts, and the initial weights obtained from the virtual forecast period are weighted to obtain an initial weighted forecast result. The Shapley value of each model is calculated to obtain its contribution. Based on each model's contribution, the model weights are updated. The final forecast result is obtained by linearly weighting the multiple models. The formula for calculating the historical combination Shapley value of each model is as follows: (a4) Where S is the set of all models used for prediction, i is the sample to be explained, and n is the number of models; (a5) The value function represents the marginal contribution of adding model i to set S to reduce the final prediction error. The weighted prediction result obtained from the model set S represents the contribution of the weighted prediction result to the error reduction, i.e.: (a6) In the formula, This refers to the number of models in the current set. Based on the Shapley value of each model, the contribution of each model can be determined, i.e.: (a7) Normalizing the contribution of each model yields the following formula for updating the combined model weights K: = (a8)。 2. The load forecasting model combination method based on Shapley values according to claim 1, characterized in that, The initial values of the single model weights are obtained using the least squares method.
3. The load forecasting model combination method based on Shapley values according to claim 1, characterized in that, The Shapley value is used to determine the contribution of each model to historical predictions.
4. The load forecasting model combination method based on Shapley values according to claim 1, characterized in that, In the process of updating model weights, the initial values of the weight coefficients are first obtained through the optimal combination method. After each prediction, the combined weights are iteratively updated based on the model prediction contribution determined by the Shapley value. The contribution of each model to the reduction of the overall prediction error in each model combination is summed to obtain the total contribution of a single model in historical predictions, and the weight coefficients are updated accordingly.
5. A load forecasting model combination device based on Shapley values, comprising a processor and a memory, wherein the memory is used to store computer programs, characterized in that, The processor is used to execute the computer program to implement the load forecasting model combination method based on Shapley values as described in any one of claims 1 to 4.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed, implements the load forecasting model combination method based on Shapley values as described in any one of claims 1 to 4.