A power grid load prediction method and device based on an XGBoost model and a 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 existing technologies failing to effectively handle multi-scale information is solved, achieving higher accuracy and robustness in load forecasting.

CN121529545BActive Publication Date: 2026-04-10国网福建省电力有限公司营销服务中心 +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-09
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing power grid load forecasting methods fail to effectively handle multi-scale information and different levels of characteristics in load data, resulting in limited forecasting accuracy. In particular, when faced with complex power load characteristics and the influence of multiple factors, it is difficult to achieve accurate load forecasting.

Method used

A power grid load forecasting method based on the XGBoost model is adopted. The historical load data of the power grid is decomposed into trend components, seasonal components and residual components. The optimal ARMA, Fourier regression and AR models are used for modeling respectively. The XGBoost model is combined for training and forecasting. The first load and second load of the power grid are integrated to improve the forecasting accuracy.

Benefits of technology

It significantly improves the model's adaptability to complex load patterns, reduces data noise interference, maintains the stability and accuracy of long-term forecasts, can capture the influence of multiple factors, and improves the robustness and accuracy of forecasts, especially its rapid response capability under abnormal scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121529545B_ABST
    Figure CN121529545B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of power grid load forecasting method, equipment and medium based on XGBoost model, belong to power grid load forecasting technical field, including the following steps: obtaining power grid historical load data, it is decomposed into trend, season and residual component.Trend component first-order difference fitting ARMA model, with maximum likelihood method to determine optimal parameter;Season component fitting Fourier regression model, residual component fitting AR model, both using least square method to obtain optimal parameter, and predict power grid first load.Power grid load related data is obtained, input XGBoost model is trained and the second load of power grid is predicted.Weight fusion processing is carried out to the first load and the second load of power grid, and the load of power grid is obtained.The present application combines the first load and the second load of power grid, improves the prediction accuracy, and enhances the robustness of model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a power grid load prediction method, device and medium based on an XGBoost model, and belongs to the technical field of power grid load prediction. BACKGROUND

[0002] Under the background of rapid development of today's society, the demand for electricity is increasing. As a key link of power system operation and planning, power grid load prediction plays a crucial role in ensuring the safe, economic and efficient operation of the power grid. The prediction results directly affect the scientific arrangement of power generation plan, the precise optimization of power transmission dispatching and the wise decision of power market transaction.

[0003] However, the power grid load prediction work is facing many challenges. On the one hand, with the rapid development of economy and the continuous improvement of people's living quality, the characteristics of power load become more and more complex, which are influenced by many factors such as economic development level, population growth trend, industrial structure adjustment, meteorological condition change, social activity development and policy and regulation orientation. These factors are interrelated and interacted, making the load data show significant nonlinear, time-varying and uncertain characteristics.

[0004] On the other hand, the continuous expansion of the power system scale and the increasing complexity of the structure further aggravate the difficulty and complexity of power grid load prediction. At present, many existing prediction methods often focus on only one single characteristic of load data, ignoring the multi-scale information and different levels of features contained in the load data. In fact, power grid load data not only contains long-term trend changes, but also has seasonal periodic fluctuations, and is also disturbed by short-term random factors. SUMMARY

[0005] In order to solve the problems existing in the prior art, the application provides a power grid load prediction method, device and medium based on an XGBoost model.

[0006] The technical scheme of the application is as follows:

[0007] On the one hand, the application provides a power grid load prediction method based on an XGBoost model, comprising the following steps:

[0008] obtaining power grid historical load data, obtaining a trend component, a seasonal component and a residual component based on the power grid historical load data;

[0009] calculating the first-order difference of the trend component, fitting an ARMA model to the first-order difference, and obtaining the optimal parameters of the ARMA model by using maximum likelihood method;

[0010] 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.

[0011] 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.

[0012] 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.

[0013] Obtain grid load-related data and input the grid load-related data into the XGBoost model for training;

[0014] Predict the second load on the power grid using the trained XGBoost model;

[0015] The first load and the second load of the power grid are weighted and merged to obtain the power grid load.

