Short-term load forecasting method based on sarima-random forest combination model
By decomposing load data using the SARIMA-random forest combined model and incorporating external factors, the problem of insufficient accuracy and interpretability in load forecasting in existing technologies is solved, achieving more efficient short-term load forecasting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA THREE GORGES UNIV
- Filing Date
- 2022-11-03
- Publication Date
- 2026-05-29
AI Technical Summary
Existing power load forecasting methods are difficult to accurately reflect the characteristics of load change trends and external factors. Furthermore, they are challenging to train, have long running times, and lack interpretability when dealing with multidimensional features.
A short-term load forecasting method based on the SARIMA-random forest combined model is adopted. The load data is decomposed into trend, seasonal and residual terms. The SARIMA model is used to predict the trend, and the random forest model is combined to process the residuals, taking into account the influence of external factors.
It improves the accuracy of load forecasting, reduces the dimensionality and runtime of data processing, and enhances the interpretability of the model.
Smart Images

Figure CN115800245B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of short-term power load forecasting technology, and specifically to a short-term load forecasting method based on the SARIMA-random forest combined model. Background Technology
[0002] Artificial intelligence technology, characterized by big data and algorithms, has become an important means to promote technological progress in the field of power load forecasting. Accurate forecasting is of practical significance for improving the economic operation of the power system, power dispatch, and safety issues.
[0003] To address issues such as nonlinearity of power load, subjectivity in model parameter settings, and the diversity of external factors, current researchers have proposed various methods to improve prediction. These methods typically involve assigning weights to different types of features before training the model. However, due to the varying degrees of influence of different features on the load and the significant impact of external factors, this approach struggles to intuitively reflect load change trends and the characteristics of external factors. There is room for improvement in interpretability. Furthermore, the large dimensions of historical data and influencing factors make training difficult and time-consuming. Therefore, a load prediction method is needed that can ensure data interpretability while extracting feature information through classification, and maintain a fast operating speed when processing multi-dimensional features. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention provides a short-term load forecasting method based on the SARIMA-random forest combined model. This method can accurately predict the load of the next day when the historical load and weather factors of the day to be measured are known, thereby improving the forecasting accuracy.
[0005] The technical solution adopted in this invention is as follows:
[0006] The short-term load forecasting method based on the SARIMA-random forest combined model includes the following steps:
[0007] Step 1: Use a sliding window to group the preprocessed raw load data, create a previous week-next day dataset, and decompose each sample to obtain the trend term. Seasonal items and residuals ;
[0008] Step 2: Determine parameters and build a SARIMA model, and predict based on known previous week data. The changes the following day yielded preliminary predictions. z and residual r ;
[0009] Step 3: Cluster weather factors to obtain similar days, group them to construct a weather-residual dataset and build a random forest regression model to learn the relationship between weather factors and residuals.r Relationship;
[0010] Step 4: Combine the prediction results of the above models and compare the impact of feature clustering and residual training on the accuracy of load prediction.
[0011] Step 1 includes the following steps:
[0012] S1.1: Normalized raw load data:
[0013] (1);
[0014] In the formula, , These represent the maximum and minimum values of the load characteristics at different times;
[0015] Grouping and building a previous-next-week dataset using a sliding window;
[0016] (2);
[0017] In the formula, m , These represent the number of samples in the original load data and the previous week-next day dataset, respectively. l The length of the sliding window;
[0018] S1.2: Use Python's time series decomposition module to sequentially obtain the trend terms of each sample in the previous week's - next day dataset. Seasonal items and residuals The mathematical expression for this process is:
[0019] (3);
[0020] In the formula, For sequences in the dataset i The corresponding subsequences are obtained by decomposition.
[0021] Step 2 includes the following steps:
[0022] S2.1: Determine the sequence The stability and randomness of the property Perform unit root test (ADF) and white noise test (LB) respectively. Based on the results of the unit root test (ADF)... t Statistics p Stability is judged by values and critical values of 1%, 5%, and 10%. t The absolute value of the statistic is greater than the critical value, and p A value less than 0.05 indicates that the sequence is stationary; otherwise, the sequence is stationary using differencing operations. The degree of differencing is denoted as . dNext. Based on the output of the white noise test (LB). p The value determines whether the sequence is white noise. p If all values are less than 0.05 or equal to 0, then the sequence is not white noise and has value for further analysis.
[0023] S2.2: Observation The characteristics of the autocorrelation coefficient (ACF) plot and partial autocorrelation coefficient (PACF) plot are used to determine the parameters of the SARIMA model, including... p Rank regression model (AR) q Moving average (MA) model and seasonal parameters s Its expression is shown in equations (4) and (5):
[0024] (4);
[0025] In equation (4), For sequence of t Time-corresponding value ε t For the error term, p The order of autoregression; , , Representing sequences respectively exist t Before the moment p The corresponding value at each time point; , , They represent the preceding p The autoregressive coefficient at time point 1.
[0026] (5);
[0027] In equation (5), For sequence of t Time-corresponding value q The moving average order; , , Representing sequences respectively exist t Before the moment q Each time point corresponds to an error term; , , They represent the preceding q The moving average coefficient at each time point.
[0028] S2.3: Table 1 shows the SARIMA model parameters. p and q Judgment method:
[0029]
[0030] S2.4: Determine the parameters of the SARIMA model that take into account seasonal effects ( P , Q , D Based on the Bayesian Information Criterion, calculate the values of different parameters. BIC value , The parameter corresponding to the minimum value is used as the final selection, where... P For the order of seasonal autoregression, Q Let the seasonal difference order be , D This represents the order of the seasonal moving average. The calculation formula is shown in equation (6):
[0031] (6);
[0032] In equation (6), n and L These represent the number of training samples and the likelihood function, respectively. k The number of model parameters;
[0033] S2.5: Will Using the data from a week ago as input, the SARIMA model is used to predict... The trend of change the next day, superimposed The results are used as preliminary prediction results. z And obtain the residuals of the preliminary prediction results based on the actual values. r。
[0034] Step 3 includes the following steps:
[0035] S3.1: Fuzzy clustering is used to divide the weather factors corresponding to the daily historical load to obtain similar days. As shown in Equation (7), the sum and variance corresponding to different numbers of groups are calculated using the elbow method. SSE ,choose SSE The turning point of change is used as the optimal number of clusters. C ;
[0036] (7);
[0037] In the formula, y c For the first c Samples in the group; For the first c Cluster centers of groups;N This represents the total number of samples in this group.
[0038] S3.2: Based on the clustering results, the residuals of the test days in the initial training results in the cluster groups are... r Using weather factors as the target value and weather as the feature, a weather-residual dataset is built by clustering. A random forest regression model is then used for training, with the hyperparameter—the number of trees—determined using a grid search method. n_estimators And the depth of the tree max_depth The trained model is used to predict the target value for the test day, i.e., the training residual. ;
[0039] In step 4, z and The load forecast results are obtained by adding them together. , Calculate the mean square error (MSE) MSE Mean absolute error ( MAE ) and coefficient of determination ( R 2 The performance of single models and combined models is evaluated, including SARIMA models, SARIMA-non-clustered forest combined models, and SARIMA-clustered forest combined models.
[0040] (8);
[0041] (9);
[0042] (10);
[0043] In the formula, J The number of samples in the test set. For the first j The predicted value for each sample, y j For the first j The true load value of each sample; This represents the mean of the sample to be tested.
[0044] This invention provides a short-term load forecasting method based on a SARIMA-random forest combined model, with the following technical advantages:
[0045] 1) Based on the preprocessing of load data, this invention further mines data features, decomposes the load series into trend terms, seasonal terms and residual terms, and introduces time series analysis methods to predict short-term loads, which helps to analyze the variation patterns of loads.
[0046] 2) In dealing with the problem of large feature dimensions of the load, this invention provides a solution for data dimensionality reduction. Instead of using direct dimensionality reduction, it uses different models for training according to the feature type of the sample, so as to better utilize the influence of different types of features on the output results.
[0047] 3) This invention uses the SARIMA model, a time series analysis method, to predict the trend term of the subsequence. It takes advantage of the SARIMA model to handle seasonal non-stationary time series and linear problems, analyzes the variation law of the load itself, and reflects the influence of external factors in the residuals.
[0048] 4) This invention trains the residuals predicted by a single model using a cluster-based improved random forest, and builds models separately by utilizing the commonalities between similar days, thereby improving the prediction accuracy.
[0049] 5) This invention uses a SARIMA-random forest combined model for short-term load forecasting. On the one hand, it uses time series methods to determine the changing trend of the data itself. On the other hand, it uses residual processing to explain the impact of external factors on the load, making full use of the advantages of the two models in processing data and improving the utilization rate of the model. Attached Figure Description
[0050] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0051] Figure 1 This is a flowchart of a short-term load forecasting method based on the SARIMA-random forest combined model.
[0052] Figure 2 Flowchart for data processing in a sliding window.
[0053] Figure 3 Flowchart for predicting the trend term using the SARIMA model.
[0054] Figure 4 This is a flowchart of a regression forest model based on clustering improvement.
[0055] Figure 5 This is a decomposition diagram of the sample sequence to be tested.
[0056] Figure 6 This is a comparison chart of the preliminary prediction results and the actual values for the sample to be tested.
[0057] Figure 7 Elbow method for clustering parameters.
[0058] Figure 8(a) is a comparison chart of residual prediction results;
[0059] Figure 8(b) is a comparison chart of load forecast results. Detailed Implementation
[0060] The short-term load forecasting method based on the SARIMA-random forest combined model firstly groups the raw load data using a sliding window, and decomposes the previous week sequence of each group to obtain trend, seasonal, and residual terms. Secondly, a SARIMA model is established to predict the trend term, obtaining preliminary prediction results and residuals. Finally, an improved random forest model is used to learn the relationship between weather factors and residuals, and the prediction performance of different models is compared. Specifically, the method includes the following steps:
[0061] Step 1: Data Preprocessing
[0062] By using a sliding window to group the preprocessed raw load data, a previous-next-day dataset can be created, and the trend term can be obtained by decomposing each sample. Seasonal items and residuals ;
[0063] Step one includes the following steps:
[0064] S1.1: Normalized raw load data:
[0065] (1);
[0066] In the formula, , These represent the maximum and minimum values of the load characteristics at different times;
[0067] Grouping and building a previous-next-week dataset using a sliding window;
[0068] (2);
[0069] In the formula, m , These represent the number of samples in the original load data and the previous week-next day dataset, respectively. l The length of the sliding window;
[0070] S1.2: Use Python's time series decomposition module to sequentially obtain the trend terms of each sample in the previous week's - next day dataset. Seasonal items and residuals The mathematical expression for this process is:
[0071] (3);
[0072] In the formula, For sequences in the dataset i The corresponding subsequences are obtained by decomposition.
[0073] Step 2: Establish a SARIMA model to predict the trend term:
[0074] Determine the parameters and build a SARIMA model, then predict based on known previous week data. The changes the following day yielded preliminary predictions. z and residual r ;
[0075] Step two includes the following steps:
[0076] Step 2.1: Determine the sequence The stability and randomness of the property Perform unit root test (ADF) and white noise test (LB) respectively. Based on the ADF test results... t Statistics p Stability is judged by values and critical values of 1%, 5%, and 10%. t The absolute value of the statistic is greater than the critical value, and p A value less than 0.05 indicates that the sequence is stationary; otherwise, the sequence is stationary using differencing operations. The degree of differencing is denoted as . d Next. Based on the output of the LB test. p The value determines whether the sequence is white noise. p If all values are less than 0.05 or equal to 0, then the sequence is not white noise and has value for further analysis.
[0077] Step 2.2: Observation The characteristics of the autocorrelation coefficient (ACF) plot and partial autocorrelation coefficient (PACF) plot determine the SARIMA model parameters, including p Rank regression model (AR) q Moving average (MA) model and seasonal parameters s Its expression is shown in equations (4) and (5):
[0078] (4);
[0079] In the formula, For sequence of t Time-corresponding value ε t For the error term, p The order of autoregression; , , Representing sequences respectively exist t Before the moment p The corresponding value at each time point; , , They represent the precedingp The autoregressive coefficient at time point 1.
[0080] (5);
[0081] In the formula, For sequence of t Time-corresponding value q The moving average order; , , Representing sequences respectively exist t Before the moment q Each time point corresponds to an error term; , , They represent the preceding q The moving average coefficient at each time point.
[0082] Step 2.3: Table 1 shows the SARIMA model parameters. p and q Judgment method:
[0083]
[0084] Step 2.4: Determine the parameters of the SARIMA model that take into account seasonal effects ( P , Q , D Based on the Bayesian Information Criterion, calculate the values of different parameters. BIC value , The parameter corresponding to the minimum value is used as the final selection, where... P For the order of seasonal autoregression, Q Let the seasonal difference order be , D This represents the order of the seasonal moving average. The calculation formula is shown in equation (6):
[0085] (6);
[0086] In the formula, n and L These represent the number of training samples and the likelihood function, respectively. k The number of model parameters;
[0087] Step 2.5: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation would require the full context.] Using the data from a week ago as input, the SARIMA model is used to predict... The trend of change the next day, superimposed The result as zAnd obtain preliminary prediction results based on the actual values. r。
[0088] Step 3: Establish a random forest model;
[0089] Clustering weather factors to obtain similar days, grouping them to construct a weather-residual dataset, and building a random forest regression model to learn the relationship between weather factors and... r Relationship;
[0090] Step three includes the following steps:
[0091] Step 3.1: Use fuzzy clustering to divide the weather factors corresponding to the daily historical load and obtain similar days. As shown in Equation (7), use the elbow method to calculate the sum and variance corresponding to different numbers of groups. SSE ,choose SSE The turning point of change is used as the optimal number of clusters. C ;
[0092] (7);
[0093] In the formula, y c For the first c Samples in the group; For the first c Cluster centers of groups; N This represents the total number of samples in this group.
[0094] Step 3.2: Based on the clustering results, the residuals of the test days in the initial training results within the clusters are used as the target values, and weather factors are used as features. A weather-residual dataset is established by cluster, and trained using a random forest regression model. The hyperparameter, the number of trees, is determined using a grid search method. n_estimators And the depth of the tree max_depth The trained model is used to predict the target value for the test day, i.e., the training residual. ;
[0095] Step 4: Prediction results of the combined model:
[0096] By combining the prediction results of the above models, we can compare the impact of feature clustering and residual training on the accuracy of load prediction.
[0097] Will z and The load forecast results are obtained by adding them together. , Calculate the mean square error (MSE) MSE Mean absolute error ( MAE ) and coefficient of determination ( R 2The performance of single models and combined models is evaluated, including SARIMA models, SARIMA-non-clustered forest combined models, and SARIMA-clustered forest combined models.
[0098] (8);
[0099] (9);
[0100] (10);
[0101] In the formula, J The number of samples in the test set. For the first j The predicted value for each sample, y j For the first j The true load value of each sample; This represents the mean of the sample to be tested.
[0102] This invention uses the daily load characteristics of all times before the week of the day to be measured as the input of the SARIMA model, and weather factors as the features that cause residuals. By processing different features separately, the dimensionality of the data features is reduced.
[0103] This invention clusters weather factors based on five dimensions and obtains similar day groups. Random forest models are then built and trained on the residual samples in the same group. The grid search method is used to determine the parameters required for the model.
[0104] This invention uses fuzzy clustering to calculate the sum and variance of all samples under different numbers of clusters, and uses the elbow method to find the inflection point to determine the number of clusters.
[0105] This invention establishes a combined model prediction method, which uses different models for training to address the temporal and nonlinear characteristics of load changes, thereby improving accuracy and preventing overfitting.
[0106] Example:
[0107] This invention proposes a short-term load forecasting method based on the SARIMA-random forest combined model. The test data comes from a field-measured load and weather dataset, obtaining 367 samples from January 1st of one year to January 1st of the following year. Load characteristics are taken from sampling results every 7.5 minutes, totaling 96 time points. Weather factors include maximum temperature, minimum temperature, average temperature, precipitation, and humidity. The forecasting process is as follows: Figure 1 As shown.
[0108] Step 1: Preprocess the load data, checking for missing values in the load and weather samples. If missing values are found, impute them using data from the previous day and normalize the data. In this example, the load data from the previous week is used to predict the next day's load; therefore, a sliding window of length 8 is used to group the load samples. Figure 2 As shown, a total of 360 samples were constructed from the previous week to the next day.
[0109] Import the Python module `seasonal_decompose` and use an additive model to decompose the above samples into trend, seasonal, and residual terms. The period corresponding to the monthly attribute of the load is set to 12. The decomposition result of a certain time series is as follows: Figure 5 As shown.
[0110] Step 2: As Figure 3 As shown, a SARIMA model is established. Unit root tests and white noise tests are then performed on the trend term of the test sequence in sequence.
[0111] With samples T 15 , T 100 , T 200 For example, the unit root test results are shown in Table 2. Due to the sample... T 15 The test result was -4.958, and its absolute value was clearly greater than the critical values under the 1%, 5%, and 10% confidence intervals, therefore the sequence was judged to be stationary. The sample... T 100 and T 200 The test results do not meet the above-mentioned conditions, and p The value is greater than 0.05, therefore it is determined to be a non-stationary sequence, and gradation is required to stabilize it until the condition is met. The number of operations is recorded as follows. d Perform a white noise test on the stationary sequence. If the second set of data in the output is all less than 0.05 or equal to 0, then the sample attribute is non-white noise, and further information can be obtained.
[0112]
[0113] sample T 200 After a second-order 12-step difference operation, the sequence passed the test, and the ACF plot showed a trailing shape, while the PCAF plot showed a second-order truncation. As shown in Table 1... p =0, d =2, q =2, as shown in Table 3, when the parameter is (2,2,0)×(1,0,0), BIC The value is minimized. In summary, the sample... T200 The model parameters are determined to be SARIMA(2,2,0)×(1,0,0). The SARIMA model prediction results for a certain sample are as follows: Figure 6 As shown, the SARIMA model has good trend prediction ability, but it still has a large error because it does not consider the influence of external factors on load data.
[0114]
[0115] Step 3: As Figure 4 The steps shown establish a random forest model. Fuzzy clustering is then performed on the weather samples processed in Step 1 to find similar days. For example... Figure 7 As shown, the number of clusters C It should be set to 9. Group the data to create a weather-residual dataset, and train and predict the residuals using a random forest regression model, incorporating the influence of weather factors into the preliminary results for the test day.
[0116] To test the clustering effect, the residual training results of all samples were compared under the two conditions of non-clustered forest and clustered forest, as shown in Table 4 and Figure 8(a):
[0117]
[0118] As shown in Table 4 and Figure 8(a), the residual learning effect after clustering is more accurate, indicating that different weather types have different effects on the residuals.
[0119] Step 4: Prediction results of combined models. Considering the number of training samples, taking the clustered samples under a certain group as an example, the load prediction effects of different models are shown in Table 5 and Figure 8(b):
[0120]
[0121] As shown in Table 5 and Figure 8(b), the prediction performance of the SARIMA-clustered forest combination model is better than that of the SARIMA model and the SARIMA-non-clustered forest combination model. On the one hand, it leverages the advantage of the SARIMA model in predicting trend changes, and on the other hand, it utilizes the similarity of the clustered data to correct the errors caused by weather factors.
Claims
1. A short-term load forecasting method based on the SARIMA-random forest combined model, characterized in that... Includes the following steps: Step 1: Use a sliding window to group the preprocessed raw load data, create a previous week-next day dataset, and decompose each sample to obtain the trend term. Seasonal items and residuals ; Step 2: Determine parameters and build a SARIMA model, and predict based on known previous week data. The changes the following day yielded preliminary predictions. z and residual r ; Step 3: Cluster weather factors to obtain similar days, group them to construct a weather-residual dataset and build a random forest regression model to learn the relationship between weather factors and residuals. r Relationship; Step 4: Combine the prediction results of the above models and compare the impact of feature clustering and residual training on the accuracy of load prediction; Step 3 includes the following steps: S3.1: Fuzzy clustering is used to divide the weather factors corresponding to the daily historical load to obtain similar days. As shown in Equation (7), the sum and variance corresponding to different numbers of groups are calculated using the elbow method. SSE ,choose SSE The turning point of change is used as the optimal number of clusters. C ; (7); In the formula, y c For the first c Samples in the group; For the first c Cluster centers of groups; N This represents the total number of samples in the group. S3.2: Based on the clustering results, the residuals of the test days in the initial training results in the cluster groups are... r Using weather factors as the target value and weather as the feature, a weather-residual dataset is built by clustering. A random forest regression model is then used for training, with the hyperparameter—the number of trees—determined using a grid search method. n_estimators And the depth of the tree max_depth The trained model is used to predict the target value for the test day, i.e., the training residual. .
2. The short-term load forecasting method based on the SARIMA-random forest combined model according to claim 1, characterized in that: Step 1 includes the following steps: S1.1: Normalized raw load data: (1); In the formula, , These represent the maximum and minimum values of the load characteristics at different times; Grouping and building a previous-next-week dataset using a sliding window; (2); In the formula, m , These represent the number of samples in the original load data and the previous week-next day dataset, respectively. l The length of the sliding window; S1.2: Use Python's time series decomposition module to sequentially obtain the trend terms of each sample in the previous week's - next day dataset. Seasonal items and residuals The mathematical expression for this process is: (3); In the formula, For sequences in the dataset i The corresponding subsequences are obtained by decomposition.
3. The short-term load forecasting method based on the SARIMA-random forest combined model according to claim 1, characterized in that: Step 2 includes the following steps: S2.1: Determine the sequence The stability and randomness of the property Perform unit root test (ADF) and white noise test (LB) respectively; based on the results of the unit root test (ADF)... t Statistics p Stability is determined by values and critical values. t The absolute value of the statistic is greater than the critical value, and p A value less than 0.05 indicates that the sequence is stationary; otherwise, the sequence is stationary using differencing operations, with the degree of differencing denoted as . d Next; based on the output of the white noise test (LB) p The value determines whether the sequence is white noise. p If all values are less than 0.05 or equal to 0, then the sequence is not white noise; S2.2: Observation The characteristics of the autocorrelation coefficient (ACF) plot and partial autocorrelation coefficient (PACF) plot are used to determine the parameters of the SARIMA model, including... p Rank regression model (AR) q Moving average (MA) model and seasonal factors s Its expression is shown in equations (4) and (5): (4); In equation (4), For sequence of t Time-corresponding value ε t For error terms, p The order of autoregression; , , Representing sequences respectively exist t Before the moment p The value corresponding to each time point; , , They represent the preceding p The autoregressive coefficients at each time point; (5); In equation (5), For sequence of t Time-corresponding value q The moving average order; , , Representing sequences respectively exist t Before the moment q Each time point corresponds to an error term; , , They represent the preceding q The moving average coefficient at each time point; S2.3: Table 1 shows the SARIMA model parameters. p and q Judgment method: S2.4: Determine the parameters of the SARIMA model that take into account seasonal effects ( P , Q , D Based on the Bayesian Information Criterion, calculate the values of different parameters. BIC value , The parameter corresponding to the minimum value is used as the final selection, where... P For the order of seasonal autoregression, Q Let the seasonal difference order be , D Let be the order of the seasonal moving average; the calculation formula is shown in equation (6): (6); In equation (6), n and L These represent the number of training samples and the likelihood function, respectively. k The number of model parameters; S2.5: Will Using the data from a week ago as input, the SARIMA model is used to predict... The trend of change the next day, superimposed The results are used as preliminary prediction results. z And obtain the residuals of the preliminary prediction results based on the actual values. r .
4. The short-term load forecasting method based on the SARIMA-random forest combined model according to claim 1, characterized in that: In step 4, z and The load forecast results are obtained by adding them together. , Calculate the mean square error (MSE) MSE Mean absolute error ( MAE ) and coefficient of determination ( R 2 The performance of single models and combined models is evaluated, including SARIMA models, SARIMA-non-clustered forest combined models, and SARIMA-clustered forest combined models. (8); (9); (10); In the formula, J The number of samples in the test set. For the first j The predicted value for each sample, y j For the first j The true load value of each sample; This represents the mean of the sample to be tested.