Load prediction method and device, electronic equipment and storage medium
By decomposing the load time series and mixing it with multiple scales, the prediction model is constructed, and the problems of data dependence and external factors in medium and long-term load prediction are solved, which improves the accuracy and reliability of load prediction.
Patent Information
- Application Number
- CN202411024333.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-11-26
AI Technical Summary
Medium- and long-term load prediction is highly dependent on data quality and quantity. It is affected by external factors, resulting in low prediction accuracy and large deviations, making it difficult to accurately predict the future demand of the power system.
By decomposing the load time series, extracting trend and seasonal components, and performing multi-scale mixing, predictive models are constructed to improve learning and prediction capabilities for complex patterns and nonlinear relationships.
It effectively improves the accuracy and reliability of load prediction, can handle the multi-periodity of load sequences more comprehensively, and improves the understanding and processing capabilities of complex data patterns.
Smart Images

Figure CN119026729A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of load forecasting, and in particular to a load forecasting method, device, electronic equipment and storage medium. Background Art
[0002] Medium- and long-term load forecasting mainly predicts power demand in the next one to five years, which is of key significance for the short- to medium-term operation and planning of the power system. This forecast helps power companies make more accurate equipment maintenance plans, power generation scheduling strategies, and demand-side management. Effective medium- and long-term load forecasting can support the optimized operation of the power system and ensure the stability and economy of power supply.
[0003] However, in medium- and long-term load forecasting, there is often a high dependence on the quality and quantity of data. Medium- and long-term load forecasting is affected by many external factors. Incomplete data collection, untimely updates, complex data, or data applied to different regions will affect the accuracy of the forecast, resulting in lower load forecasting accuracy and larger deviations.
[0004] Therefore, there is an urgent need for a method to improve the prediction accuracy of load forecasting for power systems. Summary of the invention
[0005] In order to solve the above problems, the embodiments of the present invention provide a load forecasting method, device, electronic device and storage medium. By decomposing and multi-scale mixing the load time series and building a prediction model based on a training set, it is possible to effectively improve the learning and prediction capabilities of complex patterns and nonlinear relationships, thereby improving the accuracy and reliability of load forecasting.
[0006] In a first aspect, an embodiment of the present invention provides a load forecasting method, including:
[0007] Obtain the load time series of the power system;
[0008] Decomposing the load time series to obtain a trend component and a seasonal component of the load time series;
[0009] Performing multi-scale mixing on the trend component and the seasonal component to obtain a training set including a mixed trend term and a mixed seasonal term;
[0010] Predicting the trend component and the seasonal component to obtain a test set including a predicted trend item and a predicted seasonal item;
[0011] Building a prediction model based on the training set;
[0012] Load forecasting is performed based on the forecasting model and the test set to obtain a load forecasting result.
[0013] In a second aspect, an embodiment of the present invention provides a load forecasting device, the device comprising a processing unit and an acquisition unit;
[0014] The acquisition unit is used to acquire the load time series;
[0015] The processing unit is used to decompose the load time series to obtain the trend component and seasonal component of the load time series;
[0016] Performing multi-scale mixing on the trend component and the seasonal component to obtain a training set including a mixed trend term and a mixed seasonal term;
[0017] Predicting the trend component and the seasonal component to obtain a test set including a predicted trend item and a predicted seasonal item;
[0018] Building a prediction model based on the training set;
[0019] Load forecasting is performed based on the forecasting model and the test set to obtain a load forecasting result.
[0020] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0021] A processor and a memory, wherein the processor is connected to the memory, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the method as described in the first aspect.
[0022] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method as described in the first aspect.
[0023] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer is operable to cause the computer to execute the method described in the first aspect.
[0024] Implementing the embodiments of the present application has the following beneficial effects:
[0025] In the implementation mode of the present application, the load time series of the power system is first obtained, and then the load time series is decomposed to obtain the trend component and seasonal component of the load time series, and the trend component and the seasonal component are mixed at multiple scales to obtain a training set containing mixed trend items and mixed seasonal items, and the trend component and the seasonal component are predicted to obtain a test set containing predicted trend items and predicted seasonal items, and then a prediction model is constructed based on the training set, and finally, load prediction is performed based on the prediction model and the test set to obtain a load prediction result. Thus, by decomposing and mixing the load time series at multiple scales, the multi-periodicity of the load series is taken into account, and the components of different periods can be more comprehensively decomposed, which effectively solves the problem of multi-periodicity of the load series, and a prediction model is constructed based on the training set, which makes full use of the load time series analysis's ability to process data periodicity and trend, and can effectively improve the learning and prediction capabilities of complex patterns and nonlinear relationships, and improve the accuracy and reliability of load prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background technology, the drawings required for use in the embodiments of the present invention or the background technology will be described below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1 is a flow chart of a load forecasting method provided in an embodiment of the present application;
[0028] Figure 2 It is a structural schematic diagram of a prediction model provided in an embodiment of the present application;
[0029] Figure 3 It is a flow chart of an example method of load forecasting provided by an embodiment of the present application;
[0030] Figure 4 is a structural schematic diagram of a load prediction device provided in an embodiment of the present application;
[0031] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0033] The terms "first", "second", "third" and "fourth" etc. in the specification and claims of the present application and the drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not limited to the listed steps or modules, but optionally includes steps or modules that are not listed, or optionally includes other steps or modules inherent to these processes, methods, products or devices.
[0034] Reference to "embodiments" herein means that a particular feature, result, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0035] See also Figure 1 , Figure 1 : is a flow chart of a load forecasting method provided in an embodiment of the present application. Figure 1 As shown, the method includes but is not limited to the following steps:
[0036] Step S101: Obtaining a load time series of a power system;
[0037] Step S102: Decompose the load time series to obtain the trend component and seasonal component of the load time series;
[0038] Step S103: performing multi-scale mixing of the trend component and the seasonal component to obtain a training set including a mixed trend term and a mixed seasonal term;
[0039] Step S104: predicting the trend component and the seasonal component to obtain a test set including the predicted trend item and the predicted seasonal item;
[0040] Step S105: constructing a prediction model based on the training set;
[0041] Step S106: Perform load forecasting based on the forecasting model and the test set to obtain a load forecasting result.
[0042] In the embodiment of the present application, after obtaining the load time series of the power system, a preset additive model is used to decompose the load time series, and the load time series is decomposed into several components: trend, seasonality and residual. The additive model assumes that the load time series is the addition of trend, seasonality and residual. The additive model can be expressed by formula ①:
[0043] y t =T t +S t +R t …………①
[0044] In the formula, y t is the value at time point t in the load time series, T t is the trend component at time point t in the load time series, S t is the seasonal component at time point t in the load time series, R t It is the residual component at time point t in the load time series.
[0045] In a possible embodiment, in the decomposition of the load time series, the seasonal component, trend component and residual component have the following meanings: the seasonal component reflects the periodic change pattern related to the seasonal cycle in the load time series. For example, for monthly load data, the seasonal component may capture the repeated load change pattern that occurs in the same month every year, such as the load peak caused by the load demand during Christmas and New Year holidays in December every year; if it is daily load data, the seasonal component will reflect the periodic change law of the load in the same time period every day, week or year. For example, for annual load data, the load will increase significantly every summer, and the change pattern of the summer load increase is represented by the seasonal component. The trend component describes the overall change direction and trend of the load time series over a long period of time. The trend component can be linear, such as the load increases steadily over time, or nonlinear, such as first increasing and then stabilizing or starting to decline. For example, the load of the power system has continued to grow in the past 5 years, and this long-term growth trend is the trend component. The residual component is also called the random term or noise term. It is the remaining part after removing the seasonal component and trend component from the load time series. The residual component reflects the random fluctuations and outliers that cannot be explained by seasonal patterns and trends. For example, when analyzing load data, after removing the long-term load growth trend (trend component) and the load fluctuations in fixed seasons each year (seasonal component), the remaining unexplained load changes, such as a sudden increase in load due to a special event on a certain day or a sudden drop in load due to weather reasons, are the residual components.
[0046] Optionally, step S102, decomposing the load time series to obtain the trend component and seasonal component of the load time series, may include the following steps:
[0047] Step S201: determining the seasonal cycle of the load time series;
[0048] Step S202: Determine the window length of the moving average based on the seasonal cycle;
[0049] Step S203: Calculate the load time series based on the preset trend component estimation formula and window length to obtain the trend component.
[0050] The details are as follows:
[0051] The estimation formula of the trend component is: Where, T t is the value of the trend component at time point t, i is the time point variable of the preset load time series, y t+i is the value at time point t+i in the load time series, n is the window length, a is the preset variable of the window length, and the relationship between n and a is n=2a+1;
[0052] Step S204: subtract the trend component from the load time series to obtain a detrended load time series;
[0053] Step S205: Calculate the detrended load time series based on the preset seasonal component estimation formula and the seasonal cycle to obtain the seasonal component.
[0054] The details are as follows:
[0055] Among them, the estimation formula of seasonal component is In the formula, S t is the value of the seasonal component at time point t, j is the time point variable of the preset detrended load time series, D t+j*p is the value of the detrended load time series at time point t+j*p, m is the length of the seasonal cycle, and p is the number of seasonal cycles;
[0056] Step S206: Integrate the trend component and the seasonal component to obtain the trend component and the seasonal component of the load time series.
[0057] In a possible embodiment, when decomposing the load time series, the estimation of the trend component usually uses the moving average method to smooth the load time series. The window length of the moving average usually matches the seasonal cycle of the load time series. For example, for monthly data with annual periodicity, the window length may be set to 12. The estimation formula of the trend component can be expressed by formula ②:
[0058]
[0059] Where, T t is the value of the trend component at time point t, i is the time point variable of the preset load time series, y t+i is the value at time point t+i in the load time series, n is the window length, a is the preset variable of the window length, and the relationship between n and a is n=2a+1.
[0060] In a possible embodiment, after decomposing the trend component, the original load time series y t Subtract the estimated trend component T from t , and obtain the detrended load time series D t Then, the detrended load time series is seasonally decomposed. Usually, this is achieved by taking the average of the corresponding time points in each seasonal cycle, which can be achieved by a preset estimation formula of seasonal components. The estimation formula of seasonal components can be expressed by formula ③:
[0061]
[0062] In the formula, S t is the value of the seasonal component at time point t, j is the time point variable of the preset detrended load time series, D t+j*p is the value of the detrended load time series at time point t+j*p, m is the length of the seasonal cycle, p is the number of seasonal cycles, and for monthly data m=12.
[0063] In a possible embodiment, after the trend component and the seasonal component are decomposed, the estimated trend component and the seasonal component are subtracted from the original load time series to obtain a residual component.
[0064] In a possible embodiment, the moving average window length is determined. The moving average window length can be determined based on the characteristics of the seasonal cycle data. If the data fluctuation frequency is high, a smaller window length may be required to respond to data changes more quickly. If the data trend is relatively smooth, a larger window length can better smooth noise and short-term fluctuations and highlight long-term trends. The moving average window length can be determined based on application requirements. For applications that require rapid capture of short-term changes in data, the window size should be smaller. For applications that require long-term trends and patterns, a larger window size is more appropriate. The moving average window length can be determined based on the periodicity of the seasonal cycle data. If the data has a certain periodicity, the window length can be set to an integer multiple of the period length to better capture periodic characteristics.
[0065] In one possible embodiment, when processing and analyzing load time series data by moving average, a window of fixed length is selected on the load time series, the average value of the data points in the window is calculated, and this average value is used as the smoothing value or trend value of the data point at the center of the window. As time goes by, the window slides forward on the time series and the average value of the new position is continuously calculated.
[0066] Furthermore, the moving average adopted in the embodiment of the present application may include any one or more of a simple moving average and a weighted moving average. When the embodiment of the present application adopts a simple moving average, the weights of all data points in the window are the same. For example, for a time series [x1, x2, x3, x4, x5], if a 3-period simple moving average is to be calculated, the first moving average is (x1+x2+x3) / 3. When the window slides forward one step, the second moving average is (x2+x3+x4) / 3, and so on. When the embodiment of the present application adopts a weighted moving average, different weights are assigned to the data points in the window. Generally, the closer the data point is to the center, the greater the weight is, so as to emphasize the importance of recent data.
[0067] In the embodiment of the present application, by smoothing the load time series through moving average, random noise and short-term fluctuations in the load data can be reduced, making the load data smoother and making it easier to observe potential trends and patterns. In addition, the trend component based on smoothing can be used for subsequent predictions or as an input to a prediction model. In data with periodicity, moving average can also help identify periodic features. For example, in load data analysis, by moving average the load over a period of time, load fluctuations can be smoothed to help better determine the trend direction of the load. Moving average can also be used to remove short-term fluctuations in the load and highlight seasonal trends.
[0068] Optionally, step S103, performing multi-scale mixing on the trend component and the seasonal component to obtain a training set containing a mixed trend term and a mixed seasonal term, may include the following steps:
[0069] Step S301: determining multiple time scales of the load time series;
[0070] Step S302: resampling the trend component and the seasonal component based on multiple time scales to obtain a resampling result;
[0071] Step S303: performing interpolation processing on the resampling result to obtain an interpolation result;
[0072] Step S304: mixing the trend components and seasonal components in the interpolation results based on multiple time scales to obtain mixed trend terms and mixed seasonal terms;
[0073] Step S305: Integrate the mixed trend term and the mixed seasonal term to obtain a training set.
[0074] In the embodiments of the present application, multi-scale mixing is used to obtain mixed trend terms and mixed seasonal terms. Multi-scale mixing mainly focuses on combining seasonal and trend components at different time scales to form a comprehensive representation. It captures multiple seasonalities and trends in time series by resampling, interpolating and mixing components of different scales. This method is suitable for scenarios where the influence of multiple time scales needs to be considered simultaneously, such as time series with weekly, monthly and annual seasonality. The decomposition results of different periodic characteristics are added together to obtain mixed seasonal terms and mixed trend terms.
[0075] In a possible embodiment, when determining multiple time scales of a load time series, the multiple time scales of the load time series can be determined based on prior knowledge. For example, in the load data, different periodic scales such as day, week, month, season and year are used as multiple time scales.
[0076] In a possible embodiment, when determining multiple time scales of a load time series, the multiple time scales of the load time series can be determined based on data exploration and visualization. By visualizing the original load time series data, the fluctuation pattern and periodic characteristics of the load data can be observed. For example, a line graph, an autocorrelation graph, a spectrum graph, etc. can be drawn to discover fluctuations of different periods or frequencies that may exist in the load data, thereby determining different time scales.
[0077] In a possible embodiment, when determining multiple time scales of the load time series, multiple time scales of the load time series can be determined based on a statistical analysis method, for example, the autocorrelation function of the load time series is calculated, and the change of the autocorrelation coefficient with the lag order is observed. The lag order with a significantly non-zero autocorrelation coefficient may correspond to a period scale. For example, the load time series is converted from the time domain to the frequency domain by a method such as a fast Fourier transform or a wavelet analysis, so as to determine the main frequency components existing in the load data, corresponding to different time scales.
[0078] In a possible embodiment, multiple time scales of the load time series can be determined by trying different scale combinations. For example, a model can be established and the performance of the model under different scale combinations, such as prediction accuracy, goodness of fit, etc., can be compared to determine the time scale that best suits the current problem.
[0079] In a possible embodiment, resampling the trend component and the seasonal component based on multiple time scales can unify the time scale and frequency. For example, when processing load time series data of multiple different time scales, resampling can adjust them to a unified time scale or sampling frequency to facilitate subsequent comparison, analysis and mixing operations. For example, for a quarterly data series and a monthly data series, resampling can convert the quarterly data into monthly data, or convert the monthly data into quarterly data, so that they have the same time step and frequency for merging and processing.
[0080] In a possible embodiment, missing data can be supplemented by interpolating the resampling results. If there is missing data in the load time series, interpolation can estimate the value of the missing data point based on the pattern and trend of the existing data to make the data more complete. For example, if a load time series lacks data points in certain time periods, the values of the missing points can be estimated based on the values of adjacent data points through methods such as linear interpolation, polynomial interpolation, and spline interpolation, which helps to maintain the continuity and integrity of the load data and improve the accuracy of subsequent analysis and modeling.
[0081] In a possible embodiment, the resolution of the data can be increased or decreased through resampling and interpolation processing. Increasing the resolution (up-sampling) can capture more subtle changes and features, and reducing the resolution (down-sampling) can remove noise and redundant information and highlight the main trends and patterns. For example, for a high-resolution but noisy load time series, appropriate down-sampling can reduce noise interference and more clearly show the long-term trend of the data. For a series with lower resolution, up-sampling can increase the number of data points for better fusion or analysis with other high-resolution data.
[0082] In a possible embodiment, through resampling and interpolation, new time series samples can also be generated to expand the data set, increase the diversity of data, and help improve the training effect and generalization ability of the model. In the process of resampling and interpolation, the data can be smoothed to a certain extent, reducing random noise and abnormal fluctuations in the data, making the data more stable and easier to analyze.
[0083] In a possible embodiment, based on multi-scale mixed load time series processing, time series with different periodic characteristics are decomposed respectively to obtain their respective seasonal parts and trend parts, and then the seasonal and trend components of different scales after decomposition are processed by resampling and interpolation methods for subsequent mixing, and the processed seasonal components and trend components of different scales are mixed, and the mixed seasonal components are obtained as mixed seasonal items, and the mixed trend components are obtained as mixed trend items. By resampling, interpolating and mixing components of different scales, multiple seasonalities and trends in load time series can be captured, which is suitable for scenarios where the influence of multiple time scales needs to be considered at the same time, such as time series with weekly, monthly and annual seasonality at the same time. Through this embodiment, information of different time scales can be comprehensively considered, a more comprehensive and accurate data description can be provided, and important features that may be ignored by a single scale can be avoided. It can cope with various periodic and trend changes in load time series, improve the model's understanding and processing capabilities of complex data patterns, and help capture more useful information, thereby improving the prediction accuracy of load time series.
[0084] In a possible embodiment, since the processing and fusion of multiple scales may increase the computational cost and time, it is necessary to select and adjust the parameters of multiple time scales to determine the appropriate number of scales, the weight of each scale, and the specific methods of decomposition and fusion, so as to avoid the model being too complicated or overfitting the data, resulting in a decrease in the generalization ability on new data.
[0085] Optionally, step S105, constructing a prediction model based on the training set, may include the following steps:
[0086] Step S401: construct an integrated model of decision trees.
[0087] The details are as follows:
[0088] The formula of the integrated model is: In the formula, is the output value of the ensemble model at the i-th time point, k is the number variable of the preset decision tree, K is the total number of decision trees, F is the set of decision trees, and f k is the kth decision tree, x i is the feature vector at the i-th time point, f k (x i ) is the function corresponding to the k-th decision tree;
[0089] Step S402: setting the objective function of the prediction model based on the training set;
[0090] Step S403: setting initialization parameters and number of iterations of the prediction model based on the training set;
[0091] Step S404: construct a prediction model based on the training set, the integrated model, the initialization parameters, the number of iterations and the objective function.
[0092] In an embodiment of the present application, a prediction model is constructed based on a training set. After separating the mixed seasonal terms and mixed trend terms, they are used as input to predict the load using a prediction model based on XGBoost (eXtreme Gradient Boosting). The training set input is the past seasonal terms and trend terms, and the output is the past load data.
[0093] In one possible embodiment, XGBoost is a high-precision integrated learning model based on gradient boosting decision trees. The embodiment of the present application uses this algorithm to build a prediction model. Its essence is to integrate multiple weak classifiers, such as decision trees 1-t, into a strong classifier to improve prediction accuracy. Figure 2 Schematic diagram of a prediction model provided in an embodiment of the present application. Figure 2 Taking regression prediction as an example, each tree of XGBoost, except tree 1, learns the residual (negative gradient) of the sum of the results of all previous trees. By accumulating the residual value with the previous predicted value, it can continuously approach the actual value. Its structure is as follows Figure 2 shown.
[0094] In a possible embodiment, based on the mathematical principle of XGBoost serial integration, for a known data set D = {(x i ,y i )}(x i ∈R m ,y i ∈R), build an integrated model of decision tree, which can be expressed by formula ④:
[0095]
[0096] In the formula, is the output value of the ensemble model at the i-th time point, k is the number variable of the preset decision tree, K is the total number of decision trees, F is the set of decision trees, x i is the feature vector of the ith data point.
[0097] In a possible embodiment, XGBoost adopts an incremental training method, that is, the original model is maintained during the training process, and a new item (i.e., a new tree) is added to the objective function each time, and each round of new trees added needs to reduce the objective function as much as possible. The prediction process in training can be expressed by formula ⑤:
[0098]
[0099] In the formula, is the model prediction value of the ith sample in the tth round. The ith sample corresponds to the ith time point. Keep the model prediction value of the previous round Then, add a new function f t (x i ).
[0100] In the embodiment of the present application, the prediction model is trained by XGBoost, the objective function is approximated by Taylor formula expansion, and the loss function is expanded by second order Taylor at the predicted value of the current model, so that the first and second derivatives of the loss function can be used to optimize the objective function. When defining the structure of the tree, including the weight vector of the leaf node and the mapping relationship from the instance to the leaf node, the complexity of the decision tree is jointly determined by the paradigm of the vector composed of the number of leaves and all the node weights. In the process of generating a tree, the key is to find the optimal split point of the leaf node. XGBoost supports greedy algorithms and approximate algorithms to split nodes. The greedy algorithm selects the optimal split point by enumerating all features and feature values and calculating the splitting benefits; the approximate algorithm uses the feature quantile as a candidate point for partitioning to reduce the amount of calculation. XGBoost also supports weighted quantiles, that is, taking quantiles based on the second-order derivative as weights. XGBoost can be used to train prediction models and automatically utilize the CPU's multi-threaded parallel computing to improve training speed. Data can be sorted and saved before training, and the results can be reused in iterations to reduce the amount of calculation. Regularization terms can be used to control the complexity of the model to prevent overfitting. In addition, the objective function and evaluation function can be customized, and the splitting direction can be automatically learned. Missing values can be processed, all possible subtrees can be established first, and then reverse pruning can be performed. Cross-validation can be used in each round of iteration to obtain the optimal number of iterations.
[0101] Optionally, step S402, setting the objective function of the prediction model based on the training set, may include the following steps:
[0102] Step S501: input the training set into the prediction model to obtain the model prediction value;
[0103] Step S502: Compare the model prediction value with the actual value corresponding to the load time series to obtain a prediction difference item;
[0104] Step S503: determining a regularization term based on the complexity of the integrated model;
[0105] Step S504: Setting the objective function based on the prediction difference term and the regularization term,
[0106] The details are as follows:
[0107] Among them, the objective function is Where LOSS is the objective function, is the predicted difference term, is the regularization term, n is the window length, is the loss function, is the model prediction value at time point i output by the prediction model, y i is the true value of the time point i corresponding to the load time series, k is the number variable of the preset decision tree, K is the total number of decision trees, T is the number of leaf nodes of the decision tree, γ and λ are regularization parameters, and W k is the weight of the leaf node of the kth decision tree.
[0108] In the embodiment of the present application, the objective function of the prediction model based on XGBoost consists of a prediction difference term and a regularization term, and the objective function can be expressed by formula ⑥:
[0109]
[0110] Where LOSS is the output value of the objective function, is the predicted difference term, is the regularization term, is the model prediction value output by the prediction model, y i is the true value corresponding to the load time series, T is the number of leaf nodes of the decision tree, γ and λ are regularization parameters, and W k is the weight of the leaf node.
[0111] The prediction difference term, also known as the loss function, is used to measure the difference between the model prediction value and the true value, usually using square error or logarithmic loss. The regularization term is used to control the complexity of the prediction model and prevent overfitting.
[0112] In a possible embodiment, the prediction model is first initialized, and the initial model is usually a constant, such as the mean of the target value. The prediction model is then iteratively trained, and the prediction value of the current model is calculated for each round of iteration, and the negative gradient of the loss function (i.e., the residual) is calculated as the new target value. Then, a new tree is trained to fit the negative gradient, the model is updated, and the complexity of the model is controlled by a regularization term to avoid overfitting. Finally, the training is terminated according to a preset number of iterations or other stopping criteria, such as the performance of the validation set no longer improving.
[0113] In a possible embodiment, the loss function can quantify the degree of difference between the model prediction result and the actual data. By calculating the value of the loss function, the performance of the model on a given data set can be evaluated. A smaller loss value indicates that the model's prediction result is closer to the actual value and the model performance is better; conversely, a larger loss value indicates that the model's prediction error is larger and the performance is poorer. The loss function provides a goal for the optimization of the model to find a set of model parameters that minimizes the value of the loss function. By selecting a suitable optimization algorithm, such as the gradient descent method, the stochastic gradient descent method, etc., the initialization parameters and the number of iterations in the model parameters can be continuously adjusted to optimize the model in the direction of reducing the loss, thereby improving the model's prediction ability and generalization ability. By calculating the loss function values of prediction models with different initialization parameters and iterations on the same data set, the performance of different prediction models can be compared, thereby selecting the model with the best performance. Adding a regularization term to the loss function can control the complexity of the model and prevent overfitting. The regularization term will penalize the parameters of the model so that the model will not be too complex during the optimization process, thereby improving the model's generalization ability on new data.
[0114] Optionally, step S403, setting initialization parameters and the number of iterations of the prediction model based on the training set, may include the following steps:
[0115] Step S601: Calculate the first error of the prediction model based on the model prediction value, the true value and a preset first error formula.
[0116] The details are as follows:
[0117] Among them, the first error formula is Where MAPE is the first error, n is the window length, is the model prediction value at time point i, y i is the true value at time point i;
[0118] Step S602: Calculate the second error of the prediction model based on the model prediction value, the true value and a preset second error calculation formula.
[0119] The details are as follows:
[0120] Among them, the second error calculation formula is: In the formula, RMSE is the second error, n is the window length, is the model prediction value at time point i, y i is the true value at time point i;
[0121] Step S603: adjusting the number of decision trees, the learning rate, and the maximum depth of the tree of the prediction model based on the first error and the second error to obtain a target number of decision trees, a target learning rate, and a target maximum depth of the tree;
[0122] Step S604: Set the target learning rate and the target maximum depth of the tree as initialization parameters, and use the target number of decision trees as the number of iterations.
[0123] In an embodiment of the present application, by setting the initialization parameters and number of iterations of the prediction model based on the training set, a balance value can be found by setting different initialization parameters and number of iterations, and the XGBoost-based prediction model can be optimized by the balance value to reduce the values of the first error and the second error.
[0124] In one possible embodiment, the learning rate controls the influence of each tree on the final prediction. A smaller learning rate can improve the generalization ability of the model, but more decision trees are required. When adjusting the learning rate, start with a larger learning rate (such as 0.1), gradually reduce it (such as 0.01, 0.001), and increase the number of decision trees accordingly.
[0125] In one possible embodiment, the total number of decision trees is constructed. More trees can better fit the data, but may also lead to overfitting. When adjusting the number of decision trees, adjust it together with the learning rate to find a balance. You can use a value between 100-500 and increase it step by step.
[0126] In a possible embodiment, the maximum depth of the tree is adjusted. A larger depth can learn more complex patterns, but it is also prone to overfitting. When the maximum depth is adjusted, it is generally adjusted between 3-10. A smaller value (such as 3-5) is suitable for simple data, and a larger value (such as 6-10) is suitable for complex data.
[0127] In one possible embodiment, after adjusting the number of decision trees, the learning rate, and the maximum depth of the tree of the prediction model based on the first error and the second error, the square error is used as the loss function, and the target number of decision trees is set to 100, the target learning rate is 0.1, and the target maximum depth is 3.
[0128] In a possible embodiment, the effect of the prediction model is evaluated based on MAPE and RMSE. MAPE is the mean absolute percentage error, and RMSE is the root mean square error. The larger the error, the larger the value. The error formulas of MAPE and RMSE can be expressed by formula 7 and formula 8 respectively:
[0129]
[0130] In the formula, is the model prediction value, y i is the true value.
[0131]
[0132] In the formula, is the model prediction value, y i is the true value.
[0133] Optionally, step S104, predicting the trend component and the seasonal component to obtain a test set including the predicted trend item and the predicted seasonal item, may include the following steps:
[0134] Step S701: Predict the trend component based on the preset trend component prediction formula to obtain a predicted trend item.
[0135] The details are as follows:
[0136] Among them, the prediction formula of the trend component is T t =β0+β1t+ε, where T t is the predicted trend term at time point t, t represents time, β0 is the intercept, β1 is the slope, and ε is the error term;
[0137] Step S702: Determine the previous seasonal cycle corresponding to the predicted seasonal item as the target seasonal cycle based on the seasonal cycle;
[0138] Step S703: taking the seasonal component in the target seasonal cycle as the predicted seasonal item;
[0139] Step S704: Integrate the predicted trend item and the predicted season item to obtain a test set.
[0140] In an embodiment of the present application, after the load time series is decomposed, for the prediction model of XGBoost, the test set input is the predicted seasonal item and trend item, where the seasonal item is copied using the seasonal item of the previous cycle, and since the trend item and time have a linear relationship, the trend item is predicted using linear regression.
[0141] In a possible embodiment, the trend item predicted by linear regression can be expressed by formula 9:
[0142] T t =β0+β1t+ε…………⑨
[0143] Where, T t is the forecast trend term, t represents time, β0 is the intercept, β1 is the slope, and ε is the error term. The intercept is the load forecast value of the forecast trend term when t=0, the slope is the change in the forecast trend term for each unit increase in time, and the error term is the part that cannot be explained by the forecast model.
[0144] In a possible embodiment, the intercept and slope values can be estimated by using the known historical data including the time and the corresponding trend item value, thereby obtaining a linear regression equation, which is then used to predict the future trend item. For example, for a set of historical data, the time t is [1, 2, 3, 4, 5], and the corresponding trend item is [10, 12, 14, 16, 18], then the linear regression equation can be obtained by calculation, that is, the prediction formula of the trend component is T t =8+2t. Further, based on the prediction formula, it can be predicted that the predicted trend item at t=6 is 20.
[0145] In a possible embodiment, load forecasting is performed based on a prediction model and a test set to obtain a load forecast result. First, for a given test set data, i.e., predicted seasonal items and trend items data, the test set data is input into a trained prediction model. Since the model has learned the relationship and pattern between past seasonal items and trend items and load data during the training phase, when new predicted seasonal items and trend items data are input into the model, the model will calculate and process the input data according to the rules and weights learned internally. After the model processing and calculation, the corresponding load forecast result will be output. For example, assuming that there is a set of predicted seasonal item data [s1, s2, s3] and trend item data [t1, t2, t3] in the test set, these data are organized into an input format acceptable to the model, such as a vector or matrix, and then input into the prediction model. After calculation, the model outputs the corresponding load forecast value [l1, l2, l3] to obtain the load forecast result.
[0146] In one possible embodiment, see Figure 3 , Figure 3 is a flow chart of an example method of load forecasting provided by an embodiment of the present application. Figure 3 In the process, user data input is first received, and then the time series in the user data is decomposed to obtain seasonal items, trend items and residuals. The seasonal items and trend items are further mixed to obtain mixed seasonal items and mixed trend items. After replication and linear regression prediction of the mixed seasonal items and mixed trend items, XGBoost analysis is performed to obtain the prediction result output.
[0147] In the embodiment of the present application, the multi-periodicity problem of the load series is solved by a multi-scale hybrid method. Unlike a single time series decomposition that can only separate one periodic term, it can effectively handle the complexity of multi-periodicity. Secondly, the combination of time series decomposition technology and XGBoost model not only utilizes the powerful processing power of deep learning, but also uses time series analysis to accurately capture the time-dependent characteristics of data, greatly improving the efficiency and accuracy of the model in predicting complex patterns and nonlinear relationships. These two points work together to make this method have higher practical value and better performance in the field of power load forecasting. By predicting the load demand to obtain the load forecast result, load demand planning and resource allocation can be carried out. For example, power companies can plan power generation and transmission resources in advance based on seasonal terms and trend terms to meet different seasonal and long-term electricity demand.
[0148] In summary, in the implementation mode of the present application, the load time series of the power system is first obtained, and then the load time series is decomposed to obtain the trend component and seasonal component of the load time series, and the trend component and the seasonal component are mixed at multiple scales to obtain a training set containing mixed trend items and mixed seasonal items, and the trend component and the seasonal component are predicted to obtain a test set containing predicted trend items and predicted seasonal items, and then a prediction model is constructed based on the training set, and finally, load prediction is performed based on the prediction model and the test set to obtain the load prediction result. Thus, by decomposing and mixing the load time series at multiple scales, the multi-periodicity of the load series is taken into account, and the components of different periods can be more comprehensively decomposed, effectively solving the problem of multi-periodicity of the load series. Secondly, for the decomposed trend item and seasonal item, prediction methods suitable for their data characteristics are respectively adopted. The trend item shows a linear relationship with time, so the linear regression method is used for prediction, and the seasonal item remains relatively consistent in multiple data instances, so it is processed by replication. Based on the training set, a prediction model is constructed, and the time series decomposition technology is combined with the XGBoost model. The load time series analysis is fully utilized to process the periodicity and trend of the data. The XGBoost model's powerful ability in deep learning can effectively improve the learning and prediction capabilities of complex patterns and nonlinear relationships. After obtaining trend items, seasonal items and other components through multi-scale mixed decomposition, these components are input into the XGBoost model as features for training and prediction. The XGBoost model can automatically learn the complex relationships between these features and give the load prediction results. Through this combination, various patterns and laws in the load data can be captured more accurately, thereby improving the accuracy and reliability of load prediction. This method has a good effect when processing load data with multiple periodicities, complex patterns and nonlinear relationships, and provides an effective solution for load prediction.
[0149] The method of the embodiment of the present invention is described in detail above, and the device of the embodiment of the present invention is provided below.
[0150] See also Figure 4 , Figure 4 4 is a schematic diagram of a load prediction device provided in an embodiment of the present application. The load prediction device 400 includes an acquisition unit 401 and a processing unit 402;
[0151] An acquisition unit 401 is used to acquire a load time series of a power system;
[0152] The processing unit 402 is used to decompose the load time series to obtain the trend component and seasonal component of the load time series;
[0153] Perform multi-scale mixing on the trend component and the seasonal component to obtain a training set containing mixed trend terms and mixed seasonal terms;
[0154] Predict the trend component and seasonal component to obtain a test set containing predicted trend items and predicted seasonal items;
[0155] Build a prediction model based on the training set;
[0156] Load forecasting is performed based on the prediction model and test set to obtain load forecasting results.
[0157] In some possible embodiments, in terms of decomposing the load time series to obtain the trend component and the seasonal component of the load time series, the processing unit 402 is specifically configured to:
[0158] Determine the seasonal period of the load time series;
[0159] Determine the window length of the moving average based on the seasonal cycle;
[0160] The load time series is calculated based on the preset trend component estimation formula and window length to obtain the trend component, as follows:
[0161] The estimation formula of the trend component is: Where, T t is the value of the trend component at time point t, i is the time point variable of the preset load time series, y t+i is the value at time point t+i in the load time series, n is the window length, a is the preset variable of the window length, and the relationship between n and a is n=2a+1;
[0162] Subtract the trend component from the load time series to obtain a detrended load time series;
[0163] The detrended load time series is calculated based on the preset seasonal component estimation formula and seasonal cycle to obtain the seasonal component, as follows:
[0164] Among them, the estimation formula of seasonal component is In the formula, S t is the value of the seasonal component at time point t, j is the time point variable of the preset detrended load time series, D t+j*p is the value of the detrended load time series at time point t+j*p, m is the length of the seasonal cycle, and p is the number of seasonal cycles;
[0165] The trend component and seasonal component are integrated to obtain the trend component and seasonal component of the load time series.
[0166] In some possible embodiments, in performing multi-scale mixing of trend components and seasonal components to obtain a training set including mixed trend terms and mixed seasonal terms, the processing unit 402 is specifically configured to:
[0167] Determine multiple time scales of load time series;
[0168] Resample the trend component and seasonal component based on multiple time scales to obtain resampling results;
[0169] Perform interpolation processing on the resampling result to obtain an interpolation result;
[0170] Based on multiple time scales, the trend components and seasonal components in the interpolation results are mixed to obtain mixed trend terms and mixed seasonal terms.
[0171] The mixed trend term and the mixed seasonal term are integrated to obtain the training set.
[0172] In some possible embodiments, in terms of building a prediction model based on a training set, the processing unit 402 is specifically configured to:
[0173] Construct an integrated model of decision trees as follows:
[0174] The formula of the integrated model is: In the formula, is the output value of the ensemble model at the i-th time point, k is the number variable of the preset decision tree, K is the total number of decision trees, F is the set of decision trees, and f k is the kth decision tree, x i is the feature vector at the i-th time point, f k (x i ) is the function corresponding to the k-th decision tree;
[0175] Set the objective function of the prediction model based on the training set;
[0176] Set the initialization parameters and number of iterations of the prediction model based on the training set;
[0177] Construct a prediction model based on the training set, ensemble model, initialization parameters, number of iterations, and objective function.
[0178] In some possible embodiments, in setting the objective function of the prediction model based on the training set, the processing unit 402 is specifically configured to:
[0179] Input the training set into the prediction model to obtain the model prediction value;
[0180] Compare the model prediction value with the actual value corresponding to the load time series to obtain the prediction difference term;
[0181] Determine the regularization term based on the complexity of the ensemble model;
[0182] The objective function is set based on the prediction difference term and the regularization term as follows:
[0183] Among them, the objective function is Where LOSS is the objective function, is the predicted difference term, is the regularization term, n is the window length, is the loss function, is the model prediction value at time point i output by the prediction model, y i is the true value of the time point i corresponding to the load time series, k is the number variable of the preset decision tree, K is the total number of decision trees, T is the number of leaf nodes of the decision tree, γ and λ are regularization parameters, and W k is the weight of the leaf node of the kth decision tree.
[0184] In some possible embodiments, in terms of setting initialization parameters and the number of iterations of the prediction model based on the training set, the processing unit 402 is specifically configured to:
[0185] The first error of the prediction model is calculated based on the model prediction value, the true value and the preset first error formula as follows:
[0186] Among them, the first error formula is Where MAPE is the first error, n is the window length, is the model prediction value at time point i, y i is the true value at time point i;
[0187] The second error of the prediction model is calculated based on the model prediction value, the true value and the preset second error calculation formula as follows:
[0188] Among them, the second error calculation formula is: In the formula, RMSE is the second error, n is the window length, is the model prediction value at time point i, y i is the true value at time point i;
[0189] Adjust the number of decision trees, the learning rate, and the maximum depth of the trees of the prediction model based on the first error and the second error to obtain a target number of decision trees, a target learning rate, and a target maximum depth of the trees;
[0190] The target learning rate and the target maximum depth of the tree are set as initialization parameters, and the target number of decision trees is taken as the number of iterations.
[0191] In some possible embodiments, in predicting the trend component and the seasonal component to obtain a test set including the predicted trend item and the predicted seasonal item, the processing unit 402 is specifically configured to:
[0192] The trend component is predicted based on the preset trend component prediction formula to obtain the predicted trend item, which is as follows:
[0193] Among them, the prediction formula of the trend component is T t =β0+β1t+ε, where T t is the predicted trend term at time point t, t represents time, β0 is the intercept, β1 is the slope, and ε is the error term;
[0194] Based on the seasonal cycle, determine the previous seasonal cycle corresponding to the predicted seasonal item as the target seasonal cycle;
[0195] The seasonal component in the target seasonal cycle is used as the predicted seasonal term;
[0196] The predicted trend item and the predicted season item are integrated to obtain the test set.
[0197] See also Figure 5 , Figure 5 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device 500 includes a transceiver 501, a processor 502 and a memory 503. They are connected via a bus 504. The memory 503 is used to store computer programs and data, and can transmit the data stored in the memory 503 to the processor 502. The electronic device can be the load forecasting device mentioned above, and the processor 502 can be the acquisition unit 401 and the processing unit 402 mentioned above.
[0198] The processor 502 is used to read the computer program in the memory 503 and perform the following operations:
[0199] Obtain the load time series of the power system;
[0200] Decompose the load time series to obtain the trend component and seasonal component of the load time series;
[0201] Perform multi-scale mixing on the trend component and the seasonal component to obtain a training set containing mixed trend terms and mixed seasonal terms;
[0202] Predict the trend component and seasonal component to obtain a test set containing predicted trend items and predicted seasonal items;
[0203] Build a prediction model based on the training set;
[0204] Load forecasting is performed based on the prediction model and test set to obtain load forecasting results.
[0205] In some possible embodiments, in terms of decomposing the load time series to obtain the trend component and the seasonal component of the load time series, the processor 502 is specifically configured to perform the following operations:
[0206] Determine the seasonal period of the load time series;
[0207] Determine the window length of the moving average based on the seasonal cycle;
[0208] The load time series is calculated based on the preset trend component estimation formula and window length to obtain the trend component, as follows:
[0209] The estimation formula of the trend component is: Where, T t is the value of the trend component at time point t, i is the time point variable of the preset load time series, y t+i is the value at time point t+i in the load time series, n is the window length, a is the preset variable of the window length, and the relationship between n and a is n=2a+1;
[0210] Subtract the trend component from the load time series to obtain a detrended load time series;
[0211] The detrended load time series is calculated based on the preset seasonal component estimation formula and seasonal cycle to obtain the seasonal component, as follows:
[0212] Among them, the estimation formula of seasonal component is In the formula, S t is the value of the seasonal component at time point t, j is the time point variable of the preset detrended load time series, D t+j*p is the value of the detrended load time series at time point t+j*p, m is the length of the seasonal cycle, and p is the number of seasonal cycles;
[0213] The trend component and seasonal component are integrated to obtain the trend component and seasonal component of the load time series.
[0214] In some possible embodiments, in performing multi-scale mixing of trend components and seasonal components to obtain a training set including mixed trend terms and mixed seasonal terms, the processor 502 is specifically configured to perform the following operations:
[0215] Determine multiple time scales of load time series;
[0216] Resample the trend component and seasonal component based on multiple time scales to obtain resampling results;
[0217] Perform interpolation processing on the resampling result to obtain an interpolation result;
[0218] Based on multiple time scales, the trend components and seasonal components in the interpolation results are mixed to obtain mixed trend terms and mixed seasonal terms.
[0219] The mixed trend term and the mixed seasonal term are integrated to obtain the training set.
[0220] In some possible embodiments, in terms of building a prediction model based on a training set, the processor 502 is specifically configured to perform the following operations:
[0221] Construct an integrated model of decision trees as follows:
[0222] The formula of the integrated model is: In the formula, is the output value of the ensemble model at the i-th time point, k is the number variable of the preset decision tree, K is the total number of decision trees, F is the set of decision trees, and f k is the kth decision tree, x i is the feature vector at the i-th time point, f k (x i ) is the function corresponding to the k-th decision tree;
[0223] Set the objective function of the prediction model based on the training set;
[0224] Set the initialization parameters and number of iterations of the prediction model based on the training set;
[0225] Construct a prediction model based on the training set, ensemble model, initialization parameters, number of iterations, and objective function.
[0226] In some possible embodiments, in terms of setting the objective function of the prediction model based on the training set, the processor 502 is specifically configured to perform the following operations:
[0227] Input the training set into the prediction model to obtain the model prediction value;
[0228] Compare the model prediction value with the actual value corresponding to the load time series to obtain the prediction difference term;
[0229] Determine the regularization term based on the complexity of the ensemble model;
[0230] The objective function is set based on the prediction difference term and the regularization term as follows:
[0231] Among them, the objective function is Where LOSS is the objective function, is the predicted difference term, is the regularization term, n is the window length, is the loss function, is the model prediction value at time point i output by the prediction model, y i is the true value of the time point i corresponding to the load time series, k is the number variable of the preset decision tree, K is the total number of decision trees, T is the number of leaf nodes of the decision tree, γ and λ are regularization parameters, and W k is the weight of the leaf node of the kth decision tree.
[0232] In some possible embodiments, in terms of setting the initialization parameters and the number of iterations of the prediction model based on the training set, the processor 502 is specifically configured to perform the following operations:
[0233] The first error of the prediction model is calculated based on the model prediction value, the true value and the preset first error formula as follows:
[0234] Among them, the first error formula is Where MAPE is the first error, n is the window length, is the model prediction value at time point i, y i is the true value at time point i;
[0235] The second error of the prediction model is calculated based on the model prediction value, the true value and the preset second error calculation formula as follows:
[0236] Among them, the second error calculation formula is: In the formula, RMSE is the second error, n is the window length, is the model prediction value at time point i, y i is the true value at time point i;
[0237] Adjust the number of decision trees, the learning rate, and the maximum depth of the trees of the prediction model based on the first error and the second error to obtain a target number of decision trees, a target learning rate, and a target maximum depth of the trees;
[0238] The target learning rate and the target maximum depth of the tree are set as initialization parameters, and the target number of decision trees is taken as the number of iterations.
[0239] In some possible embodiments, in predicting the trend component and the seasonal component to obtain a test set including the predicted trend item and the predicted seasonal item, the processor 502 is specifically configured to perform the following operations:
[0240] The trend component is predicted based on the preset trend component prediction formula to obtain the predicted trend item, which is as follows:
[0241] Among them, the prediction formula of the trend component is T t =β0+β1t+ε, where T t is the predicted trend term at time point t, t represents time, β0 is the intercept, β1 is the slope, and ε is the error term;
[0242] Based on the seasonal cycle, determine the previous seasonal cycle corresponding to the predicted seasonal item as the target seasonal cycle;
[0243] The seasonal component in the target seasonal cycle is used as the predicted seasonal term;
[0244] The predicted trend item and the predicted season item are integrated to obtain the test set.
[0245] It should be understood that the load forecasting device of the present application may be a power system terminal, wherein the power system terminal may be an intelligent fusion terminal of the power system or a power load management terminal, and the like.
[0246] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. The computer program is executed by a processor to implement part or all of the steps of any load forecasting implementation method recorded in the above method embodiments.
[0247] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps of any load forecasting method recorded in the above method embodiments.
[0248] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0249] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0250] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the modules, which is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the device or module can be electrical or other forms.
[0251] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0252] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software program modules.
[0253] If the integrated module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0254] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, etc.
[0255] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A load forecasting method, characterized in that: include: Obtain the load time series of the power system; Decomposing the load time series to obtain a trend component and a seasonal component of the load time series; Performing multi-scale mixing on the trend component and the seasonal component to obtain a training set including a mixed trend term and a mixed seasonal term; Predicting the trend component and the seasonal component to obtain a test set including a predicted trend item and a predicted seasonal item; Building a prediction model based on the training set; Load forecasting is performed based on the forecasting model and the test set to obtain a load forecasting result.
2. The method according to claim 1, characterized in that Decomposing the load time series to obtain the trend component and seasonal component of the load time series includes: determining a seasonal period of the load time series; Determining a moving average window length based on the seasonal cycle; The load time series is calculated based on a preset estimation formula of the trend component and the window length to obtain the trend component, as follows: Among them, the estimation formula of the trend component is: Where, T t is the value of the trend component at time point t, i is the time point variable of the preset load time series, y t+i is the value at time point t+i in the load time series, n is the window length, a is the preset variable of the window length, and the relationship between n and a is n=2a+1; Subtracting the trend component from the load time series to obtain a detrended load time series; The detrended load time series is calculated based on a preset estimation formula of the seasonal component and the seasonal cycle to obtain the seasonal component, as follows: Among them, the estimation formula of the seasonal component is In the formula, S t is the value of the seasonal component at time point t, j is the time point variable of the preset detrended load time series, D t+j*p is the value at time point t+j*p in the detrended load time series, m is the length of the seasonal cycle, and p is the number of seasonal cycles; The trend component and the seasonal component are integrated to obtain the trend component and the seasonal component of the load time series.
3. The method according to claim 2, characterized in that The multi-scale mixing of the trend component and the seasonal component to obtain a training set containing a mixed trend term and a mixed seasonal term includes: determining a plurality of time scales of the load time series; Resampling the trend component and the seasonal component based on the multiple time scales to obtain a resampling result; Performing interpolation processing on the resampling result to obtain an interpolation result; Based on the multiple time scales, the trend component and the seasonal component in the interpolation result are respectively mixed to obtain the mixed trend term and the mixed seasonal term; The mixed trend term and the mixed seasonal term are integrated to obtain the training set.
4. The method according to claim 3, characterized in that The constructing of a prediction model based on the training set includes: Construct an integrated model of decision trees as follows: Among them, the formula of the integrated model is In the formula, is the output value of the ensemble model at the i-th time point, k is the number variable of the preset decision trees, K is the total number of decision trees, F is the set of decision trees, and f k is the kth decision tree, x i is the feature vector at the i-th time point, f k (x i ) is the function corresponding to the k-th decision tree; Setting the objective function of the prediction model based on the training set; Setting initialization parameters and number of iterations of the prediction model based on the training set; The prediction model is constructed based on the training set, the integrated model, the initialization parameters, the number of iterations and the objective function.
5. The method according to claim 4, characterized in that The step of setting the objective function of the prediction model based on the training set includes: Inputting the training set into the prediction model to obtain a model prediction value; Compare the model prediction value with the actual value corresponding to the load time series to obtain a prediction difference term; determining a regularization term based on the complexity of the ensemble model; The objective function is set based on the prediction difference term and the regularization term, specifically as follows: Among them, the objective function is Where LOSS is the objective function, is the predicted difference term, is the regularization term, n is the window length, is the loss function, is the model prediction value at time point i output by the prediction model, y i is the true value of the time point i corresponding to the load time series, k is the number variable of the preset decision tree, K is the total number of decision trees, T is the number of leaf nodes of the decision tree, γ and λ are regularization parameters, W k is the weight of the leaf node of the kth decision tree.
6. The method according to claim 5, characterized in that The step of setting the initialization parameters and the number of iterations of the prediction model based on the training set includes: The first error of the prediction model is calculated based on the model prediction value, the true value and a preset first error formula, specifically as follows: Among them, the first error formula is: Wherein, MAPE is the first error, n is the window length, is the model prediction value at time point i, y i is the true value at time point i; The second error of the prediction model is calculated based on the model prediction value, the true value and a preset second error calculation formula, specifically as follows: Among them, the second error calculation formula is: Where, RMSE is the second error, n is the window length, is the model prediction value at time point i, y i is the true value at time point i; Adjust the number of decision trees, the learning rate, and the maximum depth of the trees of the prediction model based on the first error and the second error to obtain a target number of decision trees, a target learning rate, and a target maximum depth of the trees; The target learning rate and the target maximum depth of the tree are set as the initialization parameters, and the target number of decision trees is used as the number of iterations.
7. The method according to any one of claims 2 to 6, characterized in that: The predicting of the trend component and the seasonal component to obtain a test set containing a predicted trend item and a predicted seasonal item includes: The trend component is predicted based on a preset prediction formula of the trend component to obtain a predicted trend item, which is as follows: Among them, the prediction formula of the trend component is T t =β0+β1t+ε, where T t is the predicted trend term at time point t, t represents time, β0 is the intercept, β1 is the slope, and ε is the error term; Based on the seasonal cycle, determine the previous seasonal cycle corresponding to the predicted seasonal item as the target seasonal cycle; Taking the seasonal component in the target seasonal cycle as the predicted seasonal item; The predicted trend item and the predicted season item are integrated to obtain the test set.
8. A load forecasting device, characterized in that: The device comprises a processing unit and an acquisition unit; The acquisition unit is used to acquire the load time series; The processing unit is used to decompose the load time series to obtain the trend component and seasonal component of the load time series; Performing multi-scale mixing on the trend component and the seasonal component to obtain a training set including a mixed trend term and a mixed seasonal term; Predicting the trend component and the seasonal component to obtain a test set including a predicted trend item and a predicted seasonal item; Building a prediction model based on the training set; Load forecasting is performed based on the forecasting model and the test set to obtain a load forecasting result.
9. An electronic device, characterized in that: include: A processor and a memory, wherein the processor is connected to the memory, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 7.
Citation Information
Cited By
Power time sequence prediction method and system based on large-scale language model, terminal and storage medium thereof
CN119357594A
Short-term load prediction method and system based on trending and seasonal modeling
CN120222324A
A short-term load forecasting method and system based on trend and seasonal modeling
CN120222324B
Power grid load prediction method and device based on XGBoost model, and medium
CN121529545A
Short-term bus load prediction method, device, equipment and medium
CN122159183A