[0016] 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:

[0017] 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:

[0018] ;

[0019] ;

[0020] 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;

[0021] Solve the trend objective function to obtain the optimal trend component;

[0022] Based on the trend component, the historical load data after removing the trend is obtained, which is expressed by the formula:

[0023] ;

[0024] In the formula, Indicates historical time Historical load data after removing trends;

[0025] Seasonal components are obtained based on the load power after removing trends from historical load data, expressed by the formula:

[0026] ;

[0027] ;

[0028] ;

[0029] 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;

[0030] The residual component is obtained based on the seasonal component, trend component, and historical load data, and is expressed by the formula:

[0031] ;

[0032] In the formula, Residual component In historical time The load power.

[0033] Preferably, the first order difference of the trend component is calculated, denoted as

[0034] ;

[0035] wherein denotes the first order difference of the trend component at historical time ;

[0036] An ARMA model is fitted to the first order difference, denoted as

[0037] ;

[0038] wherein denotes a first power constant term, denotes an autoregressive order, denotes a moving average order, denotes an autoregressive coefficient of order , denotes the first order difference of the trend component at historical time , denotes white noise at historical time , denotes a moving average coefficient of order , denotes white noise at historical time ;

[0039] The optimal parameters of the ARMA model are obtained using maximum likelihood method, denoted as

[0040] ;

[0041] wherein denotes a likelihood function, denotes a standard deviation of white noise , denotes the maximum value taken from the autoregressive order and the moving average order .

[0042] Preferably, a Fourier regression model is fitted to the seasonal component, denoted as

[0043] ;

[0044] wherein denotes a second power constant term, denotes a number of Fourier series terms, denotes a sine term coefficient of the th frequency component in the Fourier series, denotes a sine basis function of the th 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;

[0045] The optimal parameters of the Fourier regression model are obtained using the least squares method, expressed by the following formula:

[0046] ;

[0047] 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.

[0048] Preferably, the AR model fitted to the residual component is expressed by the following formula:

[0049] ;

[0050] 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;

[0051] The optimal parameters of the AR model are obtained using the least squares method, expressed by the following formula:

[0052] ;

[0053] 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.

[0054] 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:

[0055] ;

[0056] In the formula, Indicates time The first difference, first order difference of time white noise of time

[0057] trend component based on first order difference of time power value of trend component at time

[0058]

[0059] where power value of trend component at time power value of trend component at time

[0060] seasonal component based on Fourier regression model optimal parameters using Fourier regression model to predict seasonal component power value of seasonal component at time

[0061]

[0062] where power value of seasonal component at time

[0063] residual component based on AR model optimal parameters using AR model to predict residual component load power of residual component at time

[0064]

[0065] where load power of residual component at time load power of residual component at time first grid load based on power value of trend component at time, power value of seasonal component at time and load power of residual component at time

[0066] ​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

[0067] ;

[0068] wherein, represents the time of the first load of the power grid.

[0069] Preferably, the power grid load related data is input into the XGBoost model for training, and the specific steps are as follows:

[0070] The historical power grid load related data is obtained and input into the XGBoost model for offline learning and training.

[0071] The power grid load contribution score of each power grid load related data in each decision tree of the XGBoost model after offline learning and training is calculated, which is expressed by the formula:

[0072] ;

[0073] wherein, represents the power grid load contribution score of the power grid load related data in the th decision tree, represents the number of splits of the power grid load related data in the th decision tree in the th layer, represents the sum of gain values of the power grid load related data in the th decision tree in the th layer, represents the sum of the number of data involved when the power grid load related data in the th decision tree in the th layer is used for splitting, represents the weight of the th decision tree in the th layer, represents the split factor, represents the gain factor, represents the coverage factor.

[0074] The weight is expressed by the formula:

[0075] ;

[0076] wherein, represents the depth of the th decision tree.

[0077] A contribution threshold Q is set.

[0078] 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.

[0079] 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:

[0080] 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.

[0081] Among them, the power grid load-related data includes load power, time characteristic data, meteorological environment data, and economic and calendar event data;

