Household photovoltaic power prediction method and device
By constructing an integrated model of multiple weak learners based on AdaBoost algorithm, the problem of poor prediction effect of existing photovoltaic power prediction methods in the newly installed system and small sample size is solved, and higher prediction accuracy and generalization capabilities are achieved. Promote the promotion of photovoltaic energy in home applications.
Patent Information
- Application Number
- CN202411223904.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2025-02-07
AI Technical Summary
The existing photovoltaic power prediction methods have poor fitting accuracy and weak generalization capabilities in practical applications, especially in newly installed photovoltaic systems and small sample sizes, and the prediction effect is poor.
AdaBoost algorithm is used to build a photovoltaic power prediction model integrated by multiple weak learners. By acquiring photovoltaic historical data and historical weather data, data preprocessing and downsampling are performed, equalized data sets are generated, and models are trained and verified to improve prediction accuracy.
It improves the accuracy and generalization ability of photovoltaic power prediction, expands the scope of application of the model, enhances the stability and utilization of photovoltaic energy, helps families save electricity bills, and promotes the promotion of photovoltaic energy in home application scenarios.
Smart Images

Figure CN119397182A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of photovoltaic power generation technology, and in particular to a method, device, computer equipment and storage medium for predicting household photovoltaic power. Background Art
[0002] In recent years, with the improvement of public environmental awareness, photovoltaic power generation as a renewable energy source has gradually become popular among household users. However, photovoltaic power generation is affected by many factors, such as geographical location, meteorological conditions, equipment status, etc., and there are problems such as instability and strong randomness, which restrict the promotion of photovoltaic power generation in household scenarios. Predicting photovoltaic power generation is a key technology to improve the utilization rate and stability of photovoltaic energy, and is of great significance to the promotion of clean energy and the reduction of carbon emissions.
[0003] Existing photovoltaic power prediction methods based on physical models rely on accurate solar radiation and temperature data, and the prediction process is complex. In practical applications, the fitting accuracy is poor and the generalization ability is weak. Some statistical models such as linear regression and time series models rely on a large amount of historical data for training, and the prediction effect is poor for newly installed photovoltaic systems and situations with a small sample size. Summary of the invention
[0004] In order to solve at least one of the above technical problems, a method, an apparatus, a computer device and a storage medium for predicting household photovoltaic power are provided.
[0005] In a first aspect, an embodiment of the present application provides a household photovoltaic power prediction method, comprising:
[0006] Obtain historical photovoltaic data and historical weather data;
[0007] Performing data preprocessing on the photovoltaic historical data and the historical weather data, associating and matching the photovoltaic historical data and the historical weather data, and generating an associated data set;
[0008] Downsampling the associated data set to generate a balanced data set including a test data set and a plurality of sub-training sets;
[0009] Constructing several groups of AdaBoost model groups, each group of model groups includes several sub-models, using the several sub-training sets to train the several groups of AdaBoost model groups, using the test data sets to perform model verification, and generating a household photovoltaic power prediction model based on AdaBoost;
[0010] The household photovoltaic power prediction model based on AdaBoost is used to predict the photovoltaic power in the future time range.
[0011] In conjunction with the first aspect of the present application, in an optional implementation manner, downsampling the associated data set to generate a balanced data set including a test data set and a plurality of sub-training sets includes:
[0012] Divide the associated data set S into extreme weather data sets S minority and non-extreme weather data set S majority ;
[0013] The extreme weather data set S minority and the non-extreme weather data set S majority Sampling at a first predetermined ratio a divides the associated data set into a training data set S train And the test dataset S test ;
[0014] Statistics of the training data set S train Moderate and Extreme Weather Collection S train_minority , non-extreme weather set S train_majority And the proportion of extreme weather data P minority ;
[0015] Take the training data set S train Moderate and Extreme Weather Collection S train_minority The second predetermined proportion b of the non-extreme weather set S train_majority Sampling and comparing with the training data set S train Moderate and Extreme Weather Collection S train_minority Take the union to obtain a single sub-training set;
[0016] Repeat k times to obtain k training sub-sets {N1, N2, ...N k},
[0017] Size train_single =(b+1)·P minority Size train
[0018] k≤Size train / / Size train_single
[0019] Among them, Size train_single is the sample size of the sub-training set, Size train The training data set S train Sample size, / / is a rounding operation, k is a natural number greater than or equal to 2.
[0020] In conjunction with the first aspect of the present application, in an optional implementation manner, the step of generating a household photovoltaic power prediction model based on AdaBoost includes:
[0021] Constructing several groups of AdaBoost model groups, each group of model groups includes several sub-models, using a hyperparameter tuning algorithm to determine model parameters, and generating several groups of AdaBoost model groups according to different permutations and combinations of the model parameters;
[0022] Performing model regression on the plurality of AdaBoost model groups, and training the plurality of AdaBoost model groups using the plurality of sub-training sets, each AdaBoost model group including k sub-models, where k is a natural number greater than or equal to 2;
[0023] Using the test data set S test The model is verified, the photovoltaic power prediction value is obtained and evaluated, and the optimal AdaBoost model group is selected according to the evaluation results to obtain the household photovoltaic power prediction model based on AdaBoost.
[0024] In conjunction with the first aspect of the present application, in an optional implementation manner, the calculation formula of the photovoltaic power prediction value is as follows:
[0025]
[0026] in, is the photovoltaic power prediction value of the mth model group, i is the test data set S test The i-th sample, X i The test data set S test is the input variable of the i-th sample, j is the j-th submodel in the m-th model group, 1≤j≤k.
[0027] In conjunction with the first aspect of the present application, in an optional implementation manner, performing data preprocessing on the photovoltaic historical data and the historical weather data, associating and matching the photovoltaic historical data and the historical weather data, and generating an associated data set includes:
[0028] Parsing the UTC timestamps in the photovoltaic historical data and the historical weather data, and converting the UTC time into local time;
[0029] Associating and matching the photovoltaic historical data and the historical weather data according to the data collection time and address to obtain an initial associated data set;
[0030] Abnormal data processing and data standardization processing are performed on the initial associated data set to obtain an associated data set.
[0031] In conjunction with the first aspect of the present application, in an optional implementation manner, the extreme weather data set S minority and the non-extreme weather data set S majoritySampling at a first predetermined ratio a divides the associated data set into a training data set S train And the test dataset S test include:
[0032] Determine the extreme weather data set S in the test data set with a predetermined sampling ratio test_minority ;
[0033] From the non-extreme weather data set S majority The extreme weather data set S in the test data set test_minority The first predetermined proportion a is sampled to obtain the non-extreme weather data set S in the test data set test_majority ;
[0034] Size test_majority =a·Size test_minority
[0035] Among them, Size test_majority is the sample size of the non-extreme weather data set in the test data set, S test_minority is the sample size of the extreme weather data set in the test dataset;
[0036] Merge S test_minority With S test_majority Get the test data set S test , merge the remaining samples to get the training data set;
[0037] S test =S test_majority ∪S test_minority ;
[0038] S train =SS test .
[0039] In conjunction with the first aspect of the present application, in an optional implementation manner, the method for predicting photovoltaic power in a future time range using the AdaBoost-based household photovoltaic power prediction model includes:
[0040] Extracting photovoltaic data and weather data within a required prediction time range, wherein the photovoltaic data and the weather data include data collection time and address;
[0041] Associating and matching the photovoltaic data and the weather data according to the data collection time and address, and performing data standardization processing;
[0042] For each prediction time point within the prediction range, a rolling prediction is performed using the photovoltaic power generation power at the previous moment of the prediction time point to obtain a prediction value.
[0043] In a second aspect, an embodiment of the present application provides a household photovoltaic power prediction device, including: an acquisition module for acquiring photovoltaic historical data and historical weather data;
[0044] A data preprocessing module, used to perform data preprocessing on the photovoltaic historical data and the historical weather data, associate and match the photovoltaic historical data and the historical weather data, and generate an associated data set;
[0045] A data set processing module, used for downsampling the associated data set to generate a balanced data set including a test data set and a plurality of sub-training sets;
[0046] A model generation module, used to construct several groups of AdaBoost model groups, each group of model groups includes several sub-models, use the several sub-training sets to train the several groups of AdaBoost model groups, use the test data set to perform model verification, and generate a household photovoltaic power prediction model based on AdaBoost;
[0047] The prediction module is used to predict the photovoltaic power in the future time range by using the household photovoltaic power prediction model based on AdaBoost.
[0048] In a third aspect, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in any one of the above aspects when executing the computer program.
[0049] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the household photovoltaic power prediction method of any of the above aspects are implemented.
[0050] The household photovoltaic power prediction method, device, computer equipment and storage medium of the embodiment of the present application realize distributed and efficient learning of the power generation characteristics of photovoltaic systems with different rated powers by constructing a household photovoltaic power prediction model based on the AdaBoost algorithm, and expand the scope of application of the photovoltaic power prediction model. Compared with the time series prediction method, the use of multiple weak learners integration method achieves better model training performance and performance for time series data with higher frequency. At the same time, for non-balanced data sets, such as situations with a small number of extreme weather samples, multiple distributed and balanced data sets are generated by downsampling methods, which solves the model prediction bias caused by insufficient samples in special scenarios such as extreme weather, improves the accuracy and generalization ability of the prediction, and further expands the scope of application of the model. Thereby improving the stability and utilization rate of photovoltaic energy, helping families save electricity bills, and promoting the promotion of photovoltaic energy in household application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A schematic diagram of an application environment of a household photovoltaic power prediction method provided in an embodiment of the present application;
[0052] Figure 2 A schematic diagram of a household photovoltaic power prediction method provided in an embodiment of the present application;
[0053] Figure 3 A schematic diagram of a household photovoltaic power prediction device provided in one embodiment of the present application;
[0054] Figure 4 A schematic diagram of a computer device provided in accordance with an embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] The household photovoltaic power prediction method provided in this application can be applied to Figure 1 The home energy system shown includes a photovoltaic system 1, an energy management system (EMS) 2 and a server 3 connected in communication. The energy management system 2 is used to collect photovoltaic historical data and historical weather data of the photovoltaic system 1. The server 3 is used to store and calculate the data. The energy management system 2 is also used to schedule the energy of the home energy system according to the calculation results to improve the efficiency of the home energy system.
[0057] like Figure 2 As shown, the household photovoltaic power prediction method provided in the embodiment of the present application includes the following steps:
[0058] S10, obtain photovoltaic historical data and historical weather data. Photovoltaic historical data includes the unique identifier of the photovoltaic data acquisition device, the UTC timestamp of data acquisition, the time zone, the address (zip code) of the photovoltaic system, the maximum power of the photovoltaic system, and the power generation of the photovoltaic system at the time of acquisition. Optionally, the photovoltaic data acquisition device includes an energy management system. The historical weather data includes the historical weather data of the photovoltaic system 1 during the operation of the photovoltaic system 1 in the area where the photovoltaic system 1 is located, including: UTC timestamp, address (zip code), weather type, temperature, relative humidity and wind speed. Optionally, the energy management system 2 collects photovoltaic system data in a fixed frequency manner, for example, collecting data once every hour.
[0059] S20, preprocessing the photovoltaic historical data and the historical weather data, associating and matching the photovoltaic historical data and the historical weather data to generate a related data set. The data preprocessing includes abnormal data removal and data standardization.
[0060] In a possible embodiment, step S20 includes:
[0061] S21, parse the UTC timestamps in the historical photovoltaic data and historical weather data, and convert the UTC time into local time. The local time includes month and hour. By converting the UTC time into local time, the correlation and matching of photovoltaic data and weather data is facilitated.
[0062] S22, according to the data collection time and address, the photovoltaic historical data and the historical weather data are associated and matched to obtain an initial associated data set. For example, each set of data with the same data collection time and collection address is spliced into one, and multiple sets of data constitute the initial associated data set.
[0063] S23, performing abnormal data processing and data standardization processing on the initial associated data set to obtain an associated data set. Abnormal data processing includes filtering abnormal data and removing reverse order points. Optionally, the method of filtering abnormal data includes using a triple standard deviation method, a Z-score method, a LOF algorithm, or a quartile method.
[0064] Data standardization includes scaling the maximum power of the photovoltaic system and the power of the photovoltaic system at the time of acquisition to a predetermined range, such as [-1, 1], so that the historical data of photovoltaic systems of different specifications can be used for model training, thereby improving the generalization ability of the model. Optionally, the following formula is used for data standardization:
[0065]
[0066] Among them, x is the data to be standardized, x min is the minimum power of the photovoltaic system, x max Maximum power of the photovoltaic system, x sc The data is processed after standardization.
[0067] Through data preprocessing, on the one hand, more effective information can be extracted from timestamps and historical data, and on the other hand, some abnormal data can be removed to avoid adverse effects on model prediction results.
[0068] S30, downsampling the associated data set to generate a balanced data set including a test data set and several sub-training sets. For extreme weather types, due to the small sample size, insufficient samples for model training will lead to problems such as model overfitting and low prediction accuracy. Therefore, before constructing the data set, the sample size ratio of extreme weather (such as strong winds, heavy rains, blizzards, typhoons, etc.) is counted first, and several training sample sets are divided by downsampling for training the AdaBoost model group to avoid model prediction bias caused by sample imbalance.
[0069] S40, construct several groups of AdaBoost model groups, each group of model groups includes several sub-models, use several sub-training sets to train several groups of AdaBoost model groups, use the test data set to perform model verification, and generate a household photovoltaic power prediction model based on AdaBoost. Use a hyperparameter tuning algorithm to determine the model parameters, and generate several groups of AdaBoost model groups according to different permutations and combinations of model parameters. Each model parameter combination corresponds to a group of model groups, that is, m types of model parameter combinations have m groups of model groups. Perform model regression on several groups of AdaBoost model groups, use the above several sub-training sets to train each sub-model in each group of model groups one by one, and obtain several groups of model groups, each group of model groups includes k sub-models, and k is a natural number greater than or equal to 2. Use the test data set to perform model verification, including model prediction and prediction result evaluation, obtain photovoltaic power prediction values and evaluate them, determine the optimal model according to the evaluation results, and obtain a household photovoltaic power prediction model based on AdaBoost.
[0070] S50, using the AdaBoost-based household photovoltaic power prediction model to predict the photovoltaic power in the future time range. Extract the photovoltaic data and weather data of the previous moment of the future time point to be predicted, associate the two, and perform data standardization. Input the standardized data into the model, perform rolling prediction within the required prediction range, and obtain the photovoltaic power prediction value.
[0071] In the embodiment of the present application, by constructing a household photovoltaic power prediction model based on the AdaBoost algorithm, distributed and efficient learning of the power generation characteristics of photovoltaic systems with different rated powers is achieved, and the scope of application of the photovoltaic power prediction model is expanded. Compared with the time series prediction method, the use of multiple weak learners integration method achieves better model training performance and performance for time series data with higher frequency. At the same time, for non-balanced data sets, such as situations with a small number of extreme weather samples, multiple distributed and balanced data sets are generated by downsampling methods, which solves the model prediction bias caused by insufficient samples in special scenarios such as extreme weather, improves the accuracy and generalization ability of the prediction, and further expands the scope of application of the model. Thereby improving the stability and utilization rate of photovoltaic energy, helping families save electricity bills, and promoting the promotion of photovoltaic energy in household application scenarios.
[0072] In a possible embodiment, step S30 includes:
[0073] S31, divide the associated data set S into extreme weather data sets S minority and non-extreme weather data set S majority .
[0074] S32, for extreme weather data set S minority and non-extreme weather data set Smajority Sampling at a first predetermined ratio a divides the associated data set into a training data set S train And the test dataset S test First, the extreme weather data set S in the test data set is determined with a predetermined sampling ratio. test_minority Optionally, the predetermined sampling ratio is 10% to 20%. minority Extract 10% to 20% of the extreme weather data set S in the test data set test_minority .
[0075] Secondly, from the non-extreme weather data set S majority The extreme weather data set S in the test data set test_minority The first predetermined proportion a is sampled to obtain the non-extreme weather data set S in the test data set test_majority Optionally, the first predetermined ratio a is 1:4 to 1:9.
[0076] Size test_majority =a·Size test_minority
[0077] Among them, Size test_majority is the sample size of the non-extreme weather data set in the test data set, S test_minority is the sample size of the extreme weather data set in the test dataset.
[0078] Merge S test_minority With S test_majority Get the test data set S test . S test =S test_majority ∪S test_minority .
[0079] Merge the remaining samples, that is, the samples that were not selected in the above steps, to obtain the training data set S train . S train =SS test .
[0080] Optional sampling methods include simple random sampling, stratified sampling, cluster sampling, systematic sampling and multi-stage sampling.
[0081] S33, statistical training data set S train Moderate and Extreme Weather Collection S train_minority , non-extreme weather set S train_majority And the proportion of extreme weather data P minority .
[0082] S34, with training data set S train Moderate and Extreme Weather Collection S train_minorityThe second predetermined ratio b of the non-extreme weather set S train_majority Sampling and training data set S train Moderate and Extreme Weather Collection S train_minority Take the union to obtain a single sub-training set; repeat k times to obtain k sub-training sets {N1, N2, ...N k}, that is, each sub-training set includes the extreme weather set S train_minority ,
[0083] Size train_single =(b+1)·P minority Size train
[0084] k≤Size train / / Size train_single
[0085] Among them, Size train_single is the sample size of the sub-training set, Size train The training data set S train Sample size, / / is a rounding operation, k is a natural number greater than or equal to 2.
[0086] In this embodiment, since the number of extreme weather samples is small, the non-extreme weather set S is train_majority Sampling k times, and respectively comparing the data sets obtained from k samplings with the training data set S train Moderate and Extreme Weather Collection S train_minority The union is taken to generate a balanced data set including several sub-training sets for training the AdaBoost model group. In this way, the balanced processing of non-balanced data is achieved through downsampling, which improves the accuracy and generalization ability of the AdaBoost photovoltaic power prediction model.
[0087] In a possible embodiment, step S40 includes:
[0088] S41, construct several groups of AdaBoost model groups, each group of model groups includes several sub-models, use hyperparameter tuning algorithm to determine model parameters, and generate several groups of AdaBoost model groups according to different permutations and combinations of the model parameters. The hyperparameter tuning algorithm includes GridSearchCV. Verify the model parameters in the test data set and select the model group with the optimal parameters. Generate a parameter grid param_grid, including the maximum split depth max_depth of each tree, the number of estimators n_estimators and the learning rate learning_rate. The number of estimators is the number of weak learners in the model. The learning rate determines the adjustment amplitude of the model weight at each iteration or update.
[0089] An example parameter grid is as follows:
[0090] param_grid = {
[0091] 'max_depth':[3,5,7],
[0092] 'n_estimators':[10,50,100,500],
[0093] 'learning_rate':[0.0001,0.001,0.01,0.1,1.0]}.
[0094] All parameters in the parameter grid are arranged and combined to obtain m parameter combinations, corresponding to m groups of AdaBoost models. m is a natural number greater than 1.
[0095] Optionally, the hyperparameter tuning algorithm also includes random search, Bayesian optimization, genetic algorithm, or gradient-based optimization.
[0096] S42, performing model regression on a plurality of AdaBoost model groups, using a plurality of sub-training sets to train a plurality of AdaBoost model groups, and obtaining m groups of AdaBoost model groups. For each group of AdaBoost model groups, in each training set {N1, N2, ...N k}, train each sub-model one by one, and obtain the sub-model h i The model group H = {h1, h2, ... h k}. Finally, m groups of AdaBoost models are obtained.
[0097] S43, using the test data set S test Model verification is performed, including model prediction and prediction result evaluation, photovoltaic power prediction values are obtained and prediction results are evaluated, and the optimal AdaBoost model group is selected according to the evaluation results to obtain a household photovoltaic power prediction model based on AdaBoost. The calculation formula for photovoltaic power prediction value is as follows:
[0098]
[0099] in, is the photovoltaic power prediction value of the mth model group, i is the test data set S test The i-th sample, X i The test data set S test is the input variable of the i-th sample, j is the j-th submodel in the m-th model group, 1≤j≤k.
[0100] The evaluation algorithm uses the mean absolute error MAE, the formula is as follows:
[0101]
[0102] Among them, MAE (m) The model group h is the mth group m The average absolute error of the photovoltaic power prediction value, Size test is the sample size of the test data set, i is the test data set S test The i-th sample in .
[0103] From the m prediction results, the one with the smallest MAE is selected as the optimal prediction result, and the corresponding model is the optimal model.
[0104] S44, output the household photovoltaic power prediction model file based on AdaBoost, save the model group parameters, and output the model file to facilitate subsequent model deployment and prediction.
[0105] In this embodiment, by adopting the method of multiple weak learner integration, for time series data with high frequency, better model training performance and performance are achieved compared with the time series prediction method. GridSearchCV is used to traverse all model parameter combinations, which improves the efficiency and accuracy of model training.
[0106] In a possible embodiment, step S50 includes:
[0107] S51, extract the photovoltaic data and weather data of the required prediction time range, the photovoltaic data and weather data include the data collection time and address. Photovoltaic data include: unique identification of photovoltaic data collection equipment, UTC timestamp, address (zip code), photovoltaic system power generation at the time of collection. If there is no real power, extract the power forecast value of the previous moment. Weather data include: UTC timestamp, address (zip code), weather type, temperature, relative humidity, wind speed. Parse the timestamp, convert the UTC time into local time according to the time zone, and extract the month (month) and hour (hour).
[0108] S52, associate the photovoltaic data and weather data according to the time and address, and perform data standardization processing. Associate and match the weather data and photovoltaic data of the same time and postal code. For specific steps, please refer to step S23.
[0109] S53, for each prediction time point within the prediction range, the photovoltaic power generation power at the previous moment of the prediction time point is used for rolling prediction to obtain a prediction value. For a specified prediction time range, each time point that needs to be predicted is predicted in sequence, and each prediction is based on the predicted value of the photovoltaic system power generation power at the previous time point. The data processed in S51-S2 is input into the optimal model group obtained by training for rolling prediction to obtain a prediction value.
[0110] Optionally, after step S53, step S54 is further included: performing dimensional transformation on the predicted value as the final prediction result. The transformation formula is as follows:
[0111] x=x sc × max +x min
[0112] Among them, x min is the minimum power of the photovoltaic system, x max is the maximum power of the photovoltaic system. Optional, x min is 0.
[0113] In steps S40 and S50 , the model input variables include: UTC timestamp (including month and hour), address (zip code), weather type, temperature, relative humidity, wind speed and / or standardized data of photovoltaic system power generation.
[0114] In the embodiment of the present application, Figure 3 As shown, a household photovoltaic power prediction device is provided, comprising: an acquisition module 10, for acquiring photovoltaic historical data and historical weather data;
[0115] A data preprocessing module 20 is used to perform data preprocessing on the photovoltaic historical data and the historical weather data, associate and match the photovoltaic historical data and the historical weather data, and generate an associated data set;
[0116] A data set processing module 30, configured to downsample the associated data set to generate a balanced data set including a test data set and a plurality of sub-training sets;
[0117] A model generation module 40 is used to construct a plurality of AdaBoost model groups, each of which includes a plurality of sub-models, train the plurality of AdaBoost model groups using the plurality of sub-training sets, perform model verification using the test data set, and generate a household photovoltaic power prediction model based on AdaBoost;
[0118] The prediction module 50 is used to predict the photovoltaic power in the future time range by using the household photovoltaic power prediction model based on AdaBoost.
[0119] Optionally, the data set processing module 20 further includes:
[0120] The first data set partitioning module is used to partition the associated data set S into an extreme weather data set S minority and non-extreme weather data set S majority ; For the extreme weather data set S minority and non-extreme weather data set S majoritySampling at a first predetermined ratio a divides the associated data set into a training data set S train And the test dataset S test ;
[0121] The second data set partitioning module is used to count the training data set S train Moderate and Extreme Weather Collection S train_minority , non-extreme weather set S train_majority And the proportion of extreme weather data P minority ; Take the training data set S train Moderate and Extreme Weather Collection S train_minority The second predetermined ratio b of the non-extreme weather set S train_majority Sampling and training data set S train Moderate and Extreme Weather Collection S train_minority Take the union to obtain a single sub-training set; repeat k times to obtain k sub-training sets {N1, N2, ...N k},
[0122] Size train_single =(b+1)·P minority Size train
[0123] k≤Size train / / Size train_single
[0124] Among them, Size train_single is the sample size of the sub-training set, Size train The training data set S train Sample size, / / is a rounding operation, k is a natural number greater than or equal to 2.
[0125] Optionally, the model generation module 40 further includes:
[0126] A model building module is used to build several groups of AdaBoost model groups, each of which includes several sub-models;
[0127] The parameter selection module is used to determine the model parameters using the hyperparameter tuning algorithm and to arrange and combine different model parameters. Each different arrangement and combination of model parameters corresponds to a group of AdaBoost model groups;
[0128] The training module is used for performing model regression on several groups of AdaBoost model groups, and several sub-training sets are used to train several groups of AdaBoost model groups to obtain m groups of AdaBoost model groups; m is the model group serial number.
[0129] The validation module uses the test data set S testThe model is verified, including model prediction and prediction result evaluation, and the photovoltaic power prediction value is obtained and evaluated. The optimal AdaBoost model group is selected according to the evaluation results to obtain the household photovoltaic power prediction model based on AdaBoost.
[0130] Optionally, the data preprocessing module 20 includes:
[0131] The data association module is used to parse the UTC timestamps in the photovoltaic historical data and historical weather data and convert the UTC time into local time; associate and match the photovoltaic historical data and historical weather data according to the data collection time and address to obtain the initial associated data set;
[0132] The standardization processing module is used to perform abnormal data processing and data standardization processing on the initial associated data set to obtain the associated data set.
[0133] Optionally, the data set processing module 30 further includes:
[0134] The third data set division module is used to determine the extreme weather data set S in the test data set with a predetermined sampling ratio. test_minority ; From the non-extreme weather data set S majority The extreme weather data set S in the test data set test_minority The first predetermined proportion a is sampled to obtain the non-extreme weather data set S in the test data set test_majority ;
[0135] Size test_majority =a·Size test_minority
[0136] Among them, Size test_majority is the sample size of the non-extreme weather data set in the test data set, S test_minority is the sample size of the extreme weather data set in the test dataset;
[0137] Merge S test_minority With S test_majority Get the test data set S test , merge the remaining samples to get the training data set; S test =S test_majority ∪S test_minority ; S train =SS test .
[0138] Optionally, the prediction module 50 includes:
[0139] A data processing unit is used to extract photovoltaic data and weather data within a required prediction time range, where the photovoltaic data and weather data include data collection time and address; the photovoltaic data and weather data are associated according to the data collection time and address, and data standardization is performed;
[0140] The prediction unit performs rolling prediction on each prediction time point within the prediction range by using the photovoltaic power generation power at the previous moment of the prediction time point to obtain a prediction value.
[0141] Regarding the various modules and units in the household photovoltaic power prediction device, please refer to the above definition of the household photovoltaic power prediction method, which will not be repeated here. The various modules in the above-mentioned household photovoltaic power prediction device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0142] The present application also provides a computer device, such as Figure 4 As shown, it includes a processor 5 and a memory 4 which are in communication connection. The two are in communication connection. The memory 4 stores a computer program, which, when executed by the processor 5, implements the steps of the household photovoltaic power prediction method in any of the above embodiments.
[0143] The embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the household photovoltaic power prediction method in the above embodiment are implemented.
[0144] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0145] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for predicting household photovoltaic power, comprising: Obtain historical photovoltaic data and historical weather data; Performing data preprocessing on the photovoltaic historical data and the historical weather data, associating and matching the photovoltaic historical data and the historical weather data, and generating an associated data set; Downsampling the associated data set to generate a balanced data set including a test data set and a plurality of sub-training sets; Constructing several groups of AdaBoost model groups, each group of model groups includes several sub-models, using the several sub-training sets to train the several groups of AdaBoost model groups, using the test data sets to perform model verification, and generating a household photovoltaic power prediction model based on AdaBoost; The household photovoltaic power prediction model based on AdaBoost is used to predict the photovoltaic power in the future time range.
2. The household photovoltaic power prediction method according to claim 1, wherein downsampling the associated data set to generate a balanced data set including a test data set and a plurality of sub-training sets comprises: Divide the associated data set S into extreme weather data sets S minority and non-extreme weather data set S majority ; The extreme weather data set S minority and the non-extreme weather data set S majority Sampling at a first predetermined ratio a divides the associated data set into a training data set S train And the test dataset S test ; Statistics of the training data set S train Moderate and Extreme Weather Collection S train_minority , non-extreme weather set S train_majority And the proportion of extreme weather data P minority ; Take the training data set S train Moderate and Extreme Weather Collection S train_minority The second predetermined proportion b of the non-extreme weather set S train_majority Sampling and comparing with the training data set S train Moderate and Extreme Weather Collection S train_minority Take the union to obtain a single sub-training set; Repeat k times to obtain k training sub-sets {N1, N2, ...N k }, Size train_single =(b+1)·P minority ·Size train k≤Size train / / Size train_single Among them, Size train_single is the sample size of the sub-training set, Size train The training data set S train Sample size, / / is a rounding operation, k is a natural number greater than or equal to 2.
3. The household photovoltaic power prediction method according to claim 2, characterized in that: The steps of generating a household photovoltaic power prediction model based on AdaBoost include: Constructing several groups of AdaBoost model groups, each group of model groups includes several sub-models, using a hyperparameter tuning algorithm to determine model parameters, and generating several groups of AdaBoost model groups according to different permutations and combinations of the model parameters; Performing model regression on the plurality of AdaBoost model groups, and training the plurality of AdaBoost model groups using the plurality of sub-training sets; Using the test data set S test The model is verified, including model prediction and prediction result evaluation. The optimal AdaBoost model group is selected according to the evaluation results to obtain the household photovoltaic power prediction model based on AdaBoost.
4. The household photovoltaic power prediction method according to claim 3, characterized in that: The calculation formula of the photovoltaic power prediction value is as follows: in, is the photovoltaic power prediction value of the mth model group, i is the test data set S test The i-th sample, X i The test data set S test is the input variable of the i-th sample, j is the j-th submodel in the m-th model group, 1≤j≤k.
5. The household photovoltaic power prediction method according to claim 2, characterized in that: The extreme weather data set S minority and the non-extreme weather data set S majority Sampling at a first predetermined ratio a divides the associated data set into a training data set S train And the test dataset S test include: Determine the extreme weather data set S in the test data set with a predetermined sampling ratio test_minority ; From the non-extreme weather data set S majority The extreme weather data set S in the test data set test_minority The first predetermined proportion a is sampled to obtain the non-extreme weather data set S in the test data set test_majority ; Size test_majority =a·Size test_minority Among them, Size test_majority is the sample size of the non-extreme weather data set in the test data set, S test_minority is the sample size of the extreme weather data set in the test dataset; Merge S test_minority With S test_majority Get the test data set S test , merge the remaining samples to get the training data set; S test =S test_majority ∪S test_minority ; S train =S-S test 。 6. The household photovoltaic power prediction method according to any one of claims 1 to 5, characterized in that: The performing data preprocessing on the photovoltaic historical data and the historical weather data, associating and matching the photovoltaic historical data and the historical weather data, and generating an associated data set comprises: Parsing the UTC timestamps in the photovoltaic historical data and the historical weather data, and converting the UTC time into local time; Associating and matching the photovoltaic historical data and the historical weather data according to the data collection time and address to obtain an initial associated data set; Abnormal data processing and data standardization processing are performed on the initial associated data set to obtain an associated data set.
7. The household photovoltaic power prediction method according to any one of claims 1 to 5, characterized in that: The method for predicting photovoltaic power in a future time range by using the household photovoltaic power prediction model based on AdaBoost includes: Extracting photovoltaic data and weather data within a required prediction time range, wherein the photovoltaic data and the weather data include data collection time and address; Associating and matching the photovoltaic data and the weather data according to the data collection time and address, and performing data standardization processing; For each prediction time point within the prediction range, a rolling prediction is performed using the photovoltaic power generation power at the previous moment of the prediction time point to obtain a prediction value.
8. A household photovoltaic power prediction device, characterized in that: include: Acquisition module, used to obtain photovoltaic historical data and historical weather data; A data preprocessing module, used to perform data preprocessing on the photovoltaic historical data and the historical weather data, associate and match the photovoltaic historical data and the historical weather data, and generate an associated data set; A data set processing module, used for downsampling the associated data set to generate a balanced data set including a test data set and a plurality of sub-training sets; A model generation module, used to construct several groups of AdaBoost model groups, each group of model groups includes several sub-models, use the several sub-training sets to train the several groups of AdaBoost model groups, use the test data set to perform model verification, and generate a household photovoltaic power prediction model based on AdaBoost; The prediction module is used to predict the photovoltaic power in the future time range by using the household photovoltaic power prediction model based on AdaBoost.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.