Power grid load prediction method and device based on XGBoost model, and medium
By decomposing grid load data into trend, seasonal, and residual components and combining them with the XGBoost model for grid load forecasting, the problem of limited accuracy in grid load forecasting in existing technologies is solved, and high-precision forecasting of complex power loads is achieved.
Patent Information
- Application Number
- CN202610024591.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-09
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2046-01-09
AI Technical Summary
Existing power grid load forecasting methods fail to effectively handle the multi-scale information and different levels of characteristics of load data, resulting in limited forecast accuracy, especially when faced with complex power load characteristics and the influence of multiple factors.
A power grid load forecasting method based on the XGBoost model is adopted. The historical load data of the power grid is decomposed into three components: trend, seasonal and residual. The optimal modeling strategy is used to process each component. The forecasting is carried out by combining ARMA, Fourier regression and AR models. Finally, the data is fused by the XGBoost model.
It significantly improves the model's adaptability to complex load patterns, reduces data noise interference, maintains the stability and accuracy of long-term forecasts, captures the influence of multiple factors, and improves the robustness and accuracy of forecasts.
Smart Images

Figure CN121529545A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a power grid load forecasting method, device, and medium based on the XGBoost model, belonging to the field of power grid load forecasting technology. Background Technology
[0002] In today's rapidly developing society, electricity demand is increasing daily. As a crucial link in power system operation and planning, grid load forecasting plays a vital role in ensuring the safe, economical, and efficient operation of the power grid. Its forecasting results directly influence the scientific arrangement of power generation plans, the precise optimization of transmission dispatch, and the informed decisions in electricity market transactions.
[0003] However, power grid load forecasting is facing numerous challenges. On the one hand, with rapid economic development and continuous improvement in people's living standards, the characteristics of power load have become increasingly complex, influenced by a combination of factors such as economic development level, population growth trend, industrial restructuring, changes in meteorological conditions, social activities, and policy and regulatory guidance. These factors are interconnected and interact with each other, resulting in load data exhibiting significant nonlinear, time-varying, and uncertain characteristics.
[0004] On the other hand, the continuous expansion of the power system and its increasing structural complexity have further exacerbated the difficulty and complexity of power grid load forecasting. Currently, many existing forecasting methods tend to focus only on a single characteristic of load data, neglecting the multi-scale information and different levels of features contained within the load data. In fact, power grid load data not only contains long-term trend changes but also exhibits seasonal periodic fluctuations, and is also subject to interference from short-term random factors. Summary of the Invention
[0005] To address the problems existing in the prior art, this invention proposes a power grid load forecasting method, device, and medium based on the XGBoost model.
[0006] The technical solution of the present invention is as follows: On the one hand, this invention provides a power grid load forecasting method based on the XGBoost model, comprising the following steps: Acquire historical load data of the power grid, and obtain trend components, seasonal components, and residual components based on the historical load data of the power grid; Calculate the first difference of the trend component, fit the first difference to an ARMA model, and use the maximum likelihood method to obtain the optimal parameters of the ARMA model; A Fourier regression model is fitted to the seasonal components, and the optimal parameters of the Fourier regression model are obtained by using the least squares method. An AR model is fitted to the residual component, and the optimal parameters of the AR model are obtained by using the least squares method. Predict the first load of the power grid based on the optimal parameters of the ARMA model, the optimal parameters of the Fourier regression model, and the optimal parameters of the AR model. Obtain grid load-related data and input the grid load-related data into the XGBoost model for training; Predict the second load on the power grid using the trained XGBoost model; The first load and the second load of the power grid are weighted and merged to obtain the power grid load.
[0007] Preferably, the trend component, seasonal component, and residual component are obtained based on the historical load data of the power grid, and the specific steps are as follows: We construct fitting terms and smoothing terms for historical load data and trend components of the power grid, and construct a trend objective function that minimizes the sum of the fitting and smoothing terms, expressed by the formula: ; ; In the formula, Indicates the length of historical time. Indicates historical time Historical load data, Trend component In historical time The power value, This represents the trend component that minimizes the sum of the fitted term and the smoothing term. Indicates the trend smoothing coefficient. Trend component In historical time The power value, Trend component In historical time The power value, Represents the fitted term, Indicates the smoothing term; Solve the trend objective function to obtain the optimal trend component; Based on the trend component, the historical load data after removing the trend is obtained, which is expressed by the formula: ; In the formula, Indicates historical time Historical load data after removing trends; Seasonal components are obtained based on the load power after removing trends from historical load data, expressed by the formula: ; ; ; In the formula, Indicates seasonal components In seasonal position Average power value, Indicates seasonal cycles, Indicates index The corresponding date number, This represents the modulo equivalence operator. Modulo operation is represented. Indicates index from =1 starts, if index Corresponding date number Meet the conditions Then regarding historical time Historical load data after removing trends Accumulate. This indicates that the condition is met. index Quantity, Indicates seasonal components In historical time The power value; The residual component is obtained based on the seasonal component, trend component, and historical load data, and is expressed by the formula: ; In the formula, Residual component In historical time The load power.
[0008] Preferably, the first difference of the trend component is calculated, expressed by the formula: ; In the formula, This indicates the trend component in historical time. The first-order difference; The first-order difference-fitted ARMA model can be expressed by the following formula: ; In the formula, Represents the first power constant term. Indicates the order of autoregression. Indicates the order of the moving average. Indicates the first Autoregressive coefficient of order, Indicates historical time The first difference, Indicates historical time White noise, Indicates the first Moving average coefficient, Indicates historical time White noise; The optimal parameters of the ARMA model are obtained using the maximum likelihood method, expressed by the following formula: ; In the formula, Represents the likelihood function. Represents white noise standard deviation Indicates that it is taken from the regression order. and moving average order The maximum value in.
[0009] Preferably, a Fourier regression model is fitted to the seasonal component, expressed by the formula: ; In the formula, This represents the second power constant term. This represents the number of terms in the Fourier series. In the Fourier series, the first... The coefficients of the sinusoidal term of each frequency component, Indicates the first Sine basis functions of each frequency component, In the Fourier series, the first... The cosine coefficients of each frequency component Indicates the first Cosine basis functions for each frequency component. This indicates that Fourier regression occurred in historical time. The fitting error; The optimal parameters of the Fourier regression model are obtained using the least squares method, expressed by the following formula: ; In the formula, This indicates taking the minimum seasonal component. Sum of squares of errors with the prediction results of the Fourier regression model The parameters of the corresponding Fourier regression model.
[0010] Preferably, the AR model fitted to the residual component is expressed by the following formula: ; In the formula, Indicates the order of the AR model. Indicates the AR model's first... Autoregressive coefficient of order, Residual component In historical time The load power, Indicates the AR model in historical time Error term; The optimal parameters of the AR model are obtained using the least squares method, expressed by the following formula: ; In the formula, This indicates taking the minimum residual component. Sum of squares of errors with AR model predictions The parameters of the corresponding AR model.
[0011] Preferably, the optimal parameters for predicting the primary load of the power grid are obtained from the optimal parameters of the ARMA model, the optimal parameters of the Fourier regression model, and the optimal parameters of the AR model. The specific steps are as follows: ; In the formula, Indicates time The first difference, Indicates time The first difference, Indicates time White noise; Based on time First-order difference trend acquisition component In time The power value is expressed by the formula: ; In the formula, Trend component In time The power value, Trend component In time The power value; The Fourier regression model is used to predict seasonal components based on the optimal parameters. In time The power value is expressed by the formula: ; In the formula, Indicates seasonal components In time The power value; Based on the optimal parameters of the AR model, the residual component is predicted using the AR model. In time The load power is expressed by the formula: ; In the formula, Residual component In time The load power, Residual component In time The load power; Based on trend components In time Power values, seasonal components In time Power values and residual components In time The load power is used to obtain the first load of the power grid, which can be expressed by the formula: ; In the formula, Indicates time The first load on the power grid.
[0012] Preferably, the power grid load-related data is input into the XGBoost model for training, and the specific steps are as follows: Historical power grid load data is obtained and input into the XGBoost model for offline learning and training; The grid load contribution score of each grid load-related data in each decision tree of the XGBoost model after offline learning and training is calculated and expressed by the formula: ; In the formula, This indicates that the grid load-related data is in the first... The grid load contribution score of each decision tree. This indicates that the grid load-related data is in the first... The first decision tree The number of times the layer splits, This indicates that the grid load-related data is in the first... The first decision tree The sum of the gain values of the layers, This indicates that the grid load-related data is in the first... The first decision tree Layers are used to represent the sum of the amount of data involved in splitting. Indicates the first The first decision tree Layer weights, Indicates the splitting factor. Indicates the gain factor. Indicates the coverage factor; The weights are expressed by the formula: ; In the formula, Indicates the first The depth of each decision tree; Set the contribution threshold Q; Real-time grid load-related data is acquired and input into the XGBoost model for online learning and training. Specifically, each decision tree of the XGBoost model selects the grid load-related data corresponding to the top R grid load contribution scores, sorted from high to low, based on the contribution threshold Q, for online learning and training.
[0013] Preferably, historical power grid load-related data is obtained and input into the XGBoost model for offline learning and training. The specific steps are as follows: S611, Historical Time The grid load-related data is input into the first decision tree of the XGBoost model, and is presented in historical time. The load power is used as the learning target to train the system and obtain the first prediction result. Among them, the power grid load-related data includes load power, time characteristic data, meteorological environment data, and economic and calendar event data; S612, Historical Time The grid load-related data is input into the second decision tree of the XGBoost model, and the first prediction result is compared with historical time data. The residual of the load power is used as the new learning target to train and obtain the second prediction result; S613, Transfer the first prediction result to the... The prediction results are merged into sub-prediction results, and historical time is included. The grid load-related data is input into the XGBoost model. In the decision tree, based on historical time The residual between the load power and the sub-prediction results is used as the new learning objective to train the system and obtain the first... The prediction result is expressed by the formula: ; In the formula, Indicates historical time Data related to power grid load, This indicates the first prediction result. This indicates the second prediction result. Indicates the first Prediction results Indicates the first A decision tree, Indicates the first Prediction results; S614, if If the number of executions is less than the preset maximum number, proceed to step S613; otherwise, proceed to step S615. S615, Transfer the first prediction result to the... The prediction results are fused together as historical time predictions from the XGBoost model. The load power; The objective function of the XGBoost model is expressed by the formula: ; In the formula, Let represent the objective function of the XGBoost model. This represents the mean square error function. Indicates historical time The load power, This represents the historical time predicted by the XGBoost model. The load power, Indicates the first The complexity of a decision tree.
[0014] In another aspect, the present invention also provides an electronic device having a computer program stored thereon, which, when executed by a processor, implements the grid load forecasting method based on the XGBoost model as described in any embodiment of the present invention.
[0015] In another aspect, the present invention also provides a computer-readable storage medium for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the grid load forecasting method based on the XGBoost model as described in any embodiment of the present invention.
[0016] The present invention has the following beneficial effects: 1. This invention achieves modular processing of load characteristics by decomposing non-stationary load data into three major components: trend, seasonality, and residuals. This decomposition allows each component to be matched with an optimal modeling strategy, significantly improving the model's adaptability to complex load patterns while reducing data noise interference.
[0017] 2. This invention employs a first-order difference processing trend component, enabling the ARMA model to accurately capture the autocorrelation structure and moving average characteristics of load changes. This makes trend prediction more closely aligned with actual fluctuation patterns, providing a more stable trend benchmark for long-term load forecasting.
[0018] 3. By incorporating multidimensional data such as historical load, temporal characteristics, meteorological environment, and economic events, this invention enables the XGBoost model to comprehensively capture the diverse factors affecting load. Combining contribution scores to filter high-value data optimizes model training efficiency and allows the model to dynamically adapt to load changes through online learning, maintaining long-term prediction accuracy.
[0019] 4. The present invention accurately characterizes the inherent laws of load change by decomposing the first load of the power grid in three dimensions: trend-seasonal-residual. The ARMA model captures the autocorrelation characteristics of long-term trends to ensure that the prediction direction is consistent with the historical development. The Fourier regression model decomposes seasonal fluctuations with parameterized harmonics to avoid overfitting while retaining periodic characteristics. The AR model mines the short-term autocorrelation in the residuals and transforms traditional noise into predictable signals.
[0020] The second load of the power grid integrates multi-dimensional external factors such as time characteristics, meteorological environment, and economic events through the ensemble learning characteristics of XGBoost. Its nonlinear modeling capability can capture complex relationships that are difficult to quantify using traditional methods, such as the heterogeneous impact of holidays on industrial loads and the lag effect of sudden temperature rises on residential electricity consumption.
[0021] The integration of the primary and secondary loads of the power grid achieves an organic unity of regularity and flexibility. Under normal circumstances, the primary load provides a stable trend benchmark, while the secondary load compensates for external disturbances, making the forecast results both historically consistent and realistically adaptable. In abnormal scenarios, such as extreme weather or sudden events, the rapid response characteristics of the secondary load can correct the inertial bias of the primary load, while the long-term trend constraints of the primary load can prevent excessive fluctuations in the secondary load. This integration not only improves forecast accuracy but also enhances the model's robustness. The complementarity of the two makes the forecast curve more closely reflect actual fluctuations. Attached Figure Description
[0022] Figure 1 This is a flowchart illustrating the implementation of the method in an embodiment of the present invention. Detailed Implementation
[0023] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] It should be understood that the step numbers used in the text are for ease of description only and are not intended to limit the order in which the steps are performed.
[0025] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0026] The terms “comprising” and “including” indicate the presence of the described feature, whole, step, operation, element and / or component, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.
[0027] The term “and / or” refers to any combination of one or more of the associated listed items, as well as all possible combinations, and includes these combinations.
[0028] Example 1: See Figure 1 This embodiment provides a power grid load forecasting method based on the XGBoost model, including the following steps: Power grid load power exhibits complex characteristics across multiple time scales and is simultaneously influenced by long-term trends, periodic seasonal factors, and random fluctuations. Directly modeling historical power grid load power without decomposition can lead to the model capturing mixed patterns and limiting prediction accuracy. Decomposing non-stationary historical power grid load power into three components with clear physical meaning (trend component, seasonal component, and residual component) allows each component to be processed using the most suitable mathematical model.
[0029] S1. Obtain historical load data of the power grid, and obtain trend components, seasonal components, and residual components based on the historical load data of the power grid. The specific steps are as follows: S11. Construct the fitting term and smoothing term of the historical load data and trend components of the power grid, and construct a trend objective function that minimizes the sum of the fitting term and the smoothing term, expressed by the formula: ; ; In the formula, This indicates the length of the historical time period (in this embodiment, daily load data from January 1, 2020 to January 1, 2025 were collected). =1 indicates the first day of history, i.e., January 1, 2020. =2 indicates the second day in history, i.e., January 2, 2020, and so on. The total number of days from January 1, 2020 to January 1, 2025 is 1827. Indicates historical time Historical load data (load power). Trend component In historical time The power value, This represents the trend component that minimizes the sum of the fitted term and the smoothing term. This represents the trend smoothing coefficient, which is a preset coefficient. In this embodiment, it can be set to 14400. Trend component In historical time The power value, Trend component In historical time The power value, Represents the fitted term, Indicates the smoothing term; Solve the trend objective function to obtain the optimal trend component; To efficiently obtain the solution to the trend objective function and avoid complex iterative optimization processes, the solution to the trend objective function can be expressed in matrix form, as shown by the formula: ; In the formula, Represents the identity matrix. Represents a second-order difference matrix transpose, This represents a historical load data sequence, constructed from historical load data. Second-order difference matrix For one The matrix, the second-order difference matrix The Rows contain non-zero elements in the column , and The values are 1, -2 and 1 respectively. For example, let's take 5 as an example, expressed as a formula: ; S12. Based on the trend component, obtain the load power after removing the trend from the historical load data, expressed by the formula: ; In the formula, Indicates historical time Historical load data after removing trends; Seasonal components are obtained based on the load power after removing trends from historical load data, expressed by the formula: ; ; ; In the formula, Indicates seasonal components In seasonal position Average power value, Indicates the seasonal cycle (if the cycle is annual). =365, seasonal location It refers to a specific day of the year, for example... =1 represents the first day of each year, i.e., January 1st. Indicates index The corresponding date number (for example, January 1st of each year is numbered 1, that is, January 1st, 2020, January 1st, 2021, and January 1st, 2022 are all numbered 1). This represents the modulo equivalence operator. Modulo operation is represented. Indicates index from =1 starts, if index Corresponding date number Meet the conditions Then regarding historical time Historical load data after removing trends Accumulate. This indicates that the condition is met. index Quantity (e.g., seasonal location) =2, then there are a total of 5 days from January 1, 2020 to January 1, 2025 that meet the condition. ,Right now =5), Indicates seasonal components In historical time The power value; S13. Obtain the residual component based on the seasonal component, trend component, and historical load data, expressed by the formula: ; In the formula, Residual component In historical time The load power.
[0030] Load data typically exhibits a slowly changing, smooth curve, which is smoothed by a trend smoothing coefficient. The smoothness is controlled to perfectly suit this characteristic. The seasonal component is calculated using the periodic averaging method, which is based on the prior knowledge that the power load has a stable annual or weekly cycle. Random noise is eliminated by averaging historical data from the same seasonal location to extract a pure seasonal pattern. The residual component, as the part remaining after deducting the trend and seasonality, includes short-term fluctuations and the impact of special events that were not explained by the former two.
[0031] S2. Calculate the first difference of the trend component, fit the first difference to an ARMA model, and use the maximum likelihood method to obtain the optimal parameters of the ARMA model. The specific steps are as follows: S21. Calculate the first difference of the trend component, expressed by the formula: ; In the formula, This indicates the trend component in historical time. The first-order difference; The purpose of fitting the first-order difference to the ARMA model is to accurately capture the first-order difference. The autocorrelation structure and moving average properties of [the material]. First-order difference. It represents the daily variation of load trends, has stability, and is suitable for modeling using the ARMA model.
[0032] S22. The first-order difference-fitted ARMA model is expressed by the following formula: ; In the formula, Represents the first power constant term. Indicates the order of autoregression. Indicates the order of the moving average. Indicates the first Autoregressive coefficient of order, Indicates historical time The first difference, Indicates historical time White noise, Indicates the first Moving average coefficient, Indicates historical time White noise; Autoregressive part It captures the first-order difference. The autocorrelation structure, i.e., how current trend changes are influenced by past trends. The impact of trend changes during the period. In the context of grid load, this reflects the inertia effect of load changes.
[0033] Moving average portion Describes random shocks (i.e., white noise) The ongoing impact of these shocks. In power systems, these shocks can originate from various external events: sudden changes in temperature, unexpected equipment failures, etc. Moving average coefficient. Quantifying these impacts in the future The lasting effects during the period. For example, an extreme weather event will not only affect the load on that day, but its effects may last for several days. The moving average component is designed to capture the dynamic patterns of this impact propagation.
[0034] S23. The optimal parameters of the ARMA model are obtained using the maximum likelihood method, expressed by the formula: ; In the formula, Represents the likelihood function. Represents white noise standard deviation For variance, Indicates that it is taken from the regression order. and moving average order The maximum value in; White noise is calculated recursively, as expressed by the formula: .
[0035] S3, for the seasonal components Fit a Fourier regression model and use the least squares method to obtain the optimal parameters of the Fourier regression model. The specific steps are as follows: S31, Regarding the seasonal component The fitted Fourier regression model is expressed by the following formula: ; In the formula, This represents the second power constant term. This represents the number of terms in the Fourier series. In the Fourier series, the first... The coefficients of the sinusoidal term of each frequency component, Indicates the first Sine basis functions of each frequency component, In the Fourier series, the first... The cosine coefficients of each frequency component Indicates the first Cosine basis functions for each frequency component. This indicates that Fourier regression occurred in historical time. The fitting error; S32. The optimal parameters of the Fourier regression model are obtained using the least squares method, expressed by the formula: ; In the formula, This indicates taking the minimum seasonal component. Sum of squares of errors with the prediction results of the Fourier regression model The parameters of the corresponding Fourier regression model, that is, the optimal parameters of the Fourier regression model; The Fourier regression model is a standard linear model. When solving for the optimal parameters of the Fourier regression model, the solution can be represented in matrix form, as shown by the formula: ; In the formula, This represents the optimal parameter vector of the Fourier regression model. Represents the parameter design matrix Transpose of; By using matrix form, the least squares optimization problem is transformed into a linear system with an exact analytical solution, thus avoiding the complex and potentially unstable iterative search process.
[0036] The optimal parameter vector of the Fourier regression model is expressed by the formula: ; Parameter design matrix For one The matrix, with =365, =2, For example, let's take 3 as an example, expressed as a formula: .
[0037] A parameterized and compact representation of seasonal patterns is achieved by using a Fourier regression model to process seasonal components. Traditional seasonal dummy variable methods require estimating a large number of parameters (e.g., 365 parameters are needed for an annual daily load pattern), while Fourier regression, through harmonic decomposition, can capture complex seasonal waveforms with high accuracy using only a small number of parameters. This parameter compression not only reduces the risk of overfitting but also greatly improves the computational efficiency in the forecasting stage.
[0038] S4, for the residual component Fit the AR model and use the least squares method to obtain the optimal parameters of the AR model. The specific steps are as follows: S41, for the residual component The fitted AR model can be expressed by the following formula: ; In the formula, Indicates the order of the AR model. Indicates the AR model's first... Autoregressive coefficient of order, Residual component In historical time The load power, Indicates the AR model in historical time Error term; The optimal parameters of the AR model are obtained using the least squares method, expressed by the following formula: ; In the formula, This indicates taking the minimum residual component. Sum of squares of errors with AR model predictions The parameters of the corresponding AR model, that is, the optimal parameters of the AR model.
[0039] In step S1, the residual component is defined as the remaining part of the original load data after deducting the trend and seasonal components. Theoretically, if the trend and seasonality models are perfect, the residual component should be white noise. However, in actual power grid load data, there are always some short-term dynamic fluctuations, unexpected event impacts, and fine patterns that the trend and seasonality models fail to fully capture. All this valuable information is hidden in the residual sequence. By establishing an AR model, the short-term autocorrelation in the residual sequence is systematically captured, transforming information that was originally discarded as noise into predictable signals, thus maximizing the utilization of the data's information value.
[0040] S5. Based on the optimal parameters of the ARMA model, the optimal parameters of the Fourier regression model, and the optimal parameters of the AR model, predict the first load of the power grid. The specific steps are as follows: S51. Using the optimal parameters of the ARMA model to predict time. The first difference of is expressed by the formula: ; In the formula, Indicates time The first difference, Indicates time The first difference, Indicates time White noise; S52, Time-based First-order difference trend acquisition component In time The power value is expressed by the formula: ; In the formula, Trend component In time The power value, Trend component In time The power value; S53. Using the optimal parameters of the Fourier regression model to predict seasonal components. In time The power value is expressed by the formula: ; In the formula, Indicates seasonal components In time The power value; S54. Based on the optimal parameters of the AR model, the residual component is predicted using the AR model. In time The load power is expressed by the formula: ; In the formula, Residual component In time The load power, Residual component In time The load power; S55, Trend-based Components In time Power values, seasonal components In time Power values and residual components In time The load power is used to obtain the first load of the power grid, which can be expressed by the formula: ; In the formula, Indicates time The first load on the power grid.
[0041] S6. Obtain grid load-related data and input the grid load-related data into the XGBoost model for training. The specific steps are as follows: S61. Obtain historical power grid load-related data and input it into the XGBoost model for offline learning and training. The specific steps are as follows: S611, Historical Time The grid load-related data is input into the first decision tree of the XGBoost model, and is presented in historical time. The load power is used as the learning target to train the system and obtain the first prediction result. Among them, the power grid load-related data includes load power, time characteristic data, meteorological environment data, and economic and calendar event data; The time feature data includes time information (which hour of the day), day information (day of the week, day of the month), month information (which month of the year), year information (year), holiday indicators (whether it is a statutory holiday or a weekend), and season indicators (spring, summer, autumn, winter). The meteorological and environmental data include temperature, humidity, wind speed and direction, solar radiation intensity, and weather phenomenon indicators (precipitation, sunny or cloudy). The economic and calendar event data includes time-of-use electricity prices, whether there are major sporting events or concerts, and whether there are national celebrations or events. S612, Historical Time The grid load-related data is input into the second decision tree of the XGBoost model, and the first prediction result is compared with historical time data. The residual of the load power is used as the new learning target to train and obtain the second prediction result; S613, Transfer the first prediction result to the... The prediction results are merged into sub-prediction results, and historical time is included. The grid load-related data is input into the XGBoost model. In the decision tree, based on historical time The residual between the load power and the sub-prediction results is used as the new learning objective to train the system and obtain the first... The prediction result is expressed by the formula: ; In the formula, Indicates historical time Data related to power grid load, This indicates the first prediction result. This indicates the second prediction result. Indicates the first Prediction results Indicates the first A decision tree, Indicates the first Prediction results; S614, if If the number of executions is less than the preset maximum number, proceed to step S613; otherwise, proceed to step S615. S615, Transfer the first prediction result to the... The prediction results are fused together as historical time predictions from the XGBoost model. The load power; The objective function of the XGBoost model is expressed by the formula: ; In the formula, Let represent the objective function of the XGBoost model. This represents the mean square error function. Indicates historical time The load power, This represents the historical time predicted by the XGBoost model. The load power, Indicates the first The complexity of a decision tree; S62. Calculate the grid load contribution score of each grid load-related data in each decision tree of the XGBoost model after offline learning and training, expressed by the formula: ; The equation for the power grid load contribution score is simplified and expressed as follows: ; In the formula, This indicates that the grid load-related data is in the first... The grid load contribution score of each decision tree. This indicates that the grid load-related data is in the first... The first decision tree The number of times the layer splits, This indicates that the grid load-related data is in the first... The first decision tree The sum of the gain values of the layers, This indicates that the grid load-related data is in the first... The first decision tree Layers are used to represent the sum of the amount of data involved in splitting. Indicates the first The first decision tree Layer weights, Indicates the splitting factor. Indicates the gain factor. The coverage factor, splitting factor, gain factor, and coverage factor are preset by technical personnel based on experience. The power grid load related data is in the first The grid load contribution score of each decision tree This includes load power, time information, daily information, monthly information, yearly information, holiday indicators, seasonal indicators, temperature, humidity, wind speed and direction, solar radiation intensity, weather phenomenon indicators, time-of-use pricing, whether there are large-scale sporting events or concerts, and whether there are national celebrations or events. The grid load contribution score of each decision tree; The weights are expressed by the formula: ; In the formula, Indicates the first The depth of each decision tree; S63. Set the contribution threshold Q. In this embodiment, Q is set to 9, which means that the data of 9 grid load contribution scores are selected for training from load power, time information, daily information, monthly information, annual information, holiday signs, seasonal signs, temperature, humidity, wind speed and direction, solar radiation intensity, weather phenomenon signs, time-of-use electricity price, whether there is a large-scale sports event or concert, and whether there is a national celebration or event. S64. Obtain real-time grid load-related data and input it into the XGBoost model for online learning and training; wherein, each decision tree of the XGBoost model takes the grid load-related data corresponding to the top R grid load contribution scores sorted from high to low according to the contribution threshold Q and performs online learning and training.
[0042] S7. Use the trained XGBoost model to predict the second load on the power grid.
[0043] S8. Perform weighted fusion processing on the first load of the power grid and the second load of the power grid to obtain the power grid load.
[0044] The sum of the weights of the first load and the second load is 1, with a default of 0.5 for both. If it is a holiday or extreme weather, the weight of the second load can be set higher. If the power grid load shows a trend of fluctuation with an annual or monthly cycle, the weight of the first load can be set higher.
[0045] The first load captures the regularity of the load, while the second load supplements the nonlinearity and suddenness of the load. After the two are weighted and fused, the errors compensate for each other, and the overall prediction is closer to the actual load.
[0046] Preferably, the complexity of a decision tree can be expressed by the formula: ; In the formula, Indicates the first The penalty coefficient for controlling the number of leaf nodes in a decision tree. Indicates the first The total number of tree nodes in the decision tree. Represents the regularization coefficient. Indicates the first The first decision tree The weight of each leaf node.
[0047] Example 2: This embodiment provides an electronic device that stores a computer program, which, when executed by a processor, implements the grid load forecasting method based on the XGBoost model as described in any embodiment of the present invention.
[0048] Example 3: This embodiment provides a computer-readable storage medium for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the grid load forecasting method based on the XGBoost model as described in any embodiment of the present invention.
[0049] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.
[0050] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0051] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0052] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0053] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A power grid load forecasting method based on the XGBoost model, characterized in that, Includes the following steps: Acquire historical load data of the power grid, and obtain trend components, seasonal components, and residual components based on the historical load data of the power grid; The first difference of the trend component is calculated, and an ARMA model is fitted to the first difference. The optimal parameters of the ARMA model are obtained using the maximum likelihood method. A Fourier regression model is fitted to the seasonal component, and the optimal parameters of the Fourier regression model are obtained using the least squares method. An AR model is fitted to the residual component, and the optimal parameters of the AR model are obtained using the least squares method. Based on the optimal parameters of the ARMA model, the optimal parameters of the Fourier regression model, and the optimal parameters of the AR model, the first load of the power grid is predicted. Power grid load-related data is acquired and input into the XGBoost model for training. The trained XGBoost model is used to predict the second load of the power grid; the first load and the second load of the power grid are weighted and fused to obtain the power grid load.
2. The power grid load forecasting method based on the XGBoost model according to claim 1, characterized in that, Based on the historical load data of the power grid, trend components, seasonal components, and residual components are obtained. The specific steps are as follows: We construct fitting terms and smoothing terms for historical load data and trend components of the power grid, and construct a trend objective function that minimizes the sum of the fitting and smoothing terms, expressed by the formula: ; ; In the formula, Indicates the length of historical time. Indicates historical time Historical load data, Trend component In historical time The power value, This represents the trend component that minimizes the sum of the fitted term and the smoothing term. Indicates the trend smoothing coefficient. Trend component In historical time The power value, Trend component In historical time The power value; Solve the trend objective function to obtain the optimal trend component; Based on the trend component, the historical load data after removing the trend is obtained, which is expressed by the formula: ; In the formula, Indicates historical time Historical load data after removing trends; Seasonal components are obtained based on the load power after removing trends from historical load data, expressed by the formula: ; ; ; In the formula, Indicates seasonal components In seasonal position Average power value, Indicates seasonal cycles, Indicates index The corresponding date number, This represents the modulo equivalence operator. Modulo operation is represented. Indicates index from =1 starts, if index Corresponding date number Meet the conditions Then regarding historical time Historical load data after removing trends Accumulate. This indicates that the condition is met. index Quantity, Indicates seasonal components In historical time The power value; The residual component is obtained based on the seasonal component, trend component, and historical load data, and is expressed by the formula: ; In the formula, Residual component In historical time The load power.
3. The power grid load forecasting method based on the XGBoost model according to claim 2, characterized in that, The first difference of the trend component is calculated using the following formula: ; In the formula, This indicates the trend component in historical time. The first-order difference; The first-order difference-fitted ARMA model can be expressed by the following formula: ; In the formula, Represents the first power constant term. Indicates the order of autoregression. Indicates the order of the moving average. Indicates the first Autoregressive coefficients of order 1 Indicates historical time The first difference, Indicates historical time White noise, Indicates the first Moving average coefficient, Indicates historical time White noise; The optimal parameters of the ARMA model are obtained using the maximum likelihood method, expressed by the following formula: ; In the formula, Represents the likelihood function. Represents white noise standard deviation Indicates that it is taken from the regression order. and moving average order The maximum value in.
4. The power grid load forecasting method based on the XGBoost model according to claim 3, characterized in that, A Fourier regression model is fitted to the seasonal component, expressed by the formula: ; In the formula, This represents the second power constant term. This represents the number of terms in the Fourier series. In the Fourier series, the first... The coefficients of the sinusoidal term of each frequency component, Indicates the first Sine basis functions for each frequency component, In the Fourier series, the first... The cosine coefficients of each frequency component Indicates the first Cosine basis functions for each frequency component. This indicates that Fourier regression occurred in historical time. The fitting error; The optimal parameters of the Fourier regression model are obtained using the least squares method, expressed by the following formula: ; In the formula, This indicates taking the minimum seasonal component. Sum of squares of errors with the prediction results of the Fourier regression model The parameters of the corresponding Fourier regression model.
5. The power grid load forecasting method based on the XGBoost model according to claim 4, characterized in that, The AR model fitted to the residual component is expressed by the following formula: ; In the formula, Indicates the order of the AR model. Indicates the AR model's first... Autoregressive coefficients of order 1 Residual component In historical time The load power, Indicates the AR model in historical time Error term; The optimal parameters of the AR model are obtained using the least squares method, expressed by the following formula: ; In the formula, This indicates taking the minimum residual component. Sum of squares of errors with AR model predictions The parameters of the corresponding AR model.
6. The power grid load forecasting method based on the XGBoost model according to claim 5, characterized in that, The specific steps for predicting the primary load on the power grid based on the optimal parameters of the ARMA model, the Fourier regression model, and the AR model are as follows: Using the optimal parameters of the ARMA model to predict time The first difference of is expressed by the formula: ; In the formula, Indicates time The first difference, Indicates time The first difference, Indicates time White noise; Based on time First-order difference trend acquisition component In time The power value is expressed by the formula: ; In the formula, Trend component In time The power value, Trend component In time The power value; The Fourier regression model is used to predict seasonal components based on the optimal parameters. In time The power value is expressed by the formula: ; In the formula, Indicates seasonal components In time The power value; Based on the optimal parameters of the AR model, the residual component is predicted using the AR model. In time The load power is expressed by the formula: ; In the formula, Residual component In time The load power, Residual component In time The load power; Based on trend components In time Power values, seasonal components In time Power values and residual components In time The load power is used to obtain the first load of the power grid, which can be expressed by the formula: ; In the formula, Indicates time The first load on the power grid.
7. The power grid load forecasting method based on the XGBoost model according to claim 1, characterized in that, The power grid load-related data is input into the XGBoost model for training. The specific steps are as follows: Historical power grid load data is obtained and input into the XGBoost model for offline learning and training; The grid load contribution score of each grid load-related data in each decision tree of the XGBoost model after offline learning and training is calculated and expressed by the formula: ; In the formula, This indicates that the grid load-related data is in the first... The grid load contribution score of each decision tree. This indicates that the grid load-related data is in the first... The first decision tree The number of times the layer splits, This indicates that the grid load-related data is in the first... The first decision tree The sum of the gain values of the layers, This indicates that the grid load-related data is in the first... The first decision tree Layers are used to represent the sum of the amount of data involved in splitting. Indicates the first The first decision tree Layer weights Indicates the splitting factor. Indicates the gain factor. Indicates the coverage factor; The weights are expressed by the formula: ; In the formula, Indicates the first The depth of each decision tree; Set the contribution threshold Q; Real-time grid load-related data is acquired and input into the XGBoost model for online learning and training. Specifically, each decision tree of the XGBoost model selects the grid load-related data corresponding to the top R grid load contribution scores, sorted from high to low, based on the contribution threshold Q, for online learning and training.
8. The power grid load forecasting method based on the XGBoost model according to claim 7, characterized in that, Historical power grid load data is obtained and input into the XGBoost model for offline learning and training. The specific steps are as follows: S611, Historical Time The grid load-related data is input into the first decision tree of the XGBoost model, and is presented in historical time. The load power is used as the learning target to train the system and obtain the first prediction result. Among them, the power grid load-related data includes load power, time characteristic data, meteorological environment data, and economic and calendar event data; S612, Historical Time The grid load-related data is input into the second decision tree of the XGBoost model, and the first prediction result is compared with historical time data. The residual of the load power is used as the new learning target to train and obtain the second prediction result; S613, Transfer the first prediction result to the... The prediction results are merged into sub-prediction results, and historical time is included. The grid load-related data is input into the XGBoost model. In the decision tree, based on historical time The residual between the load power and the sub-prediction results is used as the new learning objective to train the system and obtain the first... The prediction result is expressed by the formula: ; In the formula, Indicates historical time Data related to power grid load, This indicates the first prediction result. This indicates the second prediction result. Indicates the first Prediction results Indicates the first A decision tree, Indicates the first Prediction results; S614, if If the number of executions is less than the preset maximum number, proceed to step S613; otherwise, proceed to step S615. S615, Transfer the first prediction result to the... The prediction results are fused together as historical time predictions from the XGBoost model. The load power; The objective function of the XGBoost model is expressed by the formula: ; In the formula, Let represent the objective function of the XGBoost model. This represents the mean square error function. Indicates historical time The load power, This represents the historical time predicted by the XGBoost model. The load power, Indicates the first The complexity of a decision tree.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the grid load forecasting method based on the XGBoost model as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the grid load forecasting method based on the XGBoost model as described in any one of claims 1 to 8.
Citation Information
Patent Citations
An XGBoost algorithm-based large industrial power consumption user load prediction method
CN109727066A
Multitask load prediction method and system based on Autoformer model and XGBoost model
CN115759474A
Load prediction method and device, electronic equipment and storage medium
CN119026729A
Power prediction method and system considering net load power and meteorological factors
CN120582079A
Method for predicting energy consumption for using ensemble learning, and computing apparatus for performing the method
KR102478684B1