[0082] 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;

[0083] 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:

[0084] ;

[0085] 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;

[0086] S614, if If the number of executions is less than the preset maximum number, proceed to step S613; otherwise, proceed to step S615.

[0087] 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;

[0088] The objective function of the XGBoost model is expressed by the formula:

[0089] ;

[0090] 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.

[0091] 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.

[0092] 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.

[0093] The present invention has the following beneficial effects:

[0094] 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.

[0095] 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.

[0096] 3、The application can comprehensively capture the multi-element factors affecting the load by introducing multi-dimensional data such as historical load, time characteristics, meteorological environment, and economic events. High-value data is screened by combining contribution score, which not only optimizes the model training efficiency, but also dynamically adapts to load changes through online learning, maintaining long-term prediction accuracy.

[0097] 4、The application accurately depicts the internal law of load change through three-dimensional decomposition of the trend-seasonal-residual of the first load of the power grid: the ARMA model captures the autocorrelation characteristics of the long-term trend, ensuring that the prediction direction is consistent with the historical development context; the Fourier regression model decomposes seasonal fluctuations with parameterized harmonics, preserving periodic characteristics while avoiding overfitting; the AR model excavates the short-term autocorrelation in the residual, converting traditional noise into predictable signals.

[0098] The second load of the power grid integrates time characteristics, meteorological environment, economic events, and other multi-dimensional external factors through the integrated learning characteristics of XGBoost. Its nonlinear modeling capability can capture complex relationships that traditional methods cannot quantify, such as the heterogeneous impact of holidays on industrial load and the lagging effect of sudden temperature rises on residential electricity consumption.

[0099] The fusion of the first load of the power grid and the second load of the power grid realizes the organic unification of regularity and flexibility. In normal scenarios, the first load of the power grid provides a stable trend benchmark, and the second load of the power grid supplements external factor disturbances, making the prediction results have both historical regularity and real adaptability; in abnormal scenarios such as extreme weather or emergencies, the rapid response characteristics of the second load of the power grid can correct the inertial deviation of the first load of the power grid, and the long-term trend constraint of the first load of the power grid can avoid excessive fluctuations of the second load of the power grid. This fusion not only improves the prediction accuracy, but also enhances the robustness of the model. The complementarity of the two makes the prediction curve more consistent with the actual fluctuations. BRIEF DESCRIPTION OF DRAWINGS

[0100] Figure 1 The method implementation flowchart of the application embodiment is provided. DETAILED DESCRIPTION

[0101] The technical solutions in the application embodiments will be described clearly and completely below with reference to the drawings in the application embodiments. Obviously, the described embodiments are only a part of the embodiments of the application, not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the application.

[0102] It should be understood that the step numbers used herein are only for the convenience of description, and are not limited to the execution sequence of the steps.

[0103] It is to be understood that the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting thereof. As used in the description of the application and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.

[0104] The terms "including" and "comprising" as used herein specify the presence of stated features, integers, steps, operations, elements, and / or components but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0105] The term "and / or" means any combination of one or more of the associated listed items and all possible combinations thereof.

[0106] Embodiment One:

[0107] Referring to Figure 1 The embodiment provides a power grid load prediction method based on an XGBoost model, including the following steps:

[0108] The power grid load power has complex characteristics of multiple time scales, and is jointly affected by long-term trends, periodic seasonal factors and random fluctuations. If the power grid historical load power is not decomposed and directly modeled, the model will capture mixed patterns, and the prediction accuracy is limited. The non-stationary power grid historical load power is decomposed into three components with clear physical meaning (trend component, seasonal component and residual component), so that each component can be processed by the most suitable mathematical model in the subsequent.

[0109] S1, acquiring power grid historical load data, and acquiring a trend component, a seasonal component and a residual component based on the power grid historical load data, the specific steps being:

[0110] S11, constructing a fitting term and a smoothing term of the power grid historical load data and the trend component, and constructing a trend target function with the sum of the fitting term and the smoothing term as the target, which is expressed by the formula:

[0111] ;

