Power generation prediction method, storage medium, electronic device and program product
By introducing backpropagation neural network, feature attention mechanism and regularization mechanism into the power generation prediction model, the problem of difficult interpretation of the working principle of the hybrid prediction model and low transparency of the model is solved, and the decision-making principle of high-reliability power prediction and visualization is achieved.
Patent Information
- Application Number
- CN202411561580.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-04-01
AI Technical Summary
In the prior art, hybrid prediction models have problems such as difficult to explain the working principle of power generation power prediction of power systems, low model transparency and weak decision-making results.
A power generation power prediction model with backpropagation neural network structure is adopted, combining characteristic attention mechanisms and regularization mechanisms. The feature attention mechanism reduces the impact of weak correlation features on the prediction results by increasing the input feature weights of the correlation with the prediction results; the regularization mechanism improves the generalization ability of the model by preventing the model from being overfitted.
The interpretability and transparency of the power generation prediction model are realized, the reliability of the prediction results and the generalization ability of the model are improved, and the prediction decision principle can be visualized.
Smart Images

Figure CN119740610A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of power generation control, and in particular, to a power generation prediction method, a storage medium, an electronic device, and a program product. Background Art
[0002] At present, in order to predict the power generation of the power system through the hybrid prediction model, the complex relationship between the input and output needs to be implicit in the model parameters, which makes the working principle of the hybrid model difficult to explain. In addition, the hybrid prediction model is a "black box" model without a clear physical mechanism. There are problems such as low model transparency and weak interpretability of decision-making results. Summary of the invention
[0003] In order to solve the deficiencies of the prior art, the present disclosure provides a power generation prediction method, a storage medium, an electronic device and a program product.
[0004] In order to achieve the above objectives, in a first aspect, the present disclosure provides a method for predicting power generation, the method comprising:
[0005] Obtain meteorological data of photovoltaic stations;
[0006] The meteorological data is input into a trained power generation prediction model to obtain the power generation output by the power generation prediction model, wherein the power generation prediction model is a back-propagation neural network structure, and a feature attention mechanism layer and a regularization mechanism layer are embedded in the hidden layer of the power generation prediction model, the weight attention mechanism layer is used to increase the input feature weights of the prediction results output by the power generation prediction model, and the regularization mechanism layer is used to prevent the power generation prediction model from overfitting.
[0007] In a second aspect, the present disclosure provides a power generation prediction device, the device comprising:
[0008] An acquisition module is configured to acquire meteorological data of a photovoltaic station;
[0009] The prediction module is configured to input the meteorological data into a trained power generation prediction model to obtain the power generation output by the power generation prediction model, wherein the power generation prediction model is a back-propagation neural network structure, and a feature attention mechanism layer and a regularization mechanism layer are embedded in the hidden layer of the power generation prediction model, the weight attention mechanism layer is used to increase the input feature weights of the prediction results output by the power generation prediction model, and the regularization mechanism layer is used to prevent the power generation prediction model from overfitting.
[0010] In a third aspect, the present disclosure provides a non-temporary computer-readable storage medium having a computer program stored thereon, which implements the method described in the first aspect when executed by a processor.
[0011] In a fourth aspect, the present disclosure provides an electronic device, including:
[0012] a memory having a computer program stored thereon;
[0013] A processor is used to execute the computer program in the memory to implement the method described in the first aspect.
[0014] In a fifth aspect, the present disclosure provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.
[0015] Through the above technical scheme, the power generation prediction model adopts an inverse neural network structure, which can minimize the difference between the predicted output and the actual layout and improve the reliability of the prediction results; the power generation prediction model introduces a feature attention mechanism to increase the weight of the input features related to the prediction results, thereby reducing the impact of weakly correlated features on the prediction results, so as to further improve the reliability of the prediction results and realize the visualization of the prediction decision principle; the power generation prediction model introduces a regularization mechanism to prevent the model from overfitting and improve the generalization ability of the model.
[0016] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:
[0018] Figure 1 The figure is a flowchart of a method for predicting power generation according to an exemplary embodiment of the present disclosure.
[0019] Figure 2 It is a schematic diagram of the prediction process of the power generation prediction model according to an exemplary embodiment of the present disclosure.
[0020] Figure 3a Schematic diagram of the prediction results of a BPNN model.
[0021] Figure 3b It is a schematic diagram of prediction results of a power generation prediction model according to an exemplary embodiment of the present disclosure.
[0022] Figure 4is a model explanation flowchart shown according to an exemplary embodiment of the present disclosure.
[0023] Figure 5 is a bar diagram illustrating attention weights according to an exemplary embodiment of the present disclosure.
[0024] Figure 6 is a bar graph showing Shapley values according to an exemplary embodiment of the present disclosure.
[0025] Figure 7 It is a block diagram of a power generation prediction device according to an exemplary embodiment of the present disclosure.
[0026] Figure 8 is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.
[0028] It should be noted that all actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the device is located and with the authorization given by the owner of the corresponding device.
[0029] It should be understood that in recent years, with the widespread application of big data technology and a new generation of artificial intelligence (AI) technology represented by deep learning and reinforcement learning in many fields, research on photovoltaic power generation prediction has made significant progress. These AI technologies can predict the trend of photovoltaic power generation changes in photovoltaic stations in the future by analyzing dynamic information such as weather forecast data, historical power generation data, and real-time meteorological observation data, combined with static information such as the location information and equipment parameters of photovoltaic stations. This is of great significance for optimizing power grid dispatching, maintenance plan formulation, stability analysis, and the effective absorption of new energy.
[0030] At present, neural network, as a typical artificial intelligence algorithm, is a commonly used method for photovoltaic power generation prediction due to its powerful computing power and nonlinear mapping ability, which can handle complex input-output relationships and has high prediction accuracy. However, the prediction accuracy of a single model is limited, so hybrid prediction models appear to improve the overall prediction accuracy by integrating different prediction methods. However, hybrid prediction models generally have problems such as high computing cost, complex structure and slow operation speed.
[0031] At present, the application of Explainable Artificial Intelligence (XAI) in photovoltaic power prediction mainly includes two types of methods: global explanation method and local explanation method.
[0032] Among them, the global explanation method focuses on explaining the overall behavior of the machine learning model. Commonly used global explanation methods include permutation feature importance (PFI), partial dependency plot (PDP), etc. PFI can identify the magnitude of the impact of features on the prediction results, identify the key features that affect the prediction results, and provide global features, and can handle nonlinear relationships; but PFI is very sensitive to slight changes in input features, which may lead to performance degradation. PDP can reveal the marginal impact of input features on prediction results and identify the complex nonlinear relationship between input features and prediction results; but PDP has a limited scope of application and poor adaptability.
[0033] Local explanation methods focus on explaining the prediction logic of the model for a single sample, which can help power grid operators gain insight into the model's prediction process for a single sample prediction result and quantify the contribution of each feature to the prediction result. Common local explanation methods include Local Interpretable Model-agnostic Explanations (LIME) and Shapley value. LIME approximates the behavior of the original model by building a simple local model to provide an explanation for a single sample. It can explain tabular data, images and text data, but its explanation is unstable. Shapley value is a method in cooperative game theory to fairly distribute benefits according to the contribution of members in the alliance to the total benefits. It has a solid theoretical basis in practical applications, but it requires a lot of computing time.
[0034] The inventors found that in order to predict the power generation of an electric power system through a hybrid prediction model, the complex relationship between the input and output needs to be implicitly embedded in the model parameters, which makes the working principle of the hybrid model difficult to explain. In addition, the hybrid prediction model is a "black box" model without a clear physical mechanism, and there are problems such as low model transparency and weak interpretable basis for decision results.
[0035] In view of this, the present disclosure provides a power generation prediction method, storage medium, electronic device and program product, which can realize the visualization of the correlation degree between the input and output of the power generation prediction model and ensure the reliability of the prediction results.
[0036] Figure 1 A power generation prediction method is shown according to an exemplary embodiment of the present disclosure, such as Figure 1 As shown, the method may include the following steps:
[0037] In step S101, meteorological data of a photovoltaic station is obtained.
[0038] It is worth noting that the meteorological data includes but is not limited to direct solar irradiance, wind direction, bottom wind speed, air pressure, precipitation, humidity, temperature, etc. Each parameter in the meteorological data can be a feature.
[0039] In step S102, the meteorological data is input into a trained power generation prediction model to obtain the power generation output by the power generation prediction model, wherein the power generation prediction model is a back-propagation neural network structure, and a feature attention mechanism layer and a regularization mechanism layer are embedded in the hidden layer of the power generation prediction model, the weight attention mechanism layer is used to increase the input feature weights of the prediction results output by the power generation prediction model, and the regularization mechanism layer is used to prevent the power generation prediction model from overfitting.
[0040] For example, the hidden layer of the power generation prediction model is embedded with a feature attention mechanism layer (Attention Mechanism Layer) and a regularization mechanism layer (Dropout Layer). The power generation prediction model combines the feature attention mechanism (Attention Mechanism, AM) and optimizes and improves the back propagation neural network (BPNN) based on the regularization technology (Dropout) to form an AM-Dropout-BPNN composite model. The prediction performance and robustness of the AM-Dropout-BPNN composite model are better than those of the BPNN model, and the prediction results of the AM-Dropout-BPNN composite model are interpretable and reach the global optimal solution.
[0041] In the embodiment of the present disclosure, the power generation prediction model adopts an inverse neural network structure, which can minimize the difference between the predicted output and the actual layout and improve the reliability of the prediction result; the power generation prediction model introduces a feature attention mechanism to increase the weight of the input features related to the prediction result, thereby reducing the impact of weakly correlated features on the prediction result, so as to further improve the reliability of the prediction result and realize the visualization of the prediction decision principle; the power generation prediction model introduces a regularization mechanism to prevent the model from overfitting and improve the generalization ability of the model.
[0042] In order to facilitate those skilled in the art to better understand the power generation prediction method provided by the present disclosure, the steps of the method are described in detail below.
[0043] In a feasible implementation manner, the power generation prediction model is trained in the following manner:
[0044] Acquire historical information of the photovoltaic station, and determine a training set and a test set according to the historical information, wherein the historical information includes historical meteorological data and historical power data;
[0045] The model parameters of the back propagation neural network are randomly initialized, and the hyperparameters are preset to obtain the initial prediction model;
[0046] The initial prediction model is iteratively trained through the training set until the initial prediction model reaches convergence, and the converged initial prediction model is tested through the test set. When the test result meets the preset test conditions, the initial prediction model is used as the power generation prediction model.
[0047] Among them, the hyperparameters include but are not limited to the number of hidden units, learning rate, Dropout, and input dimension, etc. In the embodiment of the present disclosure, the hyperparameters are set as follows: the number of hidden units is 96, the learning rate is 0.001, the Dropout is 0.4, and the input dimension is the meteorological feature dimension.
[0048] In the disclosed embodiment, the initial prediction model is iteratively trained through the training set, so that the initial prediction model can gradually learn the data features and rules in the training set, thereby improving its prediction accuracy; when the initial prediction model reaches convergence, it is characterized that the performance of the initial prediction model on the training set has stabilized; the converged initial prediction model is tested through an independent test set, and the performance of the converged initial prediction model on unseen data, that is, the generalization ability, can be evaluated, so that the converged initial prediction model can perform well on the training data and can also take into account the maintenance of stable prediction performance in practical applications.
[0049] In a feasible implementation manner, determining a training set and a test set according to the historical information includes:
[0050] According to the time series corresponding to the historical information, the historical information is filled to obtain a first data set;
[0051] Determine a first median corresponding to the first data set, and respectively determine an absolute deviation value of each parameter in the first data set from the first median to obtain a first deviation set corresponding to the first data set;
[0052] Determine a second median of the first deviation set, and remove abnormal parameters in the first data set according to the second median to obtain a second data set;
[0053] Performing linear transformation processing on the second data set, scaling each parameter in the second data set to a range greater than or equal to 0 and less than or equal to 1, to obtain a target data set;
[0054] The target data set is divided according to a preset allocation ratio to obtain a training set and a test set.
[0055] It is worth noting that the existing filling algorithm is the KNN algorithm, which is mainly used for complex data structures with nonlinear relationships, but the selection of its k value will have a great impact on the result. If the k value is too large or too small, it may include irrelevant samples or the result may be affected by noise, affecting the accuracy of missing value estimation. Therefore, the embodiment of the present disclosure adopts the K-Nearest Neighbors (KNN) method improved by the Locally Weighted Regression (LWR) algorithm to obtain the LWR KNN algorithm.
[0056] It should be understood that LWR is a locally weighted linear regression method that not only considers the k nearest neighbors, but also assigns a weight to each neighbor, which is inversely proportional to the distance, that is, the farther away from the missing value estimation point, the smaller the weight. In LWR, the missing value is estimated as the output of a weighted linear model, where the weight reflects the influence of the neighbors.
[0057] It is worth noting that before filling the historical information, the location of the missing values in the historical information needs to be determined based on the time series corresponding to the historical information, so as to separate the sample data containing missing values and the complete training samples. The Euclidean distance measurement method can be used to determine the similarity between different samples. Based on the similarity between different samples, the k samples with the closest similarity are determined, and the data of the k samples are averaged to obtain the average value, and the location of the missing values is determined based on the average value. The calculation principle of the Euclidean distance measurement method can be found in the following calculation formula:
[0058]
[0059] Among them, D(A,B) represents the n-dimensional feature vector A(a1, a2, ..., a n ) and B(b1, b2, …, b n ) is the Euclidean distance between .
[0060] Correspondingly, for the sample point x0 with missing values, LWR finds the best estimated missing eigenvalue y0 through an optimization process to minimize the weighted square error. The specific principle is shown in the following calculation formula:
[0061]
[0062] in, represents the estimated missing value, n represents the number of selected nearest neighbors, y i represents the target value of the i-th neighbor sample, y represents the missing value being estimated, that is, the missing feature value of the sample point x0, and w i Represents the weight of the i-th neighbor point relative to the missing value estimation point.
[0063] It should be understood that, compared with the existing KNN algorithm, the LWR KNN algorithm has higher accuracy and effectiveness in filling processing, and reduces the sensitivity to the selection of k value and the assumptions on data distribution.
[0064] It is worth noting that after the LWR KNN algorithm is used to fill the historical information with postpartum care to obtain the first data set, the median absolute deviation method (MAD) can be used to process the outliers of the first data set to obtain the second data set.
[0065] Specifically, the specific steps for outlier processing through MAD are as follows:
[0066] 1) Calculate the first median corresponding to the first data set That is, take the middle value after sorting the data. If the number of observations in the data set is even, take the average of the two middle values.
[0067] 2) For each observation x in the first data set i , and calculate its absolute deviation from the median:
[0068] 3) Calculate the median of absolute deviations,
[0069] 4) Normalized MAD: Since the expected value of MAD is less than the expected value of the standard deviation, it is usually necessary to multiply it by a constant factor c to make it match the standard deviation. Where c is 1.4826, the normalized MAD is:
[0070] MAD norm =c×MAD.
[0071] 5) Define outlier limits: Outliers are usually defined as deviations from the median MAD norm For observations exceeding a certain multiple, 3 times the MAD is often used. norm ,Right now:
[0072]
[0073]
[0074] Observations in the first data set that are below the Lower Bound or above the Upper Bound are considered outliers;
[0075] 6) Processing outliers: The detected outliers can be directly deleted or replaced with the median according to the actual situation. The outliers in the first data set are eliminated to obtain the second data set.
[0076] In the embodiments of the present disclosure, since MAD is insensitive to the shape of data distribution, it can provide an effective outlier detection limit even if the data is not normally distributed. Therefore, outlier detection through MAD can ensure the reliability of the detection results and improve the accuracy and reliability of the obtained second data set.
[0077] It is worth noting that the second data set can be used as the target data set, or the second data set can be normalized to obtain the target data set. Because data standardization or normalization is to ensure that the model reduces the dimensional influence between parameters during training and prediction, so that all parameters are in a similar numerical range, and ensure fair comparison between parameters, thereby accelerating the convergence speed of the model and improving the performance of the model. Therefore, in the embodiment of the present disclosure, it is preferred to perform a linear transformation on the second data set to scale each parameter in the second data set to the range of [0, 1].
[0078] The specific scaling process can be found in the following calculation formula:
[0079]
[0080] Wherein, x represents the original parameter, min(x) represents the minimum value in the second data set, and max(x) represents the maximum value in the second data set.
[0081] In a feasible implementation manner, the iterative training of the initial prediction model using the training set includes:
[0082] The training set is input into the initial prediction model for iterative training. The initial prediction model performs the following operations in each iteration:
[0083] The feature attention mechanism layer in the hidden layer respectively performs an attention weight on each parameter in the test set, and weights and fuses each data based on the attention weight of each parameter to obtain a first intermediate parameter, and the regularization mechanism layer in the hidden layer performs a discard operation on some neurons in the initial prediction model according to a preset discard probability, and performs back propagation processing on the first intermediate parameter to obtain a second intermediate parameter;
[0084] The first predicted power generation is outputted according to the second intermediate parameter through the output layer of the initial prediction model, a loss function is calculated for the first predicted power generation to obtain a loss value corresponding to the first predicted power generation, and the gradient of the loss function with respect to each model parameter in the initial prediction model is determined, and the model parameters of the initial prediction model are updated through the optimizer, wherein the model parameters include weights and biases.
[0085] It should be understood that power generation is greatly affected by meteorological factors, and each meteorological data has a different impact on the prediction results. Therefore, the feature attention mechanism can be used to enable the power generation model to focus on the most influential part of the input meteorological feature data when processing time series-based meteorological data. AM can calculate the weight of each input sequence feature so that the power generation prediction model gives different degrees of "attention" to each part of the input data. According to the attention weight a t The correlation between each feature sequence data and the generated power is calculated, and the features with strong correlation with the generated power are used for power prediction, thereby improving the accuracy of the prediction.
[0086] It is worth noting that if Figure 2 As shown, the feature attention mechanism layer AM consists of an encoder and a decoder. In the feature weight calculation process, the input sequence x at each time step i It contains multiple features related to power generation prediction, and the encoder converts multiple features into hidden state sequences h t , the decoder passes the query vector q and the hidden state sequence h t The attention weights are calculated as follows:
[0087]
[0088] Among them, a t Represents the attention weight, h t represents the hidden state sequence, q represents the query vector (the decoder queries the previous information and takes the hidden state sequence of the last time step), and the score() function calculates the hidden state sequence h through the dot product scoring mechanism t The similarity between it and the query vector q.
[0089] It should be understood that the existing BPNN model is trained through the back propagation algorithm to minimize the difference between the predicted output and the actual target, which causes the BPNN model to fit complex nonlinear relationships, and may not reach the global optimum during the training process, and there is a risk of overfitting. In the embodiment of the present disclosure, the BPNN model is improved by Dropout to improve the generalization ability of the model.
[0090] It is worth noting that Dropout randomly discards some neurons during model training, forcing other neurons in the model to learn more robust feature representations to reduce the overfitting of the model. For example, in each training iteration of the model, Dropout randomly inactivates some neurons according to probability p and sets their output to 0 to prevent the model from being too dependent on the training data and reduce overfitting.
[0091] Specifically, when training the model, the output y of each layer l After the Dropout layer, it becomes
[0092]
[0093] in, represents the second intermediate parameter, d() represents the random discard operation, setting the output of the neurons randomly discarded according to the discard probability p to zero, y l represents the first intermediate parameter, and p represents the discard probability.
[0094] In the process of iterative model training, the embodiment of the present disclosure minimizes the gap between the predicted value and the true value by adjusting the model parameters. The gradient of the loss function relative to the model parameters is calculated based on the back propagation algorithm, and then the weights are updated to reduce the loss.
[0095] For example, see Figure 2 Each iteration of the initial prediction model training may include the following process:
[0096] Data preparation: determine the training set;
[0097] Read input data: input the training set into the initial prediction model;
[0098] Initialize the BPNN upgrade network and extract features: randomly initialize all weights and biases of the initial prediction model to prevent the gradient from disappearing or exploding, and set the hyperparameters: number of hidden units 96, Dropout: 0.4, learning rate: 0.001, optimizer Adam, loss function MSELoss.
[0099] The attention weight a is calculated through the attention mechanism layer t , and weightedly fuse each parameter according to the attention weight to obtain the first intermediate parameter;
[0100] Perform feature integration on the first intermediate parameter through a fully connected layer;
[0101] The Dropout layer discards some neurons according to the probability p to reduce the overfitting of the initial prediction model, and performs backpropagation processing on the first intermediate parameter after feature integration to obtain the second intermediate parameter;
[0102] The output layer outputs the predicted value (i.e., generated power) according to the second intermediate parameter after feature integration, and performs the loss function MSE calculation to obtain the loss value of the predicted value. At the same time, the back-propagation algorithm is used to calculate the gradient of the weight and the gradient of the bias in the initial prediction model, and the optimizer is used to update the weight and bias of the initial prediction model according to the gradient.
[0103] In a feasible implementation manner, the test set is used to test the converged initial prediction model, and when the test result meets the preset test conditions, the initial prediction model is used as the power generation prediction model, including:
[0104] Inputting the test set into the converged initial prediction model to obtain a second predicted power generation output by the initial prediction model according to the test set;
[0105] Determine a deviation value between the measured power generation corresponding to the test set and the second predicted power generation;
[0106] When the deviation value is within the preset deviation interval, the initial prediction model is used as the power generation prediction model.
[0107] It is worth noting that when the converged initial prediction model is tested through the test set, the Dropout layer is turned off so that all neurons in the model participate in the calculation, ensuring stable prediction of the model, thereby improving the reliability and accuracy of the test results.
[0108] Among them, the preset deviation interval can be preset according to the user's prediction requirements or prediction accuracy, and the present disclosure does not limit this.
[0109] For example, the power generation predicted by the traditional BPNN model is as follows: Figure 3a As shown in Figure 2, the power generation predicted by the AM-Dropout-BPNN model is as follows: Figure 3b As shown. It can be seen that the AM-Dropout-BPNN model increases the weight of input features that are highly correlated with the prediction results and reduces the influence of features with weak correlation by introducing the feature attention mechanism; the BPNN model is improved and upgraded by Dropout to prevent the prediction model from overfitting and improve the generalization ability of the model. This allows the AM-Dropout-BPNN model to improve the prediction performance while increasing the robustness and interpretability of the model.
[0110] It is worth noting that due to the lack of explainability and transparency of traditional artificial intelligence models, it is difficult to understand the decision-making process of the prediction model, and the prediction results lack credibility, which limits the application of traditional artificial intelligence in fields such as smart grids. Explainable Artificial Intelligence (XAI) technology can help power grid personnel understand the internal working mechanism of the model and improve the trust of the model by explaining the reasons for the prediction results and analyzing the impact of input parameters on the prediction results.
[0111] For example, Figure 4 As shown in the figure, data preparation: determine the test set. Input the test set into the prediction model and XAI respectively. The prediction model predicts the photovoltaic power according to the test set. XAI analyzes the impact of the test set on the photovoltaic power prediction results and explains the reasons for the prediction results. The decision-making process of the prediction model outputting the prediction results according to the test set is obtained, so that the power grid personnel can understand the decision-making process of the prediction results.
[0112] Specifically, XAI can explain the prediction results based on attention weights and / or based on CS-SHAP (Cooperative Game Theory-Shapley Sampling) prediction results.
[0113] Explain the prediction results based on attention weights:
[0114] In the attention mechanism layer of the AM-Dropout-BPNN model, each input parameter is assigned a weight. The PyTorch provided by the AM-Dropout-BPNN model is used to directly access the internal structure of the model to obtain the weight matrix of the attention weights of the attention mechanism layer, ensuring that the dimension of the weight matrix is consistent with the number of parameters; the weight matrix is converted into a vector in which each influencing factor corresponds to a parameter; and a bar weight graph is created using the Matplotlib tool.
[0115] For example, see Figure 5 The bar weight graph can intuitively display the attention weight corresponding to each parameter, explain the contribution of each parameter to the photovoltaic power prediction results, and help AM-Dropout-BPNN understand the working principle of the model. It can be seen that the direct solar irradiance contributes the most to the model prediction results, while the air pressure contributes almost nothing to the prediction results, which well explains the characteristic factors that contribute the most to photovoltaic power generation.
[0116] Explanation of the prediction results based on CS-SHAP (Cooperative Game Theory-Shapley Sampling):
[0117] In a feasible implementation manner, after obtaining the power generation output by the power generation prediction model, the method further includes:
[0118] For each parameter in the meteorological data, the following process is performed multiple times: a first preset number of parameters are selected from the meteorological data as a first feature data set, a feature function is determined according to the first feature data set and the power generation, the parameter is added to the first feature data set to obtain a second feature data set, and a marginal contribution value between the parameter and the feature data set is determined according to the first feature data set, the second feature data set and the feature function;
[0119] When a second preset number of marginal contribution values are obtained, determining an average value of the second preset number of marginal contribution values, and using the average value as the Shapley value of the parameter;
[0120] The contribution degree of the parameter to the generated power is determined according to the Shapley value corresponding to each parameter.
[0121] It is worth noting that the Shapley value (SHAP) originates from cooperative game theory. The existing Shapley value is mainly determined by the following calculation formula: For a model f with n features {x1, x2, ..., xn}, its Shapley value is:
[0122]
[0123] Among them, φ i (f) Characterizes the Shapley value determined by model f, S i,π represents the set formed by adding feature xi to the feature set according to the arrangement π, S π Characterize the set of features after excluding xi from the permutation π.
[0124] It can be seen that in the existing Shapley value calculation, theoretically, 2 n In practical applications, it is necessary to calculate the Shapley values of n! permutations, which is very time-consuming when the number of features is large.
[0125] In the embodiment of the present disclosure, CS-Shapley sampling is combined with an optimization algorithm to approximate the Shapley value, which is specifically estimated by Monte Carlo simulation sampling technology, specifically by the following calculation formula:
[0126]
[0127] in, The approximate Shapley value of the model f, N represents the number of samplings, π l Characterize the feature arrangement of the k-th sampling.
[0128] For example, Figure 6 As shown in Figure 3, the SHAP value calculated based on CS-SHAP indicates the criticality of each characteristic factor to the prediction result.
[0129] In summary, CS-Shapley greatly reduces computing resources compared to the traditional Shapley value calculation method, making it applicable to large models and data sets. It can also show the contribution of each parameter to the prediction results, improve the decision transparency of the model, and visualize the correlation between the input and output of the power generation prediction model, which is crucial for understanding the model decision process and improving the trust in the model. At the same time, through the interpretation of the prediction results by CS-Shapley, the correctness of the interpretation of the prediction results based on the visualization of attention weights can be further verified.
[0130] In the disclosed embodiment, the AM-Dropout-BPNN model is used to predict the power generation, wherein the introduction of AM helps the model to focus more accurately on the key features in the input data, thereby improving the accuracy and interpretability of the prediction model; the BPNN model is improved by the Dropout regularization technology to avoid overfitting in the model during the training process, improve the generalization ability of the model, and enhance its reliability in the application; the combined use of Dropout and AM on BPNN enables the model to maintain the stability of photovoltaic power prediction when there is a slight change in the input data, thereby improving the robustness of the model. The prediction result interpretation based on the attention weight visualization can show the key characteristic factors in the model prediction process, which helps to understand the decision-making process of the model; the prediction result interpretation based on CS-SHAP determines the SHAP value of each parameter, and then shows the contribution of each feature to the model prediction result, thereby explaining how the decision-making process of the model affects the final photovoltaic power prediction, and also proves the correctness of the prediction result interpretation of the attention weight visualization, improving the transparency and credibility of the model.
[0131] Based on the same inventive concept, the present disclosure provides a power generation prediction device, such as Figure 7 As shown, the power generation prediction device includes an acquisition module 701 and a prediction module 702 .
[0132] Wherein, the acquisition module 701 is configured to acquire meteorological data of the photovoltaic station;
[0133] The prediction module 702 is configured to input the meteorological data into a trained power generation prediction model to obtain the power generation output by the power generation prediction model, wherein the power generation prediction model is a back-propagation neural network structure, and a feature attention mechanism layer and a regularization mechanism layer are embedded in the hidden layer of the power generation prediction model, the weight attention mechanism layer is used to increase the input feature weights of the prediction results output by the power generation prediction model, and the regularization mechanism layer is used to prevent the power generation prediction model from overfitting.
[0134] In the embodiment of the present disclosure, the power generation prediction model adopts an inverse neural network structure, which can minimize the difference between the predicted output and the actual layout and improve the reliability of the prediction result; the power generation prediction model introduces a feature attention mechanism to increase the weight of the input features related to the prediction result, thereby reducing the impact of weakly correlated features on the prediction result, so as to further improve the reliability of the prediction result and realize the visualization of the prediction decision principle; the power generation prediction model introduces a regularization mechanism to prevent the model from overfitting and improve the generalization ability of the model.
[0135] Optionally, the power generation prediction device further includes a training module, and the training module is configured to:
[0136] Acquire historical information of the photovoltaic station, and determine a training set and a test set according to the historical information, wherein the historical information includes historical meteorological data and historical power data;
[0137] The model parameters of the back propagation neural network are randomly initialized, and the hyperparameters are preset to obtain the initial prediction model;
[0138] The initial prediction model is iteratively trained through the training set until the initial prediction model reaches convergence, and the converged initial prediction model is tested through the test set. When the test result meets the preset test conditions, the initial prediction model is used as the power generation prediction model.
[0139] Optionally, the training module is configured to:
[0140] The training set is input into the initial prediction model for iterative training. The initial prediction model performs the following operations in each iteration:
[0141] The feature attention mechanism layer in the hidden layer respectively performs an attention weight on each parameter in the test set, and weights and fuses each data based on the attention weight of each parameter to obtain a first intermediate parameter, and the regularization mechanism layer in the hidden layer performs a discard operation on some neurons in the initial prediction model according to a preset discard probability, and performs back propagation processing on the first intermediate parameter to obtain a second intermediate parameter;
[0142] The first predicted power generation is outputted according to the second intermediate parameter through the output layer of the initial prediction model, a loss function is calculated for the first predicted power generation to obtain a loss value corresponding to the first predicted power generation, and the gradient of the loss function with respect to each model parameter in the initial prediction model is determined, and the model parameters of the initial prediction model are updated through the optimizer, wherein the model parameters include weights and biases.
[0143] Optionally, the training module is configured to:
[0144] Inputting the test set into the converged initial prediction model to obtain a second predicted power generation output by the initial prediction model according to the test set;
[0145] Determine a deviation value between the measured power generation corresponding to the test set and the second predicted power generation;
[0146] When the deviation value is within the preset deviation interval, the initial prediction model is used as the power generation prediction model.
[0147] Optionally, the training module is configured to:
[0148] According to the time series corresponding to the historical information, the historical information is filled to obtain a first data set;
[0149] Determine a first median corresponding to the first data set, and respectively determine an absolute deviation value of each parameter in the first data set from the first median to obtain a first deviation set corresponding to the first data set;
[0150] Determine a second median of the first deviation set, and remove abnormal parameters in the first data set according to the second median to obtain a second data set;
[0151] Performing linear transformation processing on the second data set, scaling each parameter in the second data set to a range greater than or equal to 0 and less than or equal to 1, to obtain a target data set;
[0152] The target data set is divided according to a preset allocation ratio to obtain a training set and a test set.
[0153] Optionally, the power generation prediction device further includes a verification module, and the verification module is configured to:
[0154] For each parameter in the meteorological data, the following process is performed multiple times: a first preset number of parameters are selected from the meteorological data as a first feature data set, a feature function is determined according to the first feature data set and the power generation, the parameter is added to the first feature data set to obtain a second feature data set, and a marginal contribution value between the parameter and the feature data set is determined according to the first feature data set, the second feature data set and the feature function;
[0155] When a second preset number of marginal contribution values are obtained, determining an average value of the second preset number of marginal contribution values, and using the average value as the Shapley value of the parameter;
[0156] The contribution degree of the parameter to the generated power is determined according to the Shapley value corresponding to each parameter.
[0157] Regarding the power generation prediction device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0158] Based on the same inventive concept, the present disclosure provides an electronic device, including:
[0159] a memory having a computer program stored thereon;
[0160] A processor is used to execute the computer program in the memory to implement the above-mentioned power generation prediction method.
[0161] In the embodiment of the present disclosure, the power generation prediction model adopts an inverse neural network structure, which can minimize the difference between the predicted output and the actual layout and improve the reliability of the prediction result; the power generation prediction model introduces a feature attention mechanism to increase the weight of the input features related to the prediction result, thereby reducing the impact of weakly correlated features on the prediction result, so as to further improve the reliability of the prediction result and realize the visualization of the prediction decision principle; the power generation prediction model introduces a regularization mechanism to prevent the model from overfitting and improve the generalization ability of the model.
[0162] Figure 8 FIG. 8 is a block diagram of an electronic device 800 according to an exemplary embodiment. Figure 8 As shown, the electronic device 800 may include: a processor 801 and a memory 802. The electronic device 800 may also include one or more of a multimedia component 803, an input / output (I / O) interface 804, and a communication component 805.
[0163] The processor 801 is used to control the overall operation of the electronic device 800 to complete all or part of the steps in the above-mentioned power generation prediction method. The memory 802 is used to store various types of data to support the operation of the electronic device 800, and these data may include, for example, instructions for any application or method used to operate on the electronic device 800, and application-related data, such as meteorological data, Shapley value, historical meteorological data, and historical power data. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 803 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 802 or sent through the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above-mentioned other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the electronic device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 805 may include: Wi-Fi module, Bluetooth module, NFC module, etc.
[0164] In an exemplary embodiment, the electronic device 800 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned power generation prediction method.
[0165] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned power generation prediction method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 802 including program instructions, and the above-mentioned program instructions can be executed by the processor 801 of the electronic device 800 to complete the above-mentioned power generation prediction method.
[0166] In another exemplary embodiment, a computer program product is also provided. The computer program product includes a computer program executable by a programmable device, and the computer program has a code portion for executing the above-mentioned power generation prediction method when executed by the programmable device.
[0167] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.
[0168] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0169] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.
Claims
1. A method for predicting power generation, characterized in that: The method comprises: Obtain meteorological data of photovoltaic stations; The meteorological data is input into a trained power generation prediction model to obtain the power generation output by the power generation prediction model, wherein the power generation prediction model is a back-propagation neural network structure, and a feature attention mechanism layer and a regularization mechanism layer are embedded in the hidden layer of the power generation prediction model, the weight attention mechanism layer is used to increase the input feature weights of the prediction results output by the power generation prediction model, and the regularization mechanism layer is used to prevent the power generation prediction model from overfitting.
2. The power generation prediction method according to claim 1, characterized in that: The power generation prediction model is trained in the following way: Acquire historical information of the photovoltaic station, and determine a training set and a test set according to the historical information, wherein the historical information includes historical meteorological data and historical power data; The model parameters of the back propagation neural network are randomly initialized, and the hyperparameters are preset to obtain the initial prediction model; The initial prediction model is iteratively trained through the training set until the initial prediction model reaches convergence, and the converged initial prediction model is tested through the test set. When the test result meets the preset test conditions, the initial prediction model is used as the power generation prediction model.
3. The power generation prediction method according to claim 2, characterized in that: The iterative training of the initial prediction model using the training set includes: The training set is input into the initial prediction model for iterative training. The initial prediction model performs the following operations in each iteration: The feature attention mechanism layer in the hidden layer respectively performs an attention weight on each parameter in the test set, and weights and fuses each data based on the attention weight of each parameter to obtain a first intermediate parameter, and the regularization mechanism layer in the hidden layer performs a discard operation on some neurons in the initial prediction model according to a preset discard probability, and performs back propagation processing on the first intermediate parameter to obtain a second intermediate parameter; The first predicted power generation is outputted according to the second intermediate parameter through the output layer of the initial prediction model, a loss function is calculated for the first predicted power generation to obtain a loss value corresponding to the first predicted power generation, and the gradient of the loss function with respect to each model parameter in the initial prediction model is determined, and the model parameters of the initial prediction model are updated through the optimizer, wherein the model parameters include weights and biases.
4. The power generation prediction method according to claim 2, characterized in that: The method of testing the converged initial prediction model through the test set and using the initial prediction model as the power generation prediction model when the test result meets the preset test conditions includes: Inputting the test set into the converged initial prediction model to obtain a second predicted power generation output by the initial prediction model according to the test set; Determine a deviation value between the measured power generation corresponding to the test set and the second predicted power generation; When the deviation value is within the preset deviation interval, the initial prediction model is used as the power generation prediction model.
5. The power generation prediction method according to claim 2, characterized in that: Determining a training set and a test set according to the historical information includes: According to the time series corresponding to the historical information, the historical information is filled to obtain a first data set; Determine a first median corresponding to the first data set, and respectively determine an absolute deviation value of each parameter in the first data set from the first median to obtain a first deviation set corresponding to the first data set; Determine a second median of the first deviation set, and remove abnormal parameters in the first data set according to the second median to obtain a second data set; Performing linear transformation processing on the second data set, scaling each parameter in the second data set to a range greater than or equal to 0 and less than or equal to 1, to obtain a target data set; The target data set is divided according to a preset allocation ratio to obtain a training set and a test set.
6. The power generation prediction method according to any one of claims 1 to 5, characterized in that: After obtaining the power generation output by the power generation prediction model, the method further includes: For each parameter in the meteorological data, the following process is performed multiple times: a first preset number of parameters are selected from the meteorological data as a first feature data set, a feature function is determined according to the first feature data set and the power generation, the parameter is added to the first feature data set to obtain a second feature data set, and a marginal contribution value between the parameter and the feature data set is determined according to the first feature data set, the second feature data set and the feature function; When a second preset number of marginal contribution values are obtained, determining an average value of the second preset number of marginal contribution values, and using the average value as the Shapley value of the parameter; The contribution degree of the parameter to the generated power is determined according to the Shapley value corresponding to each parameter.
7. A power generation prediction device, characterized in that: The device comprises: An acquisition module is configured to acquire meteorological data of a photovoltaic station; The prediction module is configured to input the meteorological data into a trained power generation prediction model to obtain the power generation output by the power generation prediction model, wherein the power generation prediction model is a back-propagation neural network structure, and a feature attention mechanism layer and a regularization mechanism layer are embedded in the hidden layer of the power generation prediction model, the weight attention mechanism layer is used to increase the input feature weights of the prediction results output by the power generation prediction model, and the regularization mechanism layer is used to prevent the power generation prediction model from overfitting.
8. The power generation prediction device according to claim 7, characterized in that: The power generation prediction device further includes a training module, which is configured to: Acquire historical information of the photovoltaic station, and determine a training set and a test set according to the historical information, wherein the historical information includes historical meteorological data and historical power data; The model parameters of the back propagation neural network are randomly initialized, and the hyperparameters are preset to obtain the initial prediction model; The initial prediction model is iteratively trained through the training set until the initial prediction model reaches convergence, and the converged initial prediction model is tested through the test set. When the test result meets the preset test conditions, the initial prediction model is used as the power generation prediction model.
9. The power generation prediction device according to claim 8, characterized in that: The training module is configured to: The training set is input into the initial prediction model for iterative training. The initial prediction model performs the following operations in each iteration: The feature attention mechanism layer in the hidden layer respectively performs an attention weight on each parameter in the test set, and weights and fuses each data based on the attention weight of each parameter to obtain a first intermediate parameter, and the regularization mechanism layer in the hidden layer performs a discard operation on some neurons in the initial prediction model according to a preset discard probability, and performs back propagation processing on the first intermediate parameter to obtain a second intermediate parameter; The first predicted power generation is outputted according to the second intermediate parameter through the output layer of the initial prediction model, a loss function is calculated for the first predicted power generation to obtain a loss value corresponding to the first predicted power generation, and the gradient of the loss function with respect to each model parameter in the initial prediction model is determined, and the model parameters of the initial prediction model are updated through the optimizer, wherein the model parameters include weights and biases.
10. The power generation prediction device according to claim 8, characterized in that: The training module is configured to: Inputting the test set into the converged initial prediction model to obtain a second predicted power generation output by the initial prediction model according to the test set; Determine a deviation value between the measured power generation corresponding to the test set and the second predicted power generation; When the deviation value is within the preset deviation interval, the initial prediction model is used as the power generation prediction model.
11. The power generation prediction device according to claim 8, characterized in that: The training module is configured to: According to the time series corresponding to the historical information, the historical information is filled to obtain a first data set; Determine a first median corresponding to the first data set, and respectively determine an absolute deviation value of each parameter in the first data set from the first median to obtain a first deviation set corresponding to the first data set; Determine a second median of the first deviation set, and remove abnormal parameters in the first data set according to the second median to obtain a second data set; Performing linear transformation processing on the second data set, scaling each parameter in the second data set to a range greater than or equal to 0 and less than or equal to 1, to obtain a target data set; The target data set is divided according to a preset allocation ratio to obtain a training set and a test set.
12. The power generation prediction device according to any one of claims 7 to 11, characterized in that: The power generation prediction device further includes a verification module, which is configured to: For each parameter in the meteorological data, the following process is performed multiple times: a first preset number of parameters are selected from the meteorological data as a first feature data set, a feature function is determined according to the first feature data set and the power generation, the parameter is added to the first feature data set to obtain a second feature data set, and a marginal contribution value between the parameter and the feature data set is determined according to the first feature data set, the second feature data set and the feature function; When a second preset number of marginal contribution values are obtained, determining an average value of the second preset number of marginal contribution values, and using the average value as the Shapley value of the parameter; The contribution degree of the parameter to the generated power is determined according to the Shapley value corresponding to each parameter.
13. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
14. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the method according to any one of claims 1 to 6.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.