A medium- and long-term prediction method for peak-to-valley difference based on random forest and secondary correction
Through the method based on random forest and secondary correction, multi-source influencing factors are extracted and Bayesian regression correction is carried out, the accuracy of the prediction of peak-to-trough difference in medium and long-term load in the prior art is solved, the prediction accuracy is improved and the power is enhanced System reliability.
Patent Information
- Application Number
- CN202111210827.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-18
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-10-18
AI Technical Summary
The prior art is difficult to accurately predict the peak-to-valley difference between medium and long-term loads, which affects the implementation evaluation reliability of demand-side responses, and traditional methods have limited prediction accuracy when dealing with periodic and intermittent loads.
The medium- and long-term prediction method for peak-to-valley difference based on random forest and secondary correction is adopted, and the prediction accuracy of load peak-to-valley difference is improved through multi-source influencing factor feature extraction, random forest model training and Bayesian regression correction.
It significantly improves the prediction accuracy of load peak-to-valley difference, provides more reliable power system operation and scheduling guidance, and alleviates the contradiction between power supply and demand.
Smart Images

Figure CN113869600B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of power systems and relates to a medium- and long-term prediction method for peak-to-valley differences based on random forests and secondary correction. Background Art
[0002] Under the background of "carbon peak and carbon neutrality", demand response for flexible, interactive and intelligent electricity consumption has become a development trend. As an important part of demand response users, residential load can effectively achieve "peak shaving and valley filling" and promote reliable and stable operation of the power system. However, the load characteristics of demand-side users are affected by many factors such as meteorological conditions, population growth, and economic development. It is difficult to conduct effective medium- and long-term demand-side assessments, which affects the reliability of medium- and long-term demand-side response implementation evaluation. Therefore, studying how to accurately predict the medium- and long-term load peak-to-valley difference is of great significance to promoting the development of demand-side response and alleviating the contradiction between electricity supply and demand.
[0003] There are very limited studies focusing on the prediction of peak-to-valley difference. From the existing prediction methods, the prediction methods can be divided into deep learning, statistical models, and machine learning models. Among them, the traditional statistical prediction method is easy to implement and does not require additional input. However, in many cases, its accuracy is often limited because it only considers historical data. The deep learning method has good prediction performance and has received widespread attention in recent years. However, due to the periodicity and discontinuity of the monthly peak-to-valley difference and the seasonal peak-to-valley difference, although the deep learning method has better prediction accuracy, it is more suitable for continuous time series prediction. Traditional machine learning methods not only have fast calculation speed, but also have stronger generalization ability. Machine learning methods include support vector machines, random forests, etc.
[0004] Support vector machines can improve the generalization ability of learning machines as much as possible, and the calculation speed is fast. When using genetic algorithms to optimize binary feature combinations, support vector machines can be used to predict peak-to-valley differences, and the fitness function is set to the loss function value between the prediction and the actual value after training with the support vector machine. The random forest model is basically a bagging method that is robust to overfitting. The prediction result is to improve the performance of some weak learners (decision trees) through voting or averaging. It is not easy to overfit, has strong noise resistance, fast calculation speed, and high prediction accuracy. Summary of the invention
[0005] In order to solve the deficiencies in the prior art, the purpose of the present invention is to provide a medium- and long-term prediction method for peak-to-valley difference based on random forest and secondary correction, improve the prediction accuracy based on secondary correction, improve the accuracy of load peak-to-valley difference prediction based on the peak-to-valley difference characteristics on the load side, and provide more reliable guidance for power system operation and scheduling.
[0006] The present invention adopts the following technical solution. The present invention provides a method for long-term measurement of peak-to-valley difference based on random forest and secondary correction, comprising the following steps:
[0007] Step 1, collect historical electricity load data of multiple residential user areas within a set number of years and calculate the historical peak-to-valley difference, collect data on influencing factors affecting the load peak-to-valley difference, and use the influencing factors involved as candidate features;
[0008] Step 2: Extract the features of multi-source influencing factors, use binary feature engineering to extract the optimal feature combination, and use this feature combination as the input of the random forest model in step 3;
[0009] Step 3: Use the random forest algorithm to train the training data of the optimal feature combination selected in step 2 to obtain a demand-side user load peak-valley difference calculation model, and output a medium- and long-term prediction result of the monthly peak-valley difference and the seasonal peak-valley difference;
[0010] Step 4: Based on the historically collected demand-side user load peak-valley difference data, the selected relevant correction factors are selected one by one as input to build a Bayesian regression model to achieve fitting modeling of the user load peak-valley difference, and the medium- and long-term prediction results of the seasonal peak-valley difference are corrected according to the fitting results.
[0011] Preferably, the historical electricity load data in step 1 includes daily maximum load data and daily minimum load data; the historical peak-to-valley difference includes daily peak-to-valley difference, monthly peak-to-valley difference, and seasonal peak-to-valley difference; the influencing factor characteristics include: daily maximum temperature, daily minimum temperature, daily average temperature, air pressure, humidity, rainfall, wind speed, and daily average load.
[0012] Preferably, step 2 specifically includes:
[0013] Step 2.1, calculate the correlation between the candidate features and the peak-to-valley difference in step 1, and select n candidate features from high to low according to the correlation degree;
[0014] In step 2.2, the optimal feature combination is selected based on the binary feature combination method as the input for measurement.
[0015] Preferably, step 2.2 specifically includes:
[0016] Step 2.2.1: Use binary coding to distinguish the usage status of candidate features, i.e., whether they are used or abandoned, and filter out binary feature datasets
[0017] Step 2.2.2: filter out binary feature datasets As the input of the genetic algorithm, the optimal feature combination is found based on the genetic algorithm.
[0018] Preferably, the binary feature dataset It can be expressed as:
[0019]
[0020] Where n is the number of candidate features,
[0021] The i-th feature x i The corresponding binary code is w i , w i There are two states: 0 and 1. When w i = 0, it means that the feature is not used; when w i =1, it means that the feature is used.
[0022] Preferably, step 3 specifically includes:
[0023] Step 3.1, use random forest as the basis for a medium- and long-term measurement;
[0024] Step 3.2: Based on the historical load data of demand-side users, calculate the monthly and quarterly natural growth rate of load according to the time scale of peak-to-valley difference measurement based on the trend extrapolation method;
[0025] Step 3.3, based on the historical average peak-to-valley difference collected monthly and quarterly, the natural growth rate of load, and the screened factors affecting the peak-to-valley difference measurement, form data-driven training samples; build a peak-to-valley difference measurement model based on random forest and train it; the trained model can output the results of medium- and long-term measurement of the peak-to-valley difference of user load on the demand side.
[0026] Preferably, step 3.1 specifically includes:
[0027] Step 3.1.1, assume that the data set of the optimal combination features in the previous N years is the original sample, and use the bootstrap method to sample from the original sample to generate K data sets as the training set of the decision tree, where N is a positive integer and less than the set number of years in step 1;
[0028] Step 3.1.2: If there are originally M input variables, each node randomly selects m specific variables and uses them to determine the best classification point, where m < M;
[0029] Step 3.1.3, each decision tree is grown as much as possible without pruning;
[0030] In step 3.1.4, take the average of all decision trees as the predicted value.
[0031] Preferably, step 4 specifically includes:
[0032] Step 4.1, construct a Bayesian ridge regression model based on the historical peak-to-valley difference of demand-side users’ load and the selected relevant correction factors;
[0033] Step 4.2: Based on the Bayesian Ridge regression model, the fitting relationship between the seasonal peak-to-valley difference and the population correction factor and the residents' consumption level correction factor is established, and the population correction fitting curve and the residents' consumption level fitting curve are obtained.
[0034] Step 4.3, calculate the correction coefficient based on the two fitting curves, and correct the seasonal peak-valley difference in the peak-valley difference calculation result of the demand side user load calculated in step 3 in turn to obtain the peak-valley difference correction result of the demand side user load.
[0035] Preferably, the specific calculation process in the Bayesian Ridge regression model is as follows:
[0036]
[0037]
[0038] in,
[0039] p(w |a, b) is the probability of parameter w distribution under conditional features a and b;
[0040] is the loss function of ridge regression, which is to solve the problem that the i-th output y i With input x ij The parameter family {β j};
[0041] is the penalty loss of L2 regularization.
[0042] Preferably, the correction coefficient D in step 4.3 is * The calculation method is as follows:
[0043]
[0044] In the formula,
[0045] D is the peak-to-valley difference of a quarter in the nth year.
[0046] D* is the corrected peak-to-valley difference of a quarter in the nth year,
[0047] d n-1 is the seasonal peak-to-valley difference value of a quarter in the n-1th year on the fitting curve,
[0048] d n It is the peak-to-valley difference value of a quarter in the nth year on the fitting curve.
[0049] The beneficial effect of the present invention is that compared with the prior art, the present invention aims at the increasingly flexible changes in user load on the demand side, which makes it difficult to accurately evaluate the implementation effect of the demand side response. The reliability of the medium- and long-term demand side response implementation evaluation depends on the accurate prediction of the load peak-to-valley difference. A medium- and long-term peak-to-valley difference measurement model prediction method based on random forest and secondary correction is proposed to improve the prediction accuracy based on the secondary correction. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a flow chart of the peak-to-valley difference prediction method based on random forest and secondary correction of the present invention;
[0051] Figure 2 This is a schematic diagram of the binary feature combination optimization process of the present invention;
[0052] Figure 3 This is a mid- to long-term prediction flow chart based on random forests of the present invention;
[0053] Figure 4 The present invention is a secondary correction flow chart based on Bayesian Ridge regression;
[0054] Figure 5 This is a graph showing the results of a mid- to long-term monthly peak-to-valley difference prediction using the proposed method in an embodiment of the present invention;
[0055] Figure 6 The first mid- to long-term seasonal peak-to-valley difference prediction result and the second correction seasonal peak-to-valley difference prediction effect diagram are shown in the embodiment of the present invention using the proposed method;
[0056] Figure 7 It is a population correction fitting curve in the embodiment of the present invention;
[0057] Figure 8 It is the fitting curve of residents’ consumption level in the present invention. DETAILED DESCRIPTION
[0058] The present application is further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present application.
[0059] In the present invention, the medium- and long-term prediction method refers to a prediction method with a prediction time between one month and one year. The prediction method can be divided into ultra-short-term (0-6h), short-term (6h-1d) and medium- and long-term (1 month-1 year) prediction methods according to different prediction time scales.
[0060] like Figure 1 As shown, the present invention provides a medium- and long-term peak-to-valley difference estimation method based on random forest and secondary correction, comprising the following steps:
[0061] Step 1, collect historical load data of multiple residential users within a set number of years and calculate the historical peak-to-valley difference, and collect data on factors affecting the load peak-to-valley difference as candidate features;
[0062] This embodiment takes the monthly peak-to-valley difference and seasonal peak-to-valley difference of three high-end, medium-end and low-end residential communities in a city in Jiangsu Province as the research object, collects historical data of electricity load for six years from 2013 to 2018, and the data collection time resolution is 15 minutes, 96 data per day, including daily maximum load data and daily minimum load data. The daily peak-to-valley difference is calculated based on the daily maximum load data and daily minimum load data, and the monthly peak-to-valley difference and seasonal peak-to-valley difference are further calculated, and the daily average load data is calculated based on the 96 daily electricity load historical data collected. In addition, the daily maximum temperature, daily minimum temperature, daily average temperature, air pressure, humidity, rainfall, wind speed, daily average load and other influencing factors are considered as alternative features. Population factors and GDP annual influencing factors are used as secondary correction factors.
[0063] The first five years of data are used as training data, and the last year of data is used as test data to verify the effectiveness of data prediction. The prediction error evaluation indicators used are mean absolute percentage error (MAPE), mean absolute error (MAE), and root mean square error (RMSE).
[0064] Step 2: Extract the features of multi-source influencing factors and use binary feature engineering to extract the optimal feature combination as the input of the random forest model;
[0065] Step 2 specifically includes:
[0066] Step 2.1, calculate the correlation between the candidate features and the peak-to-valley difference in step 1, and select n candidate features from high to low according to the correlation degree.
[0067] In order to improve the prediction accuracy, multiple influencing factors are considered to select the characteristic factors that have a significant correlation with the peak-to-valley difference of the resident side load. A preferred but non-limiting implementation is to use the Persons coefficient to quantitatively analyze the correlation between the candidate characteristics and the peak-to-valley difference. The formula of the Persons coefficient is as follows:
[0068]
[0069] in,
[0070] X is the peak-to-valley difference,
[0071] Y is any influencing factor;
[0072] The Persons coefficient is used to quantitatively analyze the correlation between the candidate features and the peak-to-valley difference. Table 1 lists the correlation between the candidate features as binary feature combinations.
[0073] Table 1: Correlation between peak-to-valley difference and various influencing factors
[0074]
[0075]
[0076] In step 2.2, the optimal feature combination is selected based on the binary feature combination method as the input for measurement.
[0077] Since the relevant influencing factors have a joint effect on the peak-to-valley difference, it is impossible to analyze the effect of a single factor on the peak-to-valley difference in isolation. Therefore, the binary feature combination method is used to select the optimal feature combination from the candidate features selected in step 2.1 as the input of the random forest. Step 2.2 specifically includes:
[0078] Step 2.2.1: Use binary coding to distinguish the usage status of candidate features, i.e., whether they are used or abandoned, and filter out binary feature datasets
[0079] Assume that there are n candidate features to be screened, and the feature data set and its corresponding binary code are represented as follows:
[0080] X = [x1, x2, x3, ..., x n ]
[0081] W = [w1, w2, w3, ..., w n ]
[0082] Where n is the number of candidate features,
[0083] The i-th feature x i The corresponding binary code is w i , w i There are two states: 0 and 1. i = 0, it means that the feature is not used; when w i = 1, it means that the feature is used. Therefore, the selected binary feature dataset It can be expressed as:
[0084]
[0085] Step 2.2.2 As the input of the genetic algorithm, the optimal feature combination is found based on the genetic algorithm.
[0086] The schematic diagram of genetic algorithm optimization is as follows Figure 2 As shown in the figure, using genetic algorithm to When performing an optimization search, you need to As the input of the genetic algorithm, the genetic algorithm is randomly initialized to randomly generate multiple groups [w1, w2, w3, ..., w n ] individuals. These individuals constitute the initialized population P(0). Assume that the binary string sequence l is [w1, w2, w3, ..., w n ] in binary encoding form, these binary string sequences l are called chromosomes in genetic algorithms, and [w1, w2, w3, ..., w n ] represents an individual. Then the encoded chromosome is decoded to obtain the weight parameters that need to be optimized in the individual, and the optimization parameters are input into the fitness function. The fitness function used is the loss function value after SVR training, and then it is judged whether the number of iterations is reached. If it is not satisfied, two individuals are selected from the population for replication according to the fitness value, and then the size of the crossover probability in the genetic algorithm is used to determine whether the two individuals selected this time need to be crossover operated. After the crossover operation, a mutation operation is required. The mutation operation needs to be based on the set mutation probability to determine whether the current two temporary individuals need to perform the mutation operation. Usually in genetic algorithms, the size of the mutation probability is calculated using the following formula,
[0087] p m =0.8 / d
[0088] In the formula,
[0089] d represents the number of binary symbols after individual binary encoding.
[0090] For each type of cell, the binary feature combination method is used to optimize the feature combination for peak-valley difference prediction. The following table lists the top 3 feature combinations of three cell data sets. Among them, Top3 refers to the top three feature combination schemes screened out, case1, case2, and case3 represent the feature combination schemes of the top three load peak-valley differences and various influencing factors in this grade of cell. Among them, case1 is the first-ranked feature combination method, that is, top1. In the experiment, the Top1 feature combination is selected as the optimal feature combination input. √ means selecting the feature, and × means deleting the feature. The feature combination schemes of peak-valley differences and various influencing factors are shown in Table 2.
[0091] Table 2: Peak-to-valley difference and characteristic combination scheme of each influencing factor
[0092]
[0093]
[0094] Step 3: Use the random forest algorithm to train the training data of the optimal feature combination selected in step 2 to obtain a demand-side user load peak-valley difference calculation model, and output a medium- and long-term prediction result of the monthly peak-valley difference and the seasonal peak-valley difference. Figure 3 shown.
[0095] Step 3 specifically includes:
[0096] Step 3.1, build a random forest model and use the random forest as the basis for a medium- and long-term measurement.
[0097] The steps to build a measurement model using the random forest algorithm are as follows:
[0098] Step 3.1.1, assume that the data set of the optimal combination features in the previous N years is the original sample, and use the bootstrap method to sample in the original sample to generate K data sets as the training set of the decision tree, N is a positive integer and less than the set number of years in step 1. In this embodiment, the data set of the previous five years is used as the original sample;
[0099] Step 3.1.2: If there are originally M input variables, each node randomly selects m specific variables and uses them to determine the best classification point, where m <M;
[0100] Step 3.1.3, each decision tree is grown as much as possible without pruning;
[0101] In step 3.1.4, take the average of all decision trees as the predicted value.
[0102] Step 3.2, for the historical load data of demand-side users, based on the trend extrapolation method, calculate their monthly and quarterly natural load growth rates according to the time scale of peak-to-valley difference calculation; the natural load growth rate is an influencing factor that characterizes the load change characteristics and serves as one of the inputs of the demand-side user load peak-to-valley difference calculation model.
[0103] Step 3.3, based on the historical average peak-to-valley difference collected monthly and quarterly, the natural growth rate of load, and the factors affecting the peak-to-valley difference calculation that have been screened, form data-driven training samples; build a peak-to-valley difference calculation model based on random forest and train it; the trained model can output the results of the medium- and long-term calculation of the peak-to-valley difference of the user load on the demand side. Finally, the calculation results of the monthly peak-to-valley difference and the quarterly peak-to-valley difference are output.
[0104] The prediction results of this method based on random forest are shown in Table 3. The prediction methods based on support vector machine SVM, multi-layer perceptron MLP, and Gaussian regression process GPR are selected as benchmark prediction methods to verify the effectiveness of the method proposed in this invention in improving the prediction accuracy. From Tables 3 and 4, it can be seen that the prediction accuracy of random forest is better than that of other models. Compared with all the error indicators of other models, the prediction effects of random forest for monthly peak-to-valley difference and seasonal peak-to-valley difference are the best.
[0105] Table 3: Monthly peak-to-valley difference prediction results based on different models
[0106]
[0107] Table 4: Seasonal peak-valley difference prediction results based on different models
[0108]
[0109]
[0110] Step 4: Based on the historically collected demand-side user load peak-valley difference data, the selected relevant correction factors are selected one by one as input to build a Bayesian regression model to achieve fitting modeling of the user load peak-valley difference, and the medium- and long-term prediction results of the seasonal peak-valley difference are corrected according to the fitting results.
[0111] Since the time span of seasonal peak-valley difference is relatively large, considering the impact of the differences in influencing factors between years on seasonal peak-valley difference, a Bayesian ridge regression calculation is constructed to obtain the fitting characteristics of the relevant correction factors and the load peak-valley difference, and to correct the medium- and long-term prediction results of the primary seasonal peak-valley difference. Figure 4 The secondary seasonal peak-to-valley difference correction stage is:
[0112] Step 4.1: Based on the historical peak-to-valley difference of demand-side user load and the selected related correction factors, a Bayesian ridge regression model is constructed. The specific calculation process in the Bayesian ridge regression model is as follows:
[0113]
[0114]
[0115] in,
[0116] p(w|a,b) is the probability of parameter w distribution under conditional features a and b;
[0117] is the loss function of ridge regression, which is to solve the problem that the i-th output y i With input x ij The parameter family {β j};
[0118] is the penalty loss of L2 regularization.
[0119] Step 4.2, based on the Bayesian Ridge regression model, establish the fitting relationship between the seasonal peak-to-valley difference and the population correction factor and the resident consumption level correction factor, and obtain the population correction fitting curve and the resident consumption level fitting curve, such as Figure 6 , 7 shown.
[0120] Step 4.3, based on the two fitting curves, the correction coefficients are calculated in turn and the seasonal peak-valley difference in the peak-valley difference calculation result of the demand-side user load calculated in step 3 is corrected to obtain the peak-valley difference correction result of the demand-side user load;
[0121] Correction coefficient D * The calculation method is as follows:
[0122]
[0123] In the formula,
[0124] D is the peak-to-valley difference of a quarter in the nth year.
[0125] D* is the corrected peak-to-valley difference of a quarter in the nth year,
[0126] d n-1 is the seasonal peak-to-valley difference value of a quarter in the n-1th year on the fitting curve,
[0127] d n It is the peak-to-valley difference value of a quarter in the nth year on the fitting curve.
[0128] Taking the population correction of the peak-to-valley difference in spring 2018 as an example, given the population data of 2017 and 2018, the corresponding peak-to-valley difference values d2017 and d2018 are found on the fitting curve, the correction coefficient is calculated and the peak-to-valley difference in spring 2018 is corrected:
[0129]
[0130] Where D is the peak-to-valley difference in spring 2018.
[0131] D* is the revised peak-to-valley difference in spring 2018,
[0132] d 2017 is the peak-to-valley difference value in spring 2017,
[0133] d 2018 This is the peak-to-valley difference in spring 2018.
[0134] Compare the predicted value of the load at the time to be predicted with the actual value, and calculate the error indicators MAPE, MAE and RMSE. The formulas are as follows:
[0135]
[0136]
[0137]
[0138] in,
[0139] l e is the true value of the load at a certain moment,
[0140] are the predicted values of load at a certain moment,
[0141] n test is the number of test samples;
[0142] In addition, the present invention proposes a medium- and long-term estimation method for peak-to-valley difference based on random forest and secondary correction, as shown in Table 5, which is the prediction result of seasonal peak-to-valley difference after secondary correction.
[0143] The results show that there is a certain deviation between the first prediction value and the true value, but the prediction result after the second correction has a more obvious performance improvement than the first stage. The model has a better prediction effect after the second correction. From the comparison of the evaluation index results, the RMSE index, MAPE index and MAE index of the prediction result after the second correction are all lower than those of the first prediction, and the prediction accuracy is effectively improved. This shows that the peak-to-valley difference two-time prediction model has improved the sensitivity of the model to the differences in influencing factors in different years to a certain extent, thereby further improving the accuracy of the final prediction results.
[0144] Figure 5 This is a mid- to long-term monthly peak-to-valley difference prediction result. Figure 6 The results of the first-time medium- and long-term seasonal peak-to-valley difference prediction and the second-time correction seasonal peak-to-valley difference prediction are shown in Figure 2. The second-time peak-to-valley difference prediction model not only considers the monthly and quarterly peak-to-valley difference influencing factors, but also considers the differences in influencing factors between years. The peak-to-valley difference is predicted through the first-time medium- and long-term prediction and the second-time correction, which greatly improves the prediction accuracy. Finally, the superiority of the method proposed in this study is proved by example analysis.
[0145] Table 5: Comparison of the prediction results of the two seasonal peak-to-valley differences
[0146]
[0147]
[0148] In summary, the prediction method of the present invention can be used to predict the peak-to-valley difference of the demand-side load, and plays an important guiding role in the dispatching of power systems, energy management, and the implementation of demand response. Compared with other prediction methods, the method of the present invention utilizes the differences in influencing factors between years and performs secondary corrections, which significantly improves its prediction accuracy and can more accurately predict the peak-to-valley difference of residential user loads, which is of great significance for promoting the development of demand-side response and alleviating the contradiction between power supply and demand.
[0149] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, but not to limit the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.
Claims
1. A medium- and long-term peak-to-valley difference estimation method based on random forest and secondary correction, characterized in that: The following steps are involved: Step 1, collect historical electricity load data of multiple residential user areas within a set number of years and calculate the historical peak-to-valley difference, collect data on influencing factors affecting the load peak-to-valley difference, and use the influencing factors involved as candidate features; Step 2: Extract the features of multi-source influencing factors, use binary feature engineering to extract the optimal feature combination, and use this feature combination as the input of the random forest model in step 3; The step 2 specifically includes: Step 2.1, calculate the correlation between the candidate features and the peak-to-valley difference in step 1, and select n candidate features from high to low according to the correlation degree; Step 2.2, using the binary feature combination method to select the optimal feature combination as the input for measurement; The step 2.2 specifically includes: Step 2.2.1: Use binary coding to distinguish the usage status of candidate features, i.e., whether they are used or abandoned, and filter out binary feature datasets Step 2.2.2: filter out binary feature datasets As the input of genetic algorithm, the optimal feature combination is found based on genetic algorithm; Step 3: Use the random forest algorithm to train the training data of the optimal feature combination selected in step 2 to obtain a demand-side user load peak-valley difference calculation model, and output a medium- and long-term prediction result of the monthly peak-valley difference and the seasonal peak-valley difference; The step 3 specifically includes: Step 3.1, use random forest as the basis for a medium- and long-term measurement; Step 3.2: Based on the historical load data of demand-side users, calculate the monthly and quarterly natural growth rate of load according to the time scale of peak-to-valley difference measurement based on the trend extrapolation method; Step 3.3: Based on the historical average peak-to-valley difference collected monthly and quarterly, the natural growth rate of load, and the factors affecting the peak-to-valley difference calculation screened out, a data-driven training sample is formed; a peak-to-valley difference calculation model based on random forest is constructed and trained; the trained model can output the results of the medium- and long-term calculation of the peak-to-valley difference of the demand-side user load; Step 4: Based on the historically collected demand-side user load peak-valley difference data, the selected relevant correction factors are selected one by one as input to build a Bayesian regression model to achieve fitting modeling of the user load peak-valley difference, and the medium- and long-term prediction results of the seasonal peak-valley difference are corrected according to the fitting results; Step 4 specifically includes: Step 4.1, construct a Bayesian ridge regression model based on the historical peak-to-valley difference of demand-side users’ load and the selected relevant correction factors; Step 4.2, based on the Bayesian Ridge regression model, establish the fitting relationship between the seasonal peak-to-valley difference and the population correction factor and the residents' consumption level correction factor, and obtain the population correction fitting curve and the residents' consumption level fitting curve; Step 4.3, calculate the correction coefficient based on the two fitting curves, and correct the seasonal peak-valley difference in the peak-valley difference calculation result of the demand side user load calculated in step 3 in turn to obtain the peak-valley difference correction result of the demand side user load.
2. The method for calculating the mid- to long-term peak-to-valley difference based on random forest and secondary correction according to claim 1 is characterized in that: The historical power load data in step 1 includes daily maximum load data and daily minimum load data; the historical peak-to-valley difference includes daily peak-to-valley difference, monthly peak-to-valley difference, and seasonal peak-to-valley difference; The influencing factor characteristics include: daily maximum temperature, daily minimum temperature, daily average temperature, air pressure, humidity, rainfall, wind speed, and daily average load.
3. The method for calculating the mid- to long-term peak-to-valley difference based on random forest and secondary correction according to claim 1, characterized in that: The binary feature dataset It can be expressed as: Where n is the number of candidate features, The i-th feature x i The corresponding binary code is w i , w i There are two states: 0 and 1. When w i = 0, it means that the feature is not used; when w i =1, it means that the feature is used.
4. The method for calculating the mid- to long-term peak-to-valley difference based on random forest and secondary correction according to claim 1, characterized in that: Step 3.1 specifically includes: Step 3.1.1, assume that the data set of the optimal combination features in the previous N years is the original sample, and use the bootstrap method to sample from the original sample to generate K data sets as the training set of the decision tree, where N is a positive integer and less than the set number of years in step 1; Step 3.1.2: If there are originally M input variables, each node randomly selects m specific variables and uses them to determine the best classification point, where m <M; Step 3.1.3, each decision tree is grown as much as possible without pruning; In step 3.1.4, take the average of all decision trees as the predicted value.
5. The method for calculating the mid- to long-term peak-to-valley difference based on random forest and secondary correction according to claim 1, characterized in that: The specific calculation process in the Bayesian Ridge regression model is as follows: in, p(w|a,b) is the probability of parameter w distribution under conditional features a and b; is the loss function of ridge regression, which is to solve the problem that the i-th output y i With input x ij The parameter family {β j }; is the penalty loss of L2 regularization.
6. The method for calculating the mid- to long-term peak-to-valley difference based on random forest and secondary correction according to claim 1, characterized in that: Correction factor D as described in step 4.3 * The calculation method is as follows: In the formula, D is the peak-to-valley difference of a quarter in the nth year. D* is the corrected peak-to-valley difference of a quarter in the nth year, d n-1 is the seasonal peak-to-valley difference value of a quarter in the n-1th year on the fitting curve, d n It is the peak-to-valley difference value of a quarter in the nth year on the fitting curve.