[0112] ;

[0113] In the formula, represents the historical time length (in the embodiment, daily load data from January 1, 2020 to January 1, 2025 is collected, if =1 represents the first day in history, i.e. January 1, 2020, if =2 represents 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;

[0114] Solve the trend objective function to obtain the optimal trend component;

[0115] 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:

[0116] ;

[0117] 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.

[0118] 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:

[0119] ;

[0120] S12. Based on the trend component, obtain the load power after removing the trend from the historical load data, expressed by the formula:

[0121] ;

[0122] wherein, denotes the load power after removing the trend from the historical load data at the historical time ;

[0123] The seasonal component is obtained based on the load power after removing the trend from the historical load data, which is expressed in the formula as:

[0124] ;

[0125] ;

[0126] ;

[0127] wherein, denotes the average power value of the seasonal component at the seasonal position , denotes the seasonal period (if the period is a year, then =365, and the seasonal position refers to which day in a year, such as =1 refers to the first day of each year, i.e., January 1st), denotes the index corresponding date number (for example, January 1st of each year is coded as 1, i.e., the date numbers of January 1st, 2020, January 1st, 2021, and January 1st, 2022 are all 1), denotes the modulo equivalent operator, denotes the modulo operation, denotes the index starting from =1, if the date number corresponding to the index satisfies the condition , then the load power after removing the trend from the historical load data at the historical time is accumulated, denotes the number of indexes satisfying the condition (for example, if the seasonal position =2, then there are 5 days from January 1st, 2020 to January 1st, 2025 that can satisfy the condition , i.e., =5), denotes the power value of the seasonal component at the historical time ;

[0128] S13, the residual component is obtained based on the seasonal component, the trend component, and the historical load data, which is expressed in the formula as:

[0129] ;

[0130] wherein, denotes the trend component at historical time .

[0131] The trend of load data usually presents as a slowly changing smooth curve, and the degree of smoothness is controlled by a trend smoothing coefficient , which perfectly fits this feature. The seasonal component is calculated by a period average method, which is based on the prior knowledge that the power load has a stable annual or weekly period, and the pure seasonal pattern is extracted by the historical average of the same seasonal position to eliminate random noise. The residual component, as the remaining part after deducting the trend and season, contains short-term fluctuations and special event impacts that are not explained by the former two.

[0132] S2, calculate the first-order difference of the trend component, fit an ARMA model to the first-order difference, and obtain the optimal parameters of the ARMA model by maximum likelihood method, the specific steps are:

[0133] S21, calculate the first-order difference of the trend component, which is expressed by the formula:

[0134] ;

[0135] wherein, denotes the first-order difference of the trend component at historical time ;

[0136] Fitting an ARMA model to the first-order difference is to accurately capture the autocorrelation structure and moving average characteristics of the first-order difference . The first-order difference represents the daily variation of the load trend, which has stationarity and is suitable for modeling by ARMA model.

[0137] S22, fit an ARMA model to the first-order difference, which is expressed by the formula:

[0138] ;

[0139] wherein, denotes the first power constant term, denotes the autoregressive order, denotes the moving average order, denotes the th autoregressive coefficient, denotes the first-order difference at historical time , denotes the white noise at historical time , denotes the Moving average coefficient, Indicates historical time White noise;

[0140] 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.

[0141] 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.

[0142] S23. The optimal parameters of the ARMA model are obtained using the maximum likelihood method, expressed by the formula:

[0143] ;

[0144] 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;

[0145] White noise is calculated recursively, as expressed by the formula:

[0146] .

[0147] 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:

[0148] S31, Regarding the seasonal component The fitted Fourier regression model is expressed by the following formula:

[0149] ;

[0150] In the formula, denotes a second power constant term, denotes the number of Fourier series terms, denotes the sine term coefficient of the frequency component in the Fourier series, denotes the sine basis function of the frequency component, denotes the cosine term coefficient of the frequency component in the Fourier series, denotes the cosine basis function of the frequency component, denotes the fitting error of the Fourier regression at the historical time ;

[0151] S32, the least square method is used to obtain the optimal parameters of the Fourier regression model, which is expressed by the formula:

[0152] ;

[0153] In the formula, denotes the square sum of the error between the seasonal component and the prediction result of the Fourier regression model corresponding to the parameters of the Fourier regression model, i.e., the optimal parameters of the Fourier regression model;

[0154] The Fourier regression model itself is a standard linear model, and when solving the optimal parameters of the Fourier regression model, the solution of the optimal parameters of the Fourier regression model can be expressed in a matrix form, which is expressed by the formula:

[0155] ;

[0156] In the formula, denotes the optimal parameter vector of the Fourier regression model, denotes the transpose of the parameter design matrix ;

[0157] The least square method optimization problem is converted into a linear system with an exact analytical solution in a matrix form, which avoids the complex and possibly unstable iterative search process.

[0158] In the formula, the optimal parameter vector of the Fourier regression model is expressed by the formula:

[0159] ;

[0160] The parameter design matrix is a matrix, and =365, =2, =3 are taken as an example, and are expressed by formulas as follows:

[0161] .

[0162] The Fourier regression model is used to process the seasonal components to realize the parameterized compact representation of the seasonal pattern. The traditional seasonal dummy variable method needs to estimate a large number of parameters (for example, 365 parameters are needed for the annual pattern of daily load), while the Fourier regression can capture complex seasonal waveforms with high accuracy by harmonic decomposition with a small number of parameters. This parameter compression not only reduces the risk of overfitting, but also greatly improves the computational efficiency in the prediction stage.

[0163] S4, fitting an AR model to the residual component The AR model is fitted, and the optimal parameters of the AR model are obtained by using the least square method, and the specific steps are as follows:

[0164] S41, fitting an AR model to the residual component The AR model is fitted, and the specific steps are as follows:

[0165] ;

[0166] In the formula, a represents the order of the AR model, b represents the autoregressive coefficient of the AR model, c represents the error term of the AR model, d represents the load power at the historical time, e represents the error of the AR model at the historical time. The optimal parameters of the AR model are obtained by using the least square method, and the specific steps are as follows: ;

[0167]

[0168] ;

[0169] In the formula, a represents the order of the AR model, b represents the autoregressive coefficient of the AR model, c represents the error term of the AR model, d represents the load power at the historical time, e represents the error of the AR model at the historical time.

[0170] ​​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 information value.

[0171] 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:

[0172] S51. Using the optimal parameters of the ARMA model to predict time. The first difference of is expressed by the formula:

[0173] ;

[0174] In the formula, Indicates time The first difference, Indicates time The first difference, Indicates time White noise;

[0175] S52, Time-based First-order difference trend acquisition component In time The power value is expressed by the formula:

[0176] ;

[0177] In the formula, Trend component In time The power value, Trend component In time The power value;

[0178] S53. Using the optimal parameters of the Fourier regression model to predict seasonal components. In time The power value is expressed by the formula:

[0179] ;

[0180] In the formula, denotes the seasonal component at time ;

[0181] S54, the AR model is used to predict the residual component based on the optimal parameters of the AR model at time ;

[0182] ;

[0183] wherein, denotes the residual component at time , denotes the residual component at time ;

[0184] S55, based on the trend component at time , the seasonal component at time , and the residual component at time ;

[0185] ;

[0186] wherein, denotes the grid first load at time .

[0187] S6, the grid load related data is obtained, and the grid load related data is input into the XGBoost model for training, and the specific steps are:

[0188] S61, historical grid load related data is obtained and input into the XGBoost model for offline learning and training, and the specific steps are:

[0189] S611, the historical grid load related data at time is input into the first decision tree of the XGBoost model, and the load power at time is used as a learning target for training to obtain a first prediction result;

[0190] Among them, the grid load related data includes load power, time characteristic data, meteorological environment data, and economic and calendar event data;

[0191] The time feature data includes time information (which hour of the day), day information (which day of the week, which day of the month), month information (which month of the year), year information (year), holiday flag (whether it is a statutory holiday or a weekend), and season flag (spring, summer, autumn, winter);

[0192] The meteorological environment data includes temperature, humidity, wind speed and direction, solar intensity, and weather phenomenon flag (rain, sunny, or cloudy);

[0193] The economic and calendar event data includes time-of-use electricity price, whether there is a large sports event or concert, whether there is a nationwide celebration or activity;

[0194] S612, input the historical time related grid load data into the second decision tree of the XGBoost model, and train the first prediction result and the residual error of the load power of the historical time as a new learning target to obtain a second prediction result;

[0195] S613, fuse the first prediction result to the prediction result as a sub-prediction result, and input the historical time related grid load data into the decision tree of the XGBoost model, and train the residual error of the load power of the historical time and the sub-prediction result as a new learning target to obtain a prediction result, which is expressed by the formula:

[0196] ;

[0197] In the formula, represents the historical time related grid load data, represents the first prediction result, represents the second prediction result, represents the prediction result, represents the decision tree, represents the prediction result;

[0198] S614, if is less than the preset maximum execution number, step S613 is executed, otherwise step S615 is executed;

[0199] S615, fuse the first prediction result to the prediction result as the historical time The load power;

[0200] The objective function of the XGBoost model is expressed by the formula:

[0201] ;

[0202] 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;

[0203] 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:

[0204] ;

[0205] The equation for the power grid load contribution score is simplified and expressed as follows:

[0206] ;

[0207] 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.

[0208] The power grid load related data is in the first The grid load contribution score of each decision tree The grid load contribution score of each decision tree The grid load contribution score of each decision tree

[0209] The weight is expressed by a formula as follows:

[0210]

[0211] In the formula, d represents the depth of the i-th decision tree The depth of the i-th decision tree The depth of the i-th decision tree

[0212] S63, set the contribution threshold Q, which is set to 9 in the embodiment, indicating that 9 grid load contribution scores are selected from the load power, time information, day information, month information, year information, holiday flag, season flag, temperature, humidity, wind speed and wind direction, sunshine intensity, weather phenomenon flag, time-of-use electricity price, whether there is a large sports event or concert, and whether there is a nationwide celebration or activity to train the data;

[0213] S64, obtain real-time grid load related data and input the XGBoost model for online learning training; wherein each decision tree of the XGBoost model performs online learning training on the grid load related data corresponding to the top R grid load contribution scores from high to low according to the grid load contribution scores of the contribution threshold Q.

[0214] S7, using the trained XGBoost model to predict the second load of the grid.

[0215] S8, the first load of the grid and the second load of the grid are weighted and fused to obtain the grid load.

[0216] Wherein, the sum of the weight of the first load and the weight of the second load is 1, and the default is 0.5, if it is a holiday or extreme weather, the weight of the second load can be set higher, if the grid load presents a periodic trend fluctuation with years or months, the weight of the first load can be set higher.

[0217] The first load captures the regularity part, and the second load supplements the nonlinear and sudden part, and after the weighted fusion of the two, the errors are mutually compensated, and the overall prediction is closer to the real load.

[0218] Preferably, the complexity of the decision tree is expressed by a formula as follows:

[0219] ;​

[0220] wherein, represents the number of the i-th decision tree, represents the penalty coefficient of the number of leaf nodes of the i-th decision tree, represents the total number of leaf nodes of the i-th decision tree, represents the regularization coefficient, represents the regularization coefficient, represents the weight of the j-th leaf node of the i-th decision tree. Embodiment Two:

[0221] The embodiment provides an electronic device, which stores a computer program, and the computer program is executed by a processor to implement the power grid load prediction method based on the XGBoost model according to any one of the embodiments of the application.

[0222] Embodiment Three:

[0223] The embodiment provides a computer readable storage medium, which is used to store one or more programs, and when the one or more programs are executed by one or more processors, the one or more processors implement the power grid load prediction method based on the XGBoost model according to any one of the embodiments of the application.

[0224] The embodiment of the present application, "at least one" refers to one or more, "a plurality of" refers to two or more. "And / or", describes the relationship between the associated objects, indicating that there may be three kinds of relationships, for example, A and / or B, can represent the existence of A alone, A and B exist at the same time, and B alone. Where A, B can be singular or plural. The character " / " generally represents the "or" relationship between the associated objects before and after. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or multiple 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, c can be single or multiple.

[0225] Those of ordinary skill in the art can realize that the units and algorithm steps described in the embodiments disclosed herein can be realized by electronic hardware, computer software and a combination of electronic hardware and computer software. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0226] Those of ordinary skill in the art can realize that the units and algorithm steps described in the embodiments disclosed herein can be realized by electronic hardware, computer software and a combination of electronic hardware and computer software. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0227] ​Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the system, device and unit described above can refer to the corresponding processes in the foregoing method embodiments, and will not be described here.

