A photovoltaic multi-scene generation and interpretable photovoltaic power prediction method
By establishing a joint distribution model and clustering algorithm for photovoltaic units, combined with Stacking structure and SHAP analysis, the interpretability problem of photovoltaic power prediction was solved, achieving more accurate and transparent photovoltaic power generation prediction and supporting the stable operation of the power system.
Patent Information
- Application Number
- CN202511332177.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-18
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-09-18
AI Technical Summary
Existing photovoltaic power prediction methods lack interpretability and are difficult to accurately characterize the complex correlations between multiple photovoltaic units, leading to difficulties in power system operation and management.
A joint distribution model of multiple photovoltaic units was established using kernel density estimation and the Frank-Copula function. Random power output scenarios were generated by combining the Monte Carlo method. Typical scenarios were extracted by the K-ISODATA clustering algorithm. A two-layer Stacking structure was used to predict the output power of photovoltaic power generation. Finally, the SHAP method was introduced for interpretability analysis.
It improves the accuracy and transparency of photovoltaic power generation forecasts, enhances the interpretability of models, and provides a more reliable basis for decision-making.
Smart Images

Figure CN120851298B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to a photovoltaic multi-scene generation and interpretable photovoltaic power prediction method, and belongs to the technical field of photovoltaic power prediction of electric power systems. BACKGROUND
[0002] With the deepening of global consensus on carbon emission reduction and green development, the proportion of photovoltaic power generation in the global energy structure continues to grow. However, the access of large-scale photovoltaic power generation poses new challenges to the operation and management of the electric power system. Photovoltaic power generation has the characteristics of significant randomness, intermittency and volatility. Its output power is affected by weather conditions, cloud cover and other factors, and presents strong uncertainty. This uncertainty makes it difficult to accurately predict and control the supply and demand balance of the electric power system, especially in a high-penetration photovoltaic environment, and traditional methods have been difficult to meet the requirements of safe and stable operation of the system.
[0003] At present, photovoltaic power prediction methods still have deficiencies in dealing with complex spatio-temporal correlation. Most existing prediction models lack interpretability, and the decision-making process is not transparent, making it difficult to gain trust. In terms of scene generation, existing methods mostly use simple probability distribution assumptions, which are difficult to accurately describe the complex correlation between multiple photovoltaic units. SUMMARY
[0004] The technical problem to be solved by the application is to provide a photovoltaic multi-scene generation and interpretable photovoltaic power prediction method, which comprehensively describes the uncertainty characteristics of photovoltaic power generation to provide more reliable decision-making basis for dispatching optimization, improves the accuracy of prediction, and improves the transparency and interpretability of the model.
[0005] The application adopts the following technical solutions to solve the above technical problems:
[0006] A photovoltaic multi-scene generation and interpretable photovoltaic power prediction method, comprising the following steps:
[0007] Step 1: Establish a joint distribution model of multiple photovoltaic units through kernel density estimation and Frank-Copula function, and sample the established joint distribution model through a Monte Carlo method to obtain photovoltaic unit random output scenes;
[0008] Step 2: Cluster the photovoltaic unit random output scenes obtained in step 1 through a K-ISODATA clustering algorithm to obtain a clustering result; extract the clustering center of each cluster as a typical photovoltaic unit output scene, and divide all the typical photovoltaic unit output scenes into a data set and divide them into a training set and a test set;
[0009] Step 3, a two-layer Stacking structure is used to predict the photovoltaic power output, a plurality of different types of base learners are used in the first layer, each base learner is trained by using a training set, and the test set is input into the trained base learners to obtain the prediction output of each base learner; the second layer uses linear regression as a meta-learner, and the prediction output of each base learner is used as the input of the meta-learner, and the prediction output of each base learner is optimized and integrated to obtain the final prediction result of the photovoltaic power output;
[0010] Step 4, the SHAP method is introduced, the marginal contribution of the training set and the base learner to the final prediction result is calculated, and the visualization explanation of the final prediction result of the photovoltaic power output is realized.
[0011] Compared with the prior art, the above technical scheme of the present application has the following technical effects:
[0012] 1. The present application proposes an improved Copula function to generate a multi-photovoltaic unit joint distribution model, which provides more accurate scene simulation; and an improved ISODATA clustering method is used to combine the efficiency of K-means and the adaptability of ISODATA, which not only maintains the stability and efficiency of the algorithm, but also realizes the reasonable dynamic adjustment of the number of clusters, thereby improving the accuracy of scene clustering and more comprehensively describing the uncertainty characteristics of photovoltaic power generation.
[0013] 2. The present application uses the Stacking regression method to improve the reliability and stability of prediction by integrating multiple base learners.
[0014] 3. The present application introduces the SHAP explainability analysis method to deeply understand the decision-making process of the model and the importance of each feature in prediction, and increases the transparency and explainability of the model. DETAILED DESCRIPTION
[0015] Figure 1 is the architecture diagram of the photovoltaic multi-scene generation and explainable photovoltaic power prediction method based on the present application;
[0016] Figure 2 is a three-dimensional distribution diagram of 500 photovoltaic unit output scenes generated based on the Frank-Copula function and the Monte Carlo method;
[0017] Figure 3 is a binary Frank-Copula distribution function diagram;
[0018] Figure 4 is 5 typical output scenes after clustering of photovoltaic output scenes;
[0019] Figure 5 is the probability of 5 typical output scenes;
[0020] Figure 6 This is a performance comparison of K-ISODATA and K-means clustering methods on DBI and DI metrics;
[0021] Figure 7 This refers to the predictive performance of the Stacking regression model on the training and test sets.
[0022] Figure 8 This is the classification confusion matrix of the Stacking regression model;
[0023] Figure 9 These are the SHAP analysis results of the base learners in the first layer of Stacking;
[0024] Figure 10 It is the distribution of SHAP values of input features at different times. Detailed Implementation
[0025] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0026] like Figure 1 As shown, this invention proposes a photovoltaic power prediction method based on multi-scenario generation and interpretability, the specific steps of which are as follows:
[0027] Step 1: Establish a joint distribution model of multiple photovoltaic units through kernel density estimation and Frank-Copula function, and use Monte Carlo sampling to form a random power output scenario of photovoltaic units;
[0028] Kernel density estimation method analyzes the relationship between sample points and target points. The proximity relationship is used to dynamically calculate the contribution of each sample to the probability density estimate. Specifically, it is assumed that the total number of photovoltaic units... Extracting historical output data If the distributions follow the same distribution and their true density function is unknown, then the output value is... The kernel density estimate at that location can be expressed as:
[0029] ,
[0030] in, In order to be in The kernel density estimate at that location, The amount of historical power output data for photovoltaic units. The window width parameter is used to control the smoothness. For kernel function, For the first Historical output data of individual photovoltaic units.
[0031] The optimal is obtained by minimizing the integrated mean square error (MISE)
[0032] ,
[0033] where is the integrated mean square error, is the weight matrix, is the true probability density function.
[0034] The present application introduces the Copula function, combines the marginal distribution of each variable, accurately describes the complex correlation such as nonlinearity and tail dependence, and is used to establish the joint distribution model of the photovoltaic unit.
[0035] The expression of the Copula function is:
[0036] ,
[0037] wherein, is the joint distribution function of the photovoltaic units; is the number of photovoltaic units; is the Copula connection function; is the marginal distribution function value of the photovoltaic unit, namely the kernel density estimation value.
[0038] The Frank-Copula is suitable for describing random variables with symmetric correlation, and is suitable for modeling the output correlation of photovoltaic units under the same meteorological conditions. It can simultaneously process positive correlation and negative correlation, and the calculation is simple, only one parameter is needed to control the correlation degree, and the parameter estimation is convenient.
[0039] The expression of the Frank-Copula function is:
[0040] ,
[0041] wherein, is the Frank-Copula function, is used to control the dependence degree between .
[0042] After establishing a joint distribution model among random variables using the Frank-Copula function, random sampling is performed using the Monte Carlo method. First, random numbers in the interval [0,1] are generated. Then, through the correlation model constructed using the Frank-Copula function, these random arrays are synthesized into values reflecting the dependencies between photovoltaic units. Finally, these values are converted into actual power values to generate random scenario data.
[0043] Step 2: The K-ISODATA clustering algorithm is proposed to dynamically adjust the number of clusters, optimize the selection of cluster centers, and extract typical scenarios to characterize the randomness and correlation of photovoltaic systems.
[0044] K-ISODATA is first initialized using the K-means clustering method. Cluster centers By prioritizing the selection of points with a wider distribution, the problem of local optima caused by random initialization is avoided.
[0045] Subsequently, by calculating the Euclidean distance from the sample (the random output scenario of the photovoltaic unit) to the cluster center, the sample is assigned to the nearest cluster:
[0046] ,
[0047] in, Indicates sample The assigned cluster number, Indicates the first One sample point, Indicates the first Cluster centers, Indicates finding smallest The value is used to find the nearest cluster center.
[0048] To avoid redundancy or noise interfering with the results, if the number of samples of a certain type... If so, the class is deleted and its samples are reassigned.
[0049] Calculate the intra-cluster distance for each cluster. and the average distance within the global class This is used to measure the tightness and distribution of clusters:
[0050] ,
[0051] ,
[0052] in, It is the global intra-class average distance, used to measure the tightness of all clusters; It is the number of clusters. It is the first Number of samples in each cluster It is the first Intra-cluster distances of clusters, It is the first The sample set in each cluster It is the first A sample from a cluster, It is the first Cluster centers of each cluster. It is a sample With cluster center The Euclidean distance between them.
[0053] when and At that time, split the cluster. Based on the dimension with the largest intra-cluster bias. This generates two new cluster centers:
[0054] ,
[0055] ,
[0056] in, For the first Clusters in dimensionality The sample bias vector on the map represents the one-dimensional bias value with the largest within-class bias. is the splitting coefficient.
[0057] If the distance between the two cluster centers Less than the set threshold If they are not clustered, they are merged, and the new cluster centers are calculated using a weighted average:
[0058] ,
[0059] in, It is the new cluster center after the merger. and They are clustering and clustering The number of samples in and It is clustering and clustering The original cluster centers.
[0060] After each iteration, the center points are recalculated and the intra-cluster structure is updated until the maximum number of iterations is reached or the change in the Euclidean distance of all cluster centers between two adjacent iterations is less than a set threshold.
[0061] The cluster center of each cluster is extracted as a typical output scene of the photovoltaic unit, all the typical output scenes of the photovoltaic units are taken as a data set, and a training set and a test set are divided.
[0062] Step 3: A two-layer Stacking structure is used to predict the photovoltaic power output, a first layer uses AdaBoost, XGBoost, CatBoost, random forest, gradient boosting tree, LightGBM and other base learners to independently model and generate prediction results, and a second layer uses linear regression as a meta-learner to optimize and integrate the prediction results.
[0063] The first layer of the Stacking structure includes multiple base learners of different types, and multiple base learners independently model the same training set. Each base learner uses different algorithms and methods to train the data and produces its own prediction results. The base learners used in the present application include AdaBoost, CatBoost, random forest, gradient boosting tree, XGBoost and LightGBM. These learners can capture different patterns and modes in the data during training. Each base learner independently trains the training data and generates prediction results. These prediction results reflect different features and patterns of the data and have complementarity.
[0064] In the second layer of Stacking, the prediction results of the base learners in step 2 are combined into a new "meta data set" and used as input for the meta-learner. The meta-learner generates the final prediction results by optimizing the outputs of the first layer models.
[0065] The meta-learner is designed to use a linear regression model, which can effectively and stably integrate the output results of different learners in the first layer and weight the contributions of each model through linear regression. Linear regression plays an important role in this structure, as it assigns appropriate weights to the prediction results of different models, allowing the final prediction to be more accurate after considering the advantages of each model.
[0066] Step 4: Introduce the SHAP method to calculate the marginal contribution of the base learners and input features to the photovoltaic power prediction model in step 2, and use visualization methods to analyze their importance and influence to maintain prediction performance while improving model interpretability.
[0067] The SHAP method is introduced, which is derived from the Shapley value theory in game theory and can calculate the marginal contribution of each feature to the model output, providing a more transparent model explanation framework.
[0068] In machine learning and deep learning, features can be seen as players in a game, and the model's output is the game's victory. SHAP considers all feature combinations as possible cooperative combinations, and calculates the Shapley value of each feature in each cooperative combination. The Shapley value represents the average contribution of each feature to different cooperative combinations. Finally, the contribution of each feature to the model output can be quantified by accumulating its contribution value. SHAP can determine which features are key features and how the model makes decisions, thereby improving the explainability of model decisions and the credibility of predictions. The core idea is to calculate the marginal contribution of each feature and fairly distribute the model prediction results.
[0069] The calculation steps of the Shapley value of each base learner are as follows:
[0070] 1) Select a reference point, usually the expected output of the model or the average value of the training data, to calculate the gradient and estimate the Shapley value.
[0071] 2) For a given input data point and reference point, calculate the gradient of the output relative to the reference point. The gradient represents the local change of the model near the input data point, and the calculation formula is as follows:
[0072] ,
[0073] where, is the gradient of the base learner model, is the output of the base learner model, is the input feature data, i.e. the typical output scenario data of photovoltaic units in the training set.
[0074] 3) The influence of each feature data on the model output can be obtained by multiplying the gradient with the difference between the input data point and the reference point, and the calculation formula is as follows:
[0075] ,
[0076] where, is the SHAP value of the th photovoltaic unit typical output scenario data, is the reference point.
[0077] 4) Add the Shapley values of all feature data to obtain the influence of each feature data on the model output:
[0078] ,
[0079] where, represents the SHAP value of the th base learner.
[0080] The application will be described below with a specific embodiment.
[0081] Firstly, the joint distribution model of multiple photovoltaic units is established by kernel density estimation and Frank-Copula function, and 500 photovoltaic unit output scenarios are generated by sampling the joint distribution model using the Monte Carlo method. The generated scenarios are shown in Figure 2 The scenario data generated by Frank-Copula is uniformly distributed and covers the possibility of multiple units at different output levels. Figure 3 The joint distribution between two photovoltaic units is shown, reflecting their correlation. Combined with the K-ISODATA clustering algorithm, 5 typical scenarios are extracted, Figure 4 The clustering results are shown. Photovoltaic scenarios mainly show significant daytime output characteristics, and the clustering centers reflect typical output patterns under different weather conditions such as sunny, cloudy and overcast. Figure 5 The appearance probability of the 5 clustering scenarios is shown. The K-ISODATA algorithm optimizes the sample complexity by dynamically adjusting the number of clusters, ensuring that each clustering result is representative and the data size is simplified, facilitating subsequent regression prediction and interpretability analysis. Figure 6 The performance of K-ISODATA and traditional K-means clustering method in Davies-Bouldin Index (DBI) value and Dunn Index (DI) value is compared. The results show that K-ISODATA is superior to K-means in reducing intra-class distance and increasing inter-class distance, and has significant advantages in optimizing clustering tightness and separation degree.
[0082] Subsequently, the Stacking structure is used for regression prediction. The first layer uses base learners such as AdaBoost, XGBoost, CatBoost, random forest, gradient boosting tree, LightGBM, and the second layer integrates the output through linear regression as a meta-learner to improve prediction accuracy. Figure 7 The prediction performance of the Stacking regression model on the training set and test set is shown. The training set has a MAE of 0.13, and the predicted value is highly consistent with the actual value; the test set has a MAE of 0.24, verifying the stability and generalization ability of the model on different data sets. Figure 8 The classification confusion matrix shows that the model performs well in the classification of typical scenarios, especially for classes B and C, with 28 and 26 correctly classified samples respectively. Class A also correctly classifies 25 samples, verifying the reliability of the model in multi-class data processing.
[0083] Finally, the contribution of base learners and input features is analyzed by SHAP method.Figure 9 The SHAP analysis results of the first layer of each basic model are shown, revealing the contribution of each learner to the prediction, indicating that the cooperation of each model effectively improves the regression accuracy. Figure 10 The SHAP value distribution of each time feature is shown, revealing the contribution of different time periods to photovoltaic power generation prediction, especially the influence of key features in the core period of the day on the prediction result. The overall analysis shows that the stacking regression model can accurately capture the key features of photovoltaic power generation and provide reliable prediction support.
[0084] Based on the same inventive concept, the embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to realize the steps of the aforementioned photovoltaic multi-scene generation and interpretable photovoltaic power prediction method.
[0085] Based on the same inventive concept, the embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the steps of the aforementioned photovoltaic multi-scene generation and interpretable photovoltaic power prediction method.
[0086] Those skilled in the art will understand that embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0087] The present application is described with reference to flowcharts according to the method, device (system), and computer program product of the embodiments of the present application. It should be understood that each flow in the flowchart and the combination of the flows in the flowchart can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices produce a device that implements the functions specified in the flow Figure 1 The device specified in one flow or multiple flows.
[0088] These computer program instructions can also be stored in a computer-readable memory that can guide the computer or other programmable data processing devices to work in a specific way, so that the instructions stored in the computer-readable memory produce a manufactured product including instruction devices that implement the functions specified in the flow Figure 1 The device specified in one flow or multiple flows.
[0089] These computer program instructions can also be loaded into a computer or other programmable data processing devices, so that a series of operational steps are performed on the computer or other programmable data processing devices to generate a computer implemented process, so that the instructions executed on the computer or other programmable data processing devices provide a process for implementing the flowchart Figure 1 Figure 1 The steps of the functions specified in the flowchart or flowcharts.
[0090] The above embodiments are only to illustrate the technical idea of the present application, and cannot limit the protection scope of the present application. Any modification made according to the technical idea of the present application on the basis of the technical scheme falls within the protection scope of the present application.
Claims
1. A method for photovoltaic multi-scenario based generation and interpretable photovoltaic power prediction, characterized in that, The method comprises the following steps: Step 1, a joint distribution model of multiple photovoltaic units is established by kernel density estimation and Frank-Copula function, and the joint distribution model is sampled by a Monte Carlo method to obtain photovoltaic unit random output scenarios; Step 2, the photovoltaic unit random output scenarios obtained in step 1 are clustered by a K-ISODATA clustering algorithm to obtain clustering results; a clustering center of each cluster is extracted as a photovoltaic unit typical output scenario, all photovoltaic unit typical output scenarios are taken as a data set, and the data set is divided into a training set and a test set; the specific process is as follows: The K-means clustering method is used to cluster the random output scene of the photovoltaic unit obtained in step 1, and a cluster center is obtained. The K-means clustering method yields The initial cluster centers are selected as the initial cluster centers for the ISODATA algorithm, and the algorithm iterates through them. During each iteration of the ISODATA algorithm, the following operations are performed: After each iteration is completed, the clustering centers of the clusters are recalculated until a maximum number of iterations is reached or the variation amplitudes of all clustering centers between adjacent two iterations are all less than a third preset threshold, that is, when the Euclidean distances between the clustering centers obtained by adjacent two iterations are all less than the third preset threshold for each cluster, the iteration is ended; in, Indicates the first A scenario where a photovoltaic unit randomly outputs power. express The assigned cluster number, Indicates the current number Cluster centers; Indicates finding smallest Value, that is, finding the value with The nearest cluster center; According to the Euclidean distance, a cluster is obtained If the number of random output scenarios of photovoltaic units in a cluster is less than a first preset threshold , the cluster is deleted, and the random output scenarios of photovoltaic units in the deleted cluster are redistributed. When the number of random output scenarios of photovoltaic units in all clusters is greater than or equal to a first preset threshold value , the intra-cluster distance and the global intra-cluster average distance are calculated. wherein, is the intra-cluster distance for the th cluster, is the number of photovoltaic plant random output scenarios in the th cluster, is the set of photovoltaic plant random output scenarios in the th cluster, denotes a photovoltaic plant random output scenario belonging to the set is the number of clusters. If a cluster exists and , split the cluster, generate two new cluster centers and and according to the dimension with the largest intra-cluster variance. wherein, is a splitting factor, is the deviation vector of the th cluster in dimension . The distance between any two cluster centers is calculated, and if the distance between two cluster centers is less than a second preset threshold , the clusters corresponding to the two cluster centers are merged, and the cluster center after merging is calculated by weighted average wherein, and are clusters of and clusters of the number of random output scenarios of photovoltaic units in and are clusters of and clusters of the number of random output scenarios of photovoltaic units in Step 3, a two-layer Stacking structure is used to predict photovoltaic power output, a plurality of base learners of different types are used in the first layer, each base learner is trained by using the training set, and the test set is input into the trained base learners to obtain the prediction outputs of the base learners; a linear regression is used as a meta-learner in the second layer, the prediction outputs of the base learners are taken as inputs of the meta-learner, the prediction outputs of the base learners are optimized and integrated to obtain a final prediction result of the photovoltaic power output; Step 4, a SHAP method is introduced to calculate marginal contributions of the training set and the base learners to the final prediction result, and a visualized explanation of the final prediction result of the photovoltaic power output is realized; In step 4, the SHAP calculation process of each base learner is as follows: 3) SHAP values of each photovoltaic unit typical output scenario data in the training set are calculated: 1) The first The expected output of each base learner or the average value of typical output scenario data of photovoltaic units in the training set can be used as a reference point; 2) Compute the gradient of the i-th base learner based on the training set and the predicted output of the i-th base learner. base learners. wherein, is a gradient of the base learner model, is a prediction output of the th base learner, is a photovoltaic plant typical output scenario data in the training set; In step 1, the joint distribution model of the multiple photovoltaic units is as follows: wherein, SHAP values for the typical power production scenario data of the SHAP values for the typical power production scenario data of the reference point; 4) Add the SHAP values of all photovoltaic unit typical output scene data to obtain the SHAP value of the first base learner : wherein, is the number of typical power production scenarios data for all photovoltaic units in the training set.
2. The photovoltaic multi-scenario based generation and interpretable photovoltaic power prediction method according to claim 1, characterized in that, The formula of the kernel density estimation value is: wherein is a Frank-Copula function, is the number of photovoltaic units, denotes the value of the edge distribution function, i.e. the kernel density estimate, of the th photovoltaic unit, is a parameter for controlling the degree of dependence between the kernel density estimates . In step 3, the plurality of base learners of different types include AdaBoost, CatBoost, random forest, gradient boosting tree, XGBoost and LightGBM. wherein, is a window width parameter for controlling the smoothing degree, is the number of historical power data of the th photovoltaic unit, is a kernel function, is a pre-set photovoltaic power value, is the th historical power data of the th photovoltaic unit; optimal By minimizing the integral mean square error, the integral mean square error formula is as follows: wherein, is the integral mean square error, is the weight matrix, is the true probability density function.
3. The photovoltaic multi-scenario based generation and interpretable photovoltaic power prediction method according to claim 1, characterized in that, The processor executes the computer program to realize the steps of the photovoltaic multi-scenario generation and interpretable photovoltaic power prediction method according to any one of claims 1 to 3.
4. A computer device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, The computer program is executed by the processor to realize the steps of the photovoltaic multi-scenario generation and interpretable photovoltaic power prediction method according to any one of claims 1 to 3.
5. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 4.
Citation Information
Patent Citations
Photovoltaic power station typical scene generation method based on multi-scene model
CN112541546A
Direct current power distribution network distribution robust optimization scheduling method based on deep learning assistance
CN117394444A