Photovoltaic power generation power prediction method based on decision tree and improved attention
Through decision trees and photovoltaic power prediction methods that improve attention, combined with a variety of data cleaning and prediction technologies, the problem of abnormal data and missing value processing in photovoltaic power prediction is solved, and the prediction accuracy and adaptability are improved.
Patent Information
- Application Number
- CN202411417401.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2024-12-20
AI Technical Summary
The existing photovoltaic power prediction methods are not targeted when processing abnormal data, resulting in inaccurate prediction and insufficient missing value processing methods, affecting the prediction accuracy.
Using a photovoltaic power generation prediction method based on decision trees and improved attention, abnormal data is identified through isolated forests, combined with left and right proximity interpolation, ARIMA and MiceForest for missing values repair, and using fuzzy C-mean clustering method and BiLSTM-improved attention Force mechanism for data cleaning and prediction.
The data quality and accuracy of photovoltaic power prediction are effectively improved, especially under different weather conditions, and the adaptability and accuracy of the prediction model are improved.
Smart Images

Figure CN119168158A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of photovoltaic power generation, and in particular relates to a photovoltaic power generation power prediction method based on a decision tree and improved attention. Background Art
[0002] As photovoltaic power generation has the advantages of being clean, pollution-free and sustainable, its installed capacity is increasing. However, the photovoltaic power generation process is affected by weather and geographical environment, and the volatility, randomness and reverse load characteristics of power generation also bring huge challenges to the safety, stability and power quality of the power grid. Therefore, accurate prediction of photovoltaic power generation output power is crucial to optimize the grid-connected operation of photovoltaic power generation and reduce the impact of uncertainty.
[0003] Photovoltaic power data has obvious time series. Generally, the prediction of long-term development trends is achieved by capturing the laws between historical data, which makes the prediction model have high requirements on the quality of historical data. However, in the actual collected data of photovoltaic power generation, there are a large number of missing values and outliers. Therefore, identifying and repairing missing values or outliers can effectively improve the prediction accuracy of photovoltaic power algorithm. At present, machine learning methods such as random forests are usually used to clean the prediction data. For example, one existing technology proposes a wind power data cleaning method combining an isolation forest algorithm and a standard deviation algorithm based on the characteristics of wind power output. Another existing technology combines the central force optimization (CFO) algorithm and the X-means algorithm to propose an improved isolation forest data cleaning algorithm. It can be seen that it is feasible to combine the advantages of multiple algorithms for abnormal data cleaning. However, the abnormal data of photovoltaic power generation is closely related to weather conditions and operating conditions. The types of abnormal data show different distribution characteristics. Existing research still lacks targeted cleaning methods for different types of abnormal data of photovoltaic power generation.
[0004] Photovoltaic power prediction methods can be divided into physical methods, statistical methods and artificial intelligence algorithms. The physical method requires the establishment of a detailed physical model of the photovoltaic power station, which is mostly used for incomplete historical data or newly built power stations. Statistical and artificial intelligence algorithms require a large amount of historical data, and realize the prediction of power generation by mining the inherent laws of photovoltaic historical power, weather and other data. The statistical methods mainly include regression prediction method, Markov chain method, gray prediction method, etc. Compared with statistical methods, artificial intelligence algorithms have the advantages of faster and more flexible large-scale feature mining, and have been widely used in data prediction modeling in recent years. The combination model of deep learning is a common method in hybrid prediction, but how to strengthen the hybrid prediction network to strengthen data features and improve the training network's ability to extract features is still the key to improving the accuracy of the prediction model. Summary of the invention
[0005] In view of the above-mentioned deficiencies in the prior art, the photovoltaic power generation power prediction method based on decision tree and improved attention provided by the present invention solves the problem of inaccurate prediction of photovoltaic power generation output power in the prior art.
[0006] In order to achieve the above-mentioned invention object, the technical solution adopted by the present invention is: a photovoltaic power generation power prediction method based on a decision tree and improved attention, comprising the following steps:
[0007] S1. Establish an isolation forest based on sample data, and use an isolation forest-based photovoltaic power generation abnormal data identification method to identify abnormal data of photovoltaic power generation in the isolation forest;
[0008] S2, repair the abnormal data of photovoltaic power generation in the isolated forest and establish a training set for the decision tree model;
[0009] S3, classify the sample data of the training set by fuzzy C-means clustering method, and establish training subsets of sunny days, cloudy days, and rainy and snowy days;
[0010] S4. The training subsets of sunny days, cloudy days, and rainy and snowy days are input into the convolutional neural network, BiLSTM model, and improved attention mechanism layer in turn to obtain the photovoltaic power generation power prediction results under sunny, cloudy, and rainy and snowy conditions.
[0011] Further: S1 comprises the following sub-steps:
[0012] S11, randomly selecting a preset number of sample data from the sample space to form a subspace, and using it as the root node of the tree;
[0013] S12, randomly select a feature from the sample data of the subspace, and randomly select a data in the feature as standard data;
[0014] S13, split the subspace according to the standard data, put the sample data larger than the standard data to the right of the current root node, and move the remaining sample data to the left of the current root node, forming two new subspaces;
[0015] S14, repeat S12 to S13 until there is only one data on the leaf node, or the tree has reached the set height, and the construction of an isolated tree is completed;
[0016] S15, looping to construct isolated trees to form an isolated forest, calculating the path length from the sample data to the leaf nodes of each tree according to the isolated forest, and taking the data of the leaf nodes whose path length is lower than the path threshold as abnormal data of the photovoltaic power generation power.
[0017] Further: S2 comprises the following sub-steps:
[0018] S21, clearing the abnormal data of photovoltaic power generation in the isolated forest and treating it as missing values to obtain a data set of missing values to be filled;
[0019] S22, using the left and right neighbor interpolation method to fill in the missing values in the data set to be filled with missing values, to obtain a first repair value;
[0020] S23, respectively using the ADF, ACF and PACF graphs to determine the parameters in the differential integrated moving average autoregressive model, repairing the missing values in the data set to be filled with missing values, and obtaining a second repaired value;
[0021] S24, repairing the missing values in the data set to be filled with missing values by using MiceForest to obtain a third repaired value;
[0022] S25. Use the matrix to concatenate the first to third repair values, and use the concatenated result to repair the data set with missing values to establish a training set for the decision tree model.
[0023] Further: In S22, the expression for filling and repairing the missing values by the left and right adjacent interpolation method is specifically the following formula:
[0024]
[0025] Where X(t) is the missing data point at time t, X (t-1) and X (t+1) are a data point forward and backward of X(t) respectively.
[0026] Further: In S23, the method of repairing the missing values in the data set to be filled with missing values using the differential integrated moving average autoregressive model is specifically:
[0027] The data set to be filled with missing values is input into the differential integrated moving average autoregressive model, and the data of the data set to be filled with missing values is differentiated several times to generate a second repair value to fill the missing values, and a stationary time series is obtained; wherein, after the data in the data set to be filled with missing values is differentiated d times, the second repair value is generated to fill the missing values The specific expression is:
[0028]
[0029] In the formula, μ is a constant, p is an autoregressive lag term, and q is a moving average lag term. After performing d differences on the data in the data set to fill the missing values, the data point at time t-1 in the stationary time series is obtained. is the data point at time tp in the stationary time series obtained after d times difference of the data in the data set to be filled with missing values, φ1 is the first autoregressive coefficient, φ p is the pth autoregressive coefficient, θ1 is the first moving average coefficient, θ q is the qth moving average coefficient, ε t-1 is the zero-mean white noise at time t-1, ε t-q is a zero-mean white noise with time tq, ε t is a zero-mean white noise at time t.
[0030] Further: S24 includes the following sub-steps:
[0031] S241, dividing the data in the data set to be filled with missing values into a data set with missing values and a data set without missing values by using MiceForest;
[0032] S242, training the random forest model using a data set without missing values to generate a predicted repair result;
[0033] S243, updating the random forest model according to the prediction and repair results until a convergence condition is reached, and constructing several data sets for repairing missing values according to the final prediction and repair results;
[0034] S244. Use Rubin's rule to combine all data sets to obtain a third repair value.
[0035] Further: In S3, the expression of the objective function J for classifying the sample data of the training set by the fuzzy C-means clustering method is specifically:
[0036]
[0037] In the formula, x i is the i-th sample data, n is the total number of sample data, U ij is the membership degree of the i-th sample data to the j-th category, m is the fuzzy weighted number, c j is the center of the jth class.
[0038] Further: S4 includes the following sub-steps:
[0039] S41, inputting the training subset of any working condition of sunny day, cloudy day and rainy and snowy day into the convolutional neural network, extracting the local features of the power data through convolution operation and pooling operation, and obtaining time series data, which includes data at several time points;
[0040] S42, input the time series data into the BiLSTM model to obtain the output of the BiLSTM model corresponding to each input value;
[0041] S43, inputting the output of the BiLSTM model into the improved attention mechanism layer, assigning an attention probability to the output of each BiLSTM model through the attention mechanism, and fusing the output of the BiLSTM model according to the attention probability to obtain the initial feature;
[0042] S44. Input the time series data into the improved attention mechanism layer, fuse the time series data with the preference features, and obtain the photovoltaic power generation power prediction results under the corresponding working conditions.
[0043] Further: In S43, the expression for obtaining the initial feature is specifically:
[0044] E=y1·α1+…+y k α k
[0045] Where y1 is the output of the first BiLSTM model, y k is the output of the kth BiLSTM model, α1 is the attention probability assigned to the output of the first BiLSTM model, and α k The attention probability assigned to the output of the k-th BiLSTM model.
[0046] The beneficial effects of the present invention are as follows: the present invention provides a photovoltaic power generation prediction method based on decision tree and improved attention, and the effectiveness of the method is verified by a large amount of measured data, as follows:
[0047] 1) A hybrid repair method based on decision tree is proposed. Combining the advantages of different repair methods such as left and right neighbor interpolation, ARIMA and MiceForest, the repair matrix and decision tree algorithm are used for repair, which can effectively improve the repair results of anomalies and missing values, thereby improving the quality of the data set used for photovoltaic power generation prediction.
[0048] 2) A photovoltaic power prediction model based on BILSTM-improved attention is proposed. The improved attention mechanism combines the feature information of the original data with the data after redistribution of weights, thereby enhancing the ability to extract data feature information and thus improving the accuracy of prediction.
[0049] 3) By introducing the fuzzy C-means method to cluster the weather and classify and establish a power prediction model, the impact of different weather conditions on the prediction model is effectively reduced, and the accuracy of photovoltaic power generation prediction results under sunny, cloudy, rainy and snowy conditions is improved. And through case analysis, it is verified that the combined data cleaning method and improved attention mechanism can make the prediction model have good adaptability in different weather conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1The present invention is a flow chart of the photovoltaic power prediction method based on decision tree and improved attention.
[0051] Figure 2 Schematic diagram of the decision-making of isolation forest on outliers.
[0052] Figure 3 It is a schematic diagram of the photovoltaic power prediction model based on BILSTM-improved attention of the present invention.
[0053] Figure 4 This is the prediction result of photovoltaic power generation on a sunny day.
[0054] Figure 5 This is the prediction result of photovoltaic power generation on a cloudy day.
[0055] Figure 6 This is the prediction result of photovoltaic power generation on rainy and snowy days. DETAILED DESCRIPTION
[0056] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.
[0057] Embodiment 1:
[0058] like Figure 1 As shown, in one embodiment of the present invention, a photovoltaic power generation prediction method based on a decision tree and improved attention includes the following steps:
[0059] S1. Establish an isolation forest based on sample data, and use an isolation forest-based photovoltaic power generation abnormal data identification method to identify abnormal data of photovoltaic power generation in the isolation forest;
[0060] S2, repair the abnormal data of photovoltaic power generation in the isolated forest and establish a training set for the decision tree model;
[0061] S3, classify the sample data of the training set by fuzzy C-means clustering method, and establish training subsets of sunny days, cloudy days, and rainy and snowy days;
[0062] S4. The training subsets of sunny days, cloudy days, and rainy and snowy days are input into the convolutional neural network, BiLSTM model, and improved attention mechanism layer in turn to obtain the photovoltaic power generation power prediction results under sunny, cloudy, and rainy and snowy conditions.
[0063] The S1 comprises the following sub-steps:
[0064] S11. Randomly select a preset number of sample data from the sample space, where the number of samples is a power of 2, usually 256, to form a subspace, and use it as the root node of the tree;
[0065] S12, randomly select a feature from the sample data of the subspace, and randomly select a data in the feature as standard data;
[0066] S13, split the subspace according to the standard data, put the sample data larger than the standard data to the right of the current root node, and move the remaining sample data to the left of the current root node, forming two new subspaces;
[0067] S14, repeat S12 to S13 until there is only one data on the leaf node, or the tree has reached the set height, and the construction of an isolated tree is completed;
[0068] S15, looping to construct isolated trees to form an isolated forest, calculating the path length from the sample data to the leaf nodes of each tree according to the isolated forest, and taking the data of the leaf nodes whose path length is lower than the path threshold as abnormal data of the photovoltaic power generation power.
[0069] In this embodiment, in order to further identify abnormal data of photovoltaic power generation, the present invention adopts the isolation forest algorithm to identify it. The isolation forest algorithm is a non-parametric machine learning method. This algorithm realizes efficient identification of abnormal points by constructing isolated binary trees. The isolation forest assumes that a data space is randomly cut, and each cut produces two subspaces; each subspace is randomly cut again until there is only one data point in each space. The input port of the data, that is, the node of the binary tree is the root of the tree, and the node without branches at the end of the cut is the leaf node. The binary tree that satisfies the above cutting process is an isolation tree. In this process, the more outliers and abnormal data points will be cut out earlier, and the more dense data points will be separated later. Therefore, abnormal data points tend to gather near the root of the isolated tree, and normal data points appear more at the end closer to the leaves. The decision of the isolation forest on abnormal points is as follows. Figure 2 shown.
[0070] The S2 comprises the following sub-steps:
[0071] S21, clearing the abnormal data of photovoltaic power generation in the isolated forest and treating it as missing values to obtain a data set of missing values to be filled;
[0072] S22, using the left and right neighbor interpolation method to fill in the missing values in the data set to be filled with missing values, to obtain a first repair value;
[0073] S23, respectively using the ADF, ACF and PACF graphs to determine the parameters in the differential integrated moving average autoregressive model, repairing the missing values in the data set to be filled with missing values, and obtaining a second repaired value;
[0074] S24, repairing the missing values in the data set to be filled with missing values by using MiceForest to obtain a third repaired value;
[0075] S25. Use the matrix to concatenate the first to third repair values, and use the concatenated result to repair the data set with missing values to establish a training set for the decision tree model.
[0076] In S22, the expression for filling and repairing the missing values by the left and right adjacent interpolation method is specifically as follows:
[0077]
[0078] Where X(t) is the missing data point at time t, X (t-1) and X (t+1) are a data point forward and backward of X(t) respectively.
[0079] In this embodiment, left and right neighbor interpolation uses valid data on the left and right sides of the missing data point to estimate the missing value. The core assumption of this method is that neighboring data are usually similar in value, especially when they are close. In time series, because time points are usually arranged at equal intervals, this interpolation method does not require learning and training, and can be directly used to correct outliers in the data set. This method takes the average of the left and right neighboring data points as the estimated value. If the neighboring data is also missing, it is necessary to apply neighbor interpolation multiple times until a valid value is found.
[0080] In S23, the method for repairing missing values in the data set to be filled with missing values using the differential integrated moving average autoregressive model is specifically as follows:
[0081] The data set to be filled with missing values is input into the differential integrated moving average autoregressive model, and the data of the data set to be filled with missing values is differentiated several times to generate a second repair value to fill the missing values, and a stationary time series is obtained; wherein, after the data in the data set to be filled with missing values is differentiated d times, the second repair value is generated to fill the missing values The specific expression is:
[0082]
[0083] In the formula, μ is a constant, p is an autoregressive lag term, and q is a moving average lag term. After performing d differences on the data in the data set to fill the missing values, the data point at time t-1 in the stationary time series is obtained. is the data point at time tp in the stationary time series obtained after d times difference of the data in the data set to be filled with missing values, φ1 is the first autoregressive coefficient, φ p is the pth autoregressive coefficient, θ1 is the first moving average coefficient, θ q is the qth moving average coefficient, ε t-1 is the zero-mean white noise at time t-1, ε t-q is a zero-mean white noise with time tq, ε t is a zero-mean white noise at time t.
[0084] In this embodiment, the AutoRegression Integrated Moving Average (ARIMA) model is essentially an extension of the AutoRegression Moving Average (ARMA) model, which is a smoothing-based repair method.
[0085] The S24 comprises the following sub-steps:
[0086] S241, dividing the data in the data set to be filled with missing values into a data set with missing values and a data set without missing values by using MiceForest;
[0087] S242, training the random forest model using a data set without missing values to generate a predicted repair result;
[0088] S243, updating the random forest model according to the prediction and repair results until a convergence condition is reached, and constructing several data sets for repairing missing values according to the final prediction and repair results;
[0089] S244. Use Rubin's rule to combine all data sets to obtain a third repair value.
[0090] MiceForest combines the advantages of Multiple Imputation by Chained Equations (MICE) and Random Forest (RF). It uses random forest to construct multiple predicted repair values and uses Rubin's rule to combine these values to generate the final repair result. The Rubin's rule can explain the uncertainty caused by missing values.
[0091] In S3, the purpose of the fuzzy C-means algorithm is to minimize the objective function when the constraints are met. The expression of the objective function J of the fuzzy C-means clustering method for classifying the sample data of the training set is specifically:
[0092]
[0093] In the formula, xi is the i-th sample data, n is the total number of sample data, U ij is the membership degree of the i-th sample data to the j-th category, m is the fuzzy weighted number, c j is the center of the jth class.
[0094] There are huge differences in the curves of solar power generation under different meteorological conditions. If only a single solar power generation prediction model is used, the sudden change of meteorological conditions may affect the stability of the deep learning network. Therefore, it is very necessary to classify different meteorological conditions. In photovoltaic power generation prediction, the classification of weather is often carried out through the meteorological factor data that affects photovoltaic power generation, but such meteorological factors usually have no clear boundaries. Therefore, the present invention adopts the fuzzy C-means clustering method to classify the weather.
[0095] The S4 comprises the following sub-steps:
[0096] S41, inputting the training subset of any working condition of sunny day, cloudy day and rainy and snowy day into the convolutional neural network, extracting the local features of the power data through convolution operation and pooling operation, and obtaining time series data, which includes data at several time points;
[0097] S42, input the time series data into the BiLSTM model to obtain the output of the BiLSTM model corresponding to each input value;
[0098] S43, inputting the output of the BiLSTM model into the improved attention mechanism layer, assigning an attention probability to the output of each BiLSTM model through the attention mechanism, and fusing the output of the BiLSTM model according to the attention probability to obtain the preference feature;
[0099] S44. Input the time series data into the improved attention mechanism layer, fuse the time series data with the preference features, and obtain the photovoltaic power generation power prediction results under the corresponding working conditions.
[0100] In S41, the convolutional neural network includes an input layer, a convolution layer, a pooling layer, a fully connected layer and an output layer connected in sequence. The convolution layer performs convolution calculation on the input information and extracts features. Then, the pooling layer compresses the feature information and generates more important information features, thereby improving the quality of the sample data features.
[0101] In S42, the BiLSTM model adds a post-propagation LSTM layer on the basis of the unidirectional LSTM. The BiLSTM model has the ability to use historical data and future information for prediction.
[0102] In S43, the expression for obtaining the initial feature is specifically:
[0103] E=y1·α1+…+y k α k
[0104] Where y1 is the output of the first BiLSTM model, y k is the output of the kth BiLSTM model, α1 is the attention probability assigned to the output of the first BiLSTM model, and α k The attention probability assigned to the output of the k-th BiLSTM model.
[0105] Attention is a model that simulates the attention allocation mechanism of the human brain to suppress or ignore invalid information. By weighting the input data, the influence of key information is highlighted, and more important information is processed using limited resources. Therefore, the attention mechanism is often used to improve the information loss caused by the long sequence of the LSTM model. In the traditional attention mechanism, the attention mechanism only outputs a preference selection once, instead of combining the original characteristics of the data, and the characteristics of the original data are not fully reflected. In order to better reflect the data characteristics, the present invention fuses the characteristics of the initial input attention mechanism with the preference characteristics selected by the attention mechanism before outputting.
[0106] The photovoltaic power prediction model based on BILSTM-improved attention proposed in the present invention is specifically the overall workflow of the photovoltaic power prediction method based on decision tree and improved attention, such as Figure 3 As shown in the figure, the power generation data is first cleaned by the isolation forest algorithm, and then the weather is divided into three types: sunny, cloudy, and rainy and snowy days by the fuzzy C-means clustering method. The data are then input into CNN to extract the local features of the power data through convolution and pooling operations. The time series data is processed by the BiLSTM model to solve the long and short-term memory problems. Finally, the improved attention mechanism is introduced to provide the model with important discriminative features to improve the accuracy of the prediction.
[0107] Embodiment 2:
[0108] This embodiment is a calculation example analysis provided for embodiment 1.
[0109] In verifying the performance of the method of the present invention, the mean absolute percentage error and the normalized root mean square error are used for analysis, as shown in the following formula, where: ture is the test set data; x pre is the model prediction value; n is the number of samples; x max and x min are the maximum and minimum values of the power in this prediction result respectively.
[0110] The root mean square error is:
[0111]
[0112] The normalized root mean square error is:
[0113]
[0114] The mean absolute percentage error is:
[0115]
[0116] In order to verify the performance of the designed method, the BiLSTM network, BiLSTM-attention model and BiLSTM-improved attention model were used to compare power prediction under the same data conditions. The results of the photovoltaic power prediction model are shown in Table 1. Figures 4 to 6 shown.
[0117] Table 1 Comparison of photovoltaic power generation prediction model results
[0118]
[0119] As shown in Table 1, no matter what kind of weather conditions, the BiLSTM-improved attention prediction model proposed in the present invention has a smaller power generation prediction error index than BiLSTM and the traditional BiLSTM-attention model. It can be seen that the improved attention mechanism enhances the ability to extract data feature information by combining the feature information of the original data with the data after redistribution of weights, thereby improving the accuracy of the prediction. From the prediction results of weather classification prediction and non-classification, the model with weather classification has lower RMSE value and MAPE, which is closer to the actual power value. Therefore, by classifying and modeling weather conditions, the prediction accuracy under different types of weather can be effectively improved. In the prediction results of weather classification, sunny days have smaller fluctuations, the power generation law is easy to capture, and the prediction accuracy is high; in cloudy weather, due to the random movement of clouds, the power generation will fluctuate frequently, which increases the difficulty of prediction; the overall irradiance of rainy and snowy days is low, the upper limit of power generation is low, and it may be accompanied by strong winds. The clouds have more changes than cloudy days, and the prediction accuracy is relatively low.
[0120] In order to further verify the application effect of data cleaning on the prediction model, left and right neighbor interpolation, ARIMA and MiceForest and decision tree were used for data repair, and the cleaned sample data were used in the BiLSTM-improved attention prediction model to evaluate the cleaning effect from the credibility of the prediction results. The overall prediction results are shown in Table 2.
[0121] Table 2 Comparison of data cleaning effects based on BiLSTM-improved attention prediction model
[0122]
[0123] As shown in Table 2, the data set repaired by the decision tree has relatively good performance results in three types of weather. On sunny days, because the impact of some bad weather on the equipment can be eliminated, the possibility of generating abnormal data itself is less, and the change law of power generation is closer to the normal distribution, so no matter which repair method is used, the performance is not much different. However, the left and right neighbor interpolation method based on statistics and the smoothing ARIMA repair method based on smoothing do not perform well in bad weather. This may be because the data fluctuation range is larger and more frequent in bad weather, making it impossible for the left and right neighbor interpolation method that relies on data on both sides to obtain reliable repair results, while ARIMA is more inclined to "filter" the data, making the repaired data smoother and unable to fully reflect the data characteristics of the period when power generation fluctuates frequently. Therefore, after example verification, the photovoltaic power generation power sample set combined with the data cleaning method of the isolation forest algorithm can obtain better prediction results when applied to the BILSTM-improved attention prediction model.
[0124] The beneficial effects of the present invention are as follows: the present invention provides a photovoltaic power generation prediction method based on decision tree and improved attention, and the effectiveness of the method is verified by a large amount of measured data, as follows:
[0125] 1) A hybrid repair method based on decision tree is proposed. Combining the advantages of different repair methods such as left and right neighbor interpolation, ARIMA and MiceForest, the repair matrix and decision tree algorithm are used for repair, which can effectively improve the repair results of anomalies and missing values, thereby improving the quality of the data set used for photovoltaic power generation prediction.
[0126] 2) A photovoltaic power prediction model based on BILSTM-improved attention is proposed. The improved attention mechanism combines the feature information of the original data with the data after redistribution of weights, thereby enhancing the ability to extract data feature information and thus improving the accuracy of prediction.
[0127] 3) By introducing the fuzzy C-means method to cluster the weather and classify and establish a power prediction model, the impact of different weather conditions on the prediction model is effectively reduced, and the accuracy of photovoltaic power generation prediction results under sunny, cloudy, rainy and snowy conditions is improved. And through case analysis, it is verified that the combined data cleaning method and improved attention mechanism can make the prediction model have good adaptability in different weather conditions.
[0128] In the description of the present invention, it is necessary to understand that the orientation or positional relationship indicated by the terms "center", "thickness", "upper", "lower", "horizontal", "top", "bottom", "inner", "outer", "radial", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "first", "second", and "third" are used only for descriptive purposes, and cannot be understood as indicating or implying the relative importance or the number of implicitly specified technical features. Therefore, the features defined by "first", "second", and "third" may explicitly or implicitly include one or more of the features.
Claims
1. Photovoltaic power prediction method based on decision tree and improved attention, characterized in that: The following steps are involved: S1. Establish an isolation forest based on sample data, and use an isolation forest-based photovoltaic power generation abnormal data identification method to identify abnormal data of photovoltaic power generation in the isolation forest; S2, repair the abnormal data of photovoltaic power generation in the isolated forest and establish a training set for the decision tree model; S3, classify the sample data of the training set by fuzzy C-means clustering method, and establish training subsets of sunny days, cloudy days, and rainy and snowy days; S4. The training subsets of sunny days, cloudy days, and rainy and snowy days are input into the convolutional neural network, BiLSTM model, and improved attention mechanism layer in turn to obtain the photovoltaic power generation power prediction results under sunny, cloudy, and rainy and snowy conditions.
2. The photovoltaic power generation prediction method based on decision tree and improved attention according to claim 1 is characterized in that: The S1 comprises the following sub-steps: S11, randomly selecting a preset number of sample data from the sample space to form a subspace, and using it as the root node of the tree; S12, randomly select a feature from the sample data of the subspace, and randomly select a data in the feature as standard data; S13, split the subspace according to the standard data, put the sample data larger than the standard data to the right of the current root node, and move the remaining sample data to the left of the current root node, forming two new subspaces; S14, repeat S12 to S13 until there is only one data on the leaf node, or the tree has reached the set height, and the construction of an isolated tree is completed; S15, looping to construct isolated trees to form an isolated forest, calculating the path length from the sample data to the leaf nodes of each tree according to the isolated forest, and taking the data of the leaf nodes whose path length is lower than the path threshold as abnormal data of the photovoltaic power generation power.
3. The photovoltaic power generation prediction method based on decision tree and improved attention according to claim 2 is characterized in that: The S2 comprises the following sub-steps: S21, clearing the abnormal data of photovoltaic power generation in the isolated forest and treating it as missing values to obtain a data set of missing values to be filled; S22, using the left and right neighbor interpolation method to fill in the missing values in the data set to be filled with missing values, to obtain a first repair value; S23, respectively using the ADF, ACF and PACF graphs to determine the parameters in the differential integrated moving average autoregressive model, repairing the missing values in the data set to be filled with missing values, and obtaining a second repaired value; S24, repairing the missing values in the data set to be filled with missing values by using MiceForest to obtain a third repaired value; S25. Use the matrix to concatenate the first to third repair values, and use the concatenated result to repair the data set with missing values to establish a training set for the decision tree model.
4. The photovoltaic power prediction method based on decision tree and improved attention according to claim 3 is characterized in that: In S22, the expression for filling and repairing the missing values by the left and right adjacent interpolation method is specifically as follows: Where X(t) is the missing data point at time t, X (t-1) and X (t+1) are a data point forward and backward of X(t) respectively.
5. The photovoltaic power generation prediction method based on decision tree and improved attention according to claim 3 is characterized in that: In S23, the method for repairing missing values in the data set to be filled with missing values using the differential integrated moving average autoregressive model is specifically as follows: The data set to be filled with missing values is input into the differential integrated moving average autoregressive model, and the data of the data set to be filled with missing values is differentiated several times to generate a second repair value to fill the missing values, and a stationary time series is obtained; wherein, after the data in the data set to be filled with missing values is differentiated d times, the second repair value is generated to fill the missing values The specific expression is: In the formula, μ is a constant, p is an autoregressive lag term, and q is a moving average lag term. After performing d differences on the data in the data set to fill the missing values, the data point at time t-1 in the stationary time series is obtained. is the data point at time tp in the stationary time series obtained after d times difference of the data in the data set to be filled with missing values, φ1 is the first autoregressive coefficient, φ p is the pth autoregressive coefficient, θ1 is the first moving average coefficient, θ q is the qth moving average coefficient, ε t-1 is the zero-mean white noise at time t-1, ε t-q is a zero-mean white noise with time tq, ε t is a zero-mean white noise at time t.
6. The photovoltaic power prediction method based on decision tree and improved attention according to claim 3 is characterized in that: The S24 comprises the following sub-steps: S241, dividing the data in the data set to be filled with missing values into a data set with missing values and a data set without missing values by using MiceForest; S242, training the random forest model using a data set without missing values to generate a predicted repair result; S243, updating the random forest model according to the prediction and repair results until a convergence condition is reached, and constructing several data sets for repairing missing values according to the final prediction and repair results; S244. Use Rubin's rule to combine all data sets to obtain a third repair value.
7. The photovoltaic power prediction method based on decision tree and improved attention according to claim 1, characterized in that: In S3, the expression of the objective function J for classifying the sample data of the training set by the fuzzy C-means clustering method is specifically: In the formula, x i is the i-th sample data, n is the total number of sample data, U ij is the membership degree of the i-th sample data to the j-th category, m is the fuzzy weighted number, c j is the center of the jth class.
8. The photovoltaic power prediction method based on decision tree and improved attention according to claim 1, characterized in that: The S4 comprises the following sub-steps: S41, inputting the training subset of any working condition of sunny day, cloudy day and rainy and snowy day into the convolutional neural network, extracting the local features of the power data through convolution operation and pooling operation, and obtaining time series data, which includes data at several time points; S42, input the time series data into the BiLSTM model to obtain the output of the BiLSTM model corresponding to each input value; S43, inputting the output of the BiLSTM model into the improved attention mechanism layer, assigning an attention probability to the output of each BiLSTM model through the attention mechanism, and fusing the output of the BiLSTM model according to the attention probability to obtain the initial feature; S44. Input the time series data into the improved attention mechanism layer, fuse the time series data with the preference features, and obtain the photovoltaic power generation power prediction results under the corresponding working conditions.
9. The photovoltaic power prediction method based on decision tree and improved attention according to claim 8, characterized in that: In S43, the expression for obtaining the initial feature is specifically: E=y1·α1+…+y k ·a k Where y1 is the output of the first BiLSTM model, y k is the output of the kth BiLSTM model, α1 is the attention probability assigned to the output of the first BiLSTM model, and α k The attention probability assigned to the output of the k-th BiLSTM model.