[0228] In several embodiments provided in the present application, any function, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory; hereinafter referred to as: ROM), a random access memory (Random Access Memory; hereinafter referred to as: RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0229] The above is only an embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent flow transformation, or direct or indirect application in other related technical fields, is also included in the patent protection scope of the present application.

Claims

1. A power grid load forecasting method based on an XGBoost model, characterized in that, The method comprises the following steps: obtaining power grid historical load data, obtaining a trend component, a seasonal component and a residual component based on the power grid historical load data; calculating the first-order difference of the trend component, fitting an ARMA model to the first-order difference, and obtaining the optimal parameters of the ARMA model by using the maximum likelihood method; fitting a Fourier regression model to the seasonal component, and obtaining the optimal parameters of the Fourier regression model by using the least squares method; fitting an AR model to the residual component, and obtaining the optimal parameters of the AR model by 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, predicting a first power grid load, the specific steps being: Based on the ARMA model optimal parameters using ARMA model prediction time first-order difference, expressed as a formula: ; wherein a first order difference of time , a first order difference of time , white noise of time , a first power constant term, an autoregressive order, a moving average order, an autoregressive coefficient of the th order, a moving average coefficient of the th order; based on time a first order difference to obtain a trend component at time power values, expressed in a formula as: ; In the formula, trend component at a time power value, trend component at a time power value; Based on the Fourier regression model optimal parameters using Fourier regression model to predict seasonal components At time power value, expressed in the formula: ; wherein denotes the seasonal component at the time , the power value, denotes the second power constant term, denotes the number of Fourier series terms, denotes the sine term coefficient of the frequency component in the Fourier series, denotes the sine basis function of the frequency component, denotes the cosine term coefficient of the frequency component in the Fourier series, denotes the cosine basis function of the frequency component; Based on the AR model optimal parameters using AR model prediction residual components At time Load power, expressed in the formula: ; wherein denotes the residual component at time the load power, denotes the residual component at time the load power, denotes the order of the AR model, denotes the autoregressive coefficient of the AR model of order order Trend component In time Power value, seasonal component In time Power value, and residual component In time Load power acquisition grid first load, expressed in formula: ; In the formula, represents the time of the first load of the power grid; obtaining power grid load related data, and inputting the power grid load related data into an XGBoost model for training; using the trained XGBoost model to predict a second power grid load; performing weighted fusion processing on the first power grid load and the second power grid load to obtain a power grid load.

2. The XGBoost model based power grid load forecasting method of claim 1, wherein, obtaining a trend component, a seasonal component and a residual component based on the power grid historical load data, the specific steps being: constructing a fitting term and a smoothing term of the power grid historical load data and the trend component, and constructing a trend target function with the objective of minimizing the sum of the fitting term and the smoothing term, which is expressed by the formula: ; ; wherein denotes a history time length, denotes a history time a history load data, denotes a trend component a power value at the history time a power value at the history time denotes a trend component which minimizes the sum of the fitting term and the smoothing term, denotes a trend smoothing coefficient, denotes a trend component a power value at the history time a power value at the history time denotes a trend component a power value at the history time a power value at the history time solving the trend target function to obtain the optimal trend component; obtaining the load power after removing the trend from the historical load data based on the trend component, which is expressed by the formula: ; In the formula, represents the load power after the historical load data at the historical time is removed of a trend. obtaining the seasonal component based on the load power after removing the trend from the historical load data, which is 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; obtaining the residual component based on the seasonal component, the trend component and the historical load data, which is expressed by the formula: ; In the formula, represents a residual component At a historical time of the load power. 3.The power grid load forecasting method based on XGBoost model according to claim 2, characterized in that, calculating the first-order difference of the trend component, which is expressed by the formula: ; In the formula, represents the trend component at historical time t = 1 first difference; fitting an ARMA model to the first-order difference, which is expressed by the formula: ; wherein a first difference of the historical time a first difference of the historical time white noise of the historical time white noise of the historical time white noise of the historical time white noise of the historical time obtaining the optimal parameters of the ARMA model by using the maximum likelihood method, which is expressed by the formula: ; wherein represents a likelihood function, represents a standard deviation of white noise represents a maximum value taken from the autoregressive order and the moving average order .​ 4. The method of claim 3, wherein the XGBoost model is trained using a training dataset comprising a plurality of training data points, each training data point comprising a plurality of features and a corresponding target value. fitting a Fourier regression model to the seasonal component, which is expressed by the formula: ; wherein represents the fitting error of the Fourier regression at historical time t. obtaining the optimal parameters of the Fourier regression model by using the least squares method, which is expressed by the formula: ; wherein denotes the minimization of the seasonal component the sum of the squared errors of the Fourier regression model prediction the parameters of the corresponding Fourier regression model.

5. The XGBoost model based power grid load forecasting method of claim 4, wherein, fitting an AR model to the residual component, which is expressed by the formula: ; wherein denotes the residual component at historical time the load power, denotes the error term of the AR model at historical time at historical time obtaining the optimal parameters of the AR model by using the least squares method, which is expressed by the formula: ; wherein denotes the residual minimization component the sum of squared errors with the AR model prediction parameters of the corresponding AR model. 6.The power grid load forecasting method based on XGBoost model according to claim 1, wherein, inputting the power grid load related data into the XGBoost model for training, the specific steps being: inputting historical power grid load related data into the XGBoost model for offline learning and training; calculating the power grid load contribution score of each power grid load related data in each decision tree of the XGBoost model after offline learning and training, which is 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 weight is expressed by the formula: ; In the formula, Indicates the first The depth of each decision tree; setting a contribution threshold Q; inputting real-time power grid load related data into the XGBoost model for online learning and training; wherein each decision tree of the XGBoost model is sorted according to the top R power grid load contribution scores from high to low, and the power grid load related data corresponding to the top R power grid load contribution scores is used for online learning and training.

7. The method of claim 6, wherein the XGBoost model is trained using a training dataset comprising a plurality of training samples, each training sample comprising a plurality of features and a corresponding target value. inputting historical power grid load related data into the XGBoost model for offline learning and training, the specific steps being: 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. The grid load related data includes load power, time characteristic data, meteorological environment data, and economic and calendar event data. S612, input the historical time related data of the power grid load into the second decision tree of the XGBoost model, and train the first prediction result and the residual of the load power of the historical time as a new learning target to obtain a second prediction result; S613、the first prediction result to the first prediction result fusion as a sub-prediction result, and inputting historical time related data of power grid load into the first decision tree of the XGBoost model to train, taking the residual error between the historical time load power and the sub-prediction result as a new learning target to obtain the first prediction result, which is expressed by a formula as follows: ; 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 of executions, step S613 is executed, otherwise step S615 is executed. S615、the first prediction result to the first predicted historical time of the load power predicted historical time of the load power; The objective function of the XGBoost model is expressed by a formula as follows: ; wherein, represents an objective function of the XGBoost model, represents a mean square error function, represents a historical time of load power, represents a historical time of load power predicted by the XGBoost model, represents a complexity of the th decision tree.

8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the grid load prediction method based on the XGBoost model according to any one of claims 1 to 7.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the grid load prediction method based on the XGBoost model according to any one of claims 1 to 7.

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