Photovoltaic array multi-working-condition mode identification method based on Stacking and interpretability analysis
By constructing a multi-condition pattern recognition method for photovoltaic arrays based on Stacking and interpretability analysis, and combining LightGBM, RF and XGBoost base learners, and using SHAP and LIME methods for interpretation, the problems of low accuracy and insufficient interpretability in photovoltaic array fault identification are solved, and high-precision and transparent fault diagnosis is achieved.
Patent Information
- Application Number
- CN202511354778.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-22
- Publication Date
- 2026-01-09
AI Technical Summary
Existing photovoltaic array fault identification methods have low accuracy and lack interpretability under multi-category, small-sample operating conditions. Traditional integrated models are difficult to meet the photovoltaic system's need for transparent decision-making.
A stacking-based and interpretability analysis approach is adopted to construct a multi-dimensional photovoltaic array operation feature matrix. LightGBM, RF and XGBoost base learners are combined and fused through logistic regression. SHAP and LIME methods are introduced for global and local interpretation to improve the accuracy and transparency of identification.
It effectively improves the accuracy and robustness of multi-condition identification of photovoltaic arrays, enhances the interpretability of the model, and increases the trust and transparency of operation and maintenance personnel.
Smart Images

Figure CN121302143A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of photovoltaic array fault identification technology, specifically to a method for identifying multiple operating modes of photovoltaic arrays based on Stacking and interpretability analysis. Background Technology
[0002] As the scale of photovoltaic power generation continues to expand, photovoltaic arrays are susceptible to various factors such as shading, pollution, and aging during long-term operation, often leading to problems such as abnormal electrical output and decreased efficiency. To ensure system stability and economy, it is necessary to establish an efficient and accurate fault diagnosis mechanism to achieve timely identification and response to multiple types of faults under complex operating conditions.
[0003] Currently, photovoltaic (PV) array faults can be broadly categorized into several types, including shading faults, pollution faults, wiring faults, and aging faults. While these faults exhibit certain variations in system operating parameters, the parameter characteristics of different fault types often overlap, leading to limitations in the accuracy and generalization ability of traditional single-classification methods. In recent years, with the development of machine learning technology, researchers have attempted to model and classify PV faults using various single models, such as decision trees, support vector machines, and neural networks. Although these methods have achieved some success on specific tasks, their simple structure, limited generalization ability, susceptibility to data noise in practical applications, and difficulty in handling complex multi-class fault scenarios make them challenging to address.
[0004] To address the aforementioned issues, ensemble learning methods have been gradually introduced into the field of photovoltaic (PV) fault identification. These methods improve the accuracy and robustness of diagnosis by fusing predictions from multiple models, exhibiting particularly good performance when handling various operating conditions. However, ensemble models are typically complex in structure, with high training and deployment costs. Furthermore, these methods generally lack the ability to explain the internal decision-making logic of the model, making them "black box" models. It is difficult to clearly identify the characteristic sources of the model's judgment criteria, reducing the trust of maintenance personnel in the diagnostic results. In addition, most current ensemble models focus more on performance improvement, often neglecting the interpretability and traceability of the results, thus limiting their widespread application in PV intelligent operation and maintenance scenarios.
[0005] In practical applications, the interpretability of operating condition identification models is crucial for improving the acceptance and trust of maintenance personnel. Traditional ensemble models struggle to explain the impact of each input feature on the classification results, failing to meet the transparent decision-making requirements of photovoltaic systems. Therefore, interpretability methods have gained increasing attention in recent years. Typical methods such as Shapley Additive Explanations (SHAP) and Local Interpretable Model-agnostic Explanations (LIME) can analyze the model's prediction process, quantify the impact of input features on the prediction results, and thus improve the credibility and transparency of the model's output. Summary of the Invention
[0006] To address the issues of decreased accuracy and insufficient model interpretability in identifying photovoltaic (PV) arrays under multiple operating conditions with small sample sizes, this invention proposes a multi-condition pattern recognition method for PV arrays based on Stacking and interpretability analysis. This method deeply derives the original monitoring data at the feature engineering level and constructs a tree-based Stacking architecture. Simultaneously, it introduces global and local interpretation mechanisms to mitigate the impact of environmental fluctuations and sample imbalance on the recognition results, thereby improving the accuracy and reliability of PV array operating condition identification.
[0007] The technical solution adopted in this invention is as follows: A method for recognizing multiple operating modes of photovoltaic arrays based on Stacking and interpretability analysis includes the following steps: Step 1: Construct a multidimensional photovoltaic array operation characteristic matrix including original values, first-order differences, curvature, normalized values, and exponential moving average ratios; Step 2: Normalize the multidimensional photovoltaic array operation feature matrix constructed in Step 1; divide the normalized feature matrix and its corresponding label set into datasets; Step 3: Based on the K-fold cross-validation mechanism, construct the Stacking learning framework, select LightGBM, RF and XGBoost as base learners, and LR as meta learner to build a multi-condition pattern recognition model; Step 4: Based on the multi-condition pattern recognition model constructed in Step 3, with the maximum F1 score as the optimization objective, the Optuna Bayesian search algorithm is used to jointly tune the key hyperparameters of each base learner and the weights of the fusion layer; and the optimized model is cross-validated to evaluate its comprehensive performance. Step 5: Based on the optimal multi-condition mode recognition model obtained in Step 4, reason about the test data to realize the recognition of multi-condition modes, evaluate the diagnostic performance using multi-dimensional indicators, and analyze the reasons for misjudgment of condition modes using confusion matrix. Step 6: Combine the SHAP method to analyze the global feature contribution, identify the main influencing factors, and use the LIME method to perform local interpretability analysis on a single predicted sample to verify the rationality and traceability of the identification results.
[0008] In step 1, based on the electrical mechanism of the photovoltaic array, starting from the original monitoring data such as voltage, current and power output by the photovoltaic array components, a multi-dimensional photovoltaic array operation characteristic matrix is constructed, including the original values, first-order difference, curvature, normalized quantity, short-term / long-term power EMA and ratio, and instantaneous fill factor. Derived features were constructed from the following six aspects and used as input variables for the multi-condition pattern recognition model. ①. Transient mutations caused by first-order difference extraction faults: (1); In formula (1): For a moment Electrical quantities (voltage, current, or power); The electrical quantity from the previous moment; This is a first-order difference result, used to characterize instantaneous abrupt changes; ②. Using the slope and curvature of the I–V curve to characterize nonlinear variation features: (2); In formula (2): For photovoltaic array current; The voltage of the photovoltaic array; The slope of the I–V curve; Let be the curvature of the I–V curve; ③. Eliminate the influence of environmental factors through normalization and filler factors: (3); In formula (3): These are the raw electrical quantities (voltage, current, or power). This is the minimum value of the electrical quantity within the sampling interval; This represents the maximum value of the electrical quantity within the sampling interval; This is the result after normalization; ④. Calculate the EMA ratio of short-term and long-term currents to distinguish between sudden and gradual faults: (4); In equation (4): For a moment The original signal; It is a smoothing factor; Weights are assigned to historical data; For a moment The exponential moving average; It is the exponential moving average of the previous moment; It is a short-term EMA; For long-term EMA; This is the ratio of the short-term EMA to the long-term EMA. ⑤. Introduce a range index within a sliding window to identify local electrical fluctuations: (5); In equation (5): For a moment Electrical quantities; The length of the window; The maximum value within the window; The minimum value within the window; This is a range indicator, reflecting local fluctuations; The current moment in the time series; ⑥. Measure the overall operating efficiency of the array using the fill factor performance index: (6); In formula (6): This is the power at the maximum power point; This is the open-circuit voltage; This is the short-circuit current; The fill factor measures the efficiency of photovoltaic modules. Assume the photovoltaic array at time... Extracted to the following One characteristic: First-order difference characteristic Slope and curvature of the I-V curve Normalization results Power short-term / long-term EMA and ratio Instant fill factor Local range index ; exist At time t, the feature vector is: After sliding collection over a long time series, a multidimensional feature matrix is obtained: (7); In equation (7): This is a multidimensional photovoltaic array operation characteristic matrix; For at any time The extracted first The numerical values of each feature; This represents the sampling length of the time series. The dimension of the feature; As shown in Table 2, the output targets are common in the system. The types of photovoltaic array operating conditions are shown in Table 3.
[0009] In step 2, the multidimensional photovoltaic array operating feature matrix is normalized to eliminate dimensional differences between different features. Let the original feature matrix be denoted as: (8); In equation (8): This is the original feature matrix; for 0 real matrix; The number of samples; Indicates the feature dimension; (9); In equation (9): The feature vector of the sample; They represent the first The 1st, 2nd, ..., dth features of each sample; (10); In formula (10): Indicates the first The sample mean of each feature; For the first The sample at the th The original values of each feature dimension; The number of samples; (11); In equation (11): Indicates the first The standard deviation of each feature; The number of samples; (12); In equation (12): These are the normalized standard values; Indicates the first The standard deviation of each feature; For the first The sample at the th The original values of each feature dimension; After normalization, the normalized feature matrix and its corresponding label set are divided into 9 categories: F0–F2 indicate normal (clean / dirty / shaded); F3–F5 indicate fading (cleaning / dirt / shading); F6–F8 indicate cracks (clean / dirty / shaded); To ensure the balance of training and the objectivity of evaluation, a tiered randomization strategy is adopted, based on... The proportions are divided into training set and test set. This represents the proportion of the training set to the total dataset.
[0010] In step 3, a multi-condition pattern recognition model is constructed using a stacking strategy. By integrating multiple complementary base learners and introducing a meta-learner for high-level weighted fusion, the recognition accuracy of multiple conditions is improved.
[0011] The multi-condition pattern recognition model consists of two layers: the first layer uses LightGBM, XGBoost and RF as base learners to extract multi-angle discrimination information; the second layer uses LR as a meta learner to perform weighted fusion of the output results of the base learners.
[0012] The overall input of the multi-condition pattern recognition model is a normalized photovoltaic feature vector, and the output is the predicted probability of each condition category. (13); In equation (13): The input feature vector; For the first Each operating condition category; To provide given input features Under the condition that the sample belongs to category The probability of; For the model to class The rating; To perform exponential calculations on the scores, ensuring that the probability is non-negative; The sum of indices for all categories is used for normalization; This represents the total number of operating condition categories; For category index variables; In step 3, the normalized training dataset is: , For the first one sample 3D input features; For the corresponding photovoltaic array operating condition label; Number of categories; The number of samples; The first layer contains Base learners: LightGBM, XGBoost, and RF; Each base learner is used for input samples Output The probability distributions for each type of fault are as follows: (14); In equation (14): For the first Each base learner on samples Output Class probability vector; For the first Model function for each base learner; for A real vector space.
[0013] LightGBM is an efficient gradient boosting model based on GBDT, which introduces GOSS (Gradient-based One-Side Sampling) and EFB (Exclusive Feature Bundling) mechanisms. Its objective function is: (15); In equation (15): The training objective for LightGBM; Cross-entropy loss; Output for the model; This is a regularization term used to control model complexity; XGBoost optimizes the loss function using second-order derivative expansion and incorporates a regularization term to control model complexity. Its loss function is: (16); In equation (16): For the first The locally expanded expression of the loss function for each tree; For the first The model function for the tree; For loss function pairs The first derivative of is the gradient term; For loss function pairs The second derivative of is the curvature term; For the first The structural regularization term of a tree; In the first In the first round of boosting Tree samples The predicted output; (17); In equation (17): For the first The true label of each sample; For the front Tree samples The cumulative prediction output; Indicates sample The loss between the predicted value and the actual value; (18); Random Forest (RF) is a typical ensemble learning method. Its basic process includes random sampling of training samples, parallel construction of decision trees, and majority voting fusion of results. Specifically, the algorithm constructs multiple subsets of samples from the original data using bootstrap sampling, and trains a decision tree independently in each subset. During tree construction, each node is randomly selected from only a subset of features for splitting, thereby enhancing the diversity of the model. Finally, the prediction result for the test sample is determined by voting on the classification results of all trees, yielding the final output. A diagram of the Random Forest principle is shown below. Figure 5 As shown, it has advantages such as high training efficiency and strong resistance to overfitting, and is suitable for classification tasks with complex features and diverse patterns, such as photovoltaic array operating conditions.
[0014] (19); In equation (19): For the first The samples were provided by LightGBM. 3D class probability vector; For LightGBM samples The original score, with dimensions as ; This is a function to convert the score vector into a probability vector; (20); In equation (20): For the first The samples are provided by XGBoost. 3D class probability vector; For XGBoost samples The original score, with dimensions as ; (twenty one); In equation (21): For the first The samples were provided by LightGBM. 3D class probability vector; For the first The predicted probability vector of each tree for a sample. The number of trees; Equations (19) to (21) above represent the classification output probabilities of each base learner for a sample.
[0015] In step 3, to avoid the second-layer LR using data that overlaps with the base learner, five-fold cross-validation is employed. The training set and out-of-fold (OOF) strategy. Divided into For the first Fold, first use Train three types of base learners, and then... Generate the OOF probability, where: For training set; For the first Fold the validation set.
[0016] (twenty two); In equation (22): For the first Each base learner on samples OOF probability vector; For use The first training One model; After five rounds of iteration, the OOF results for all samples are obtained, and then: (twenty three); In equation (23): For three base learners to pair samples The meta-feature vector formed by concatenating the OOF probability vectors column by column is used to train the two-layer meta-model. as a base learner for samples The softmax probability output; Here is the OOF probability vector for LightGBM; This is the OOF probability vector of XGBoost; This is the OOF probability vector of the random forest (RF); for 3D real vector space; As the training input for the second layer of logistic regression, it ensures that there is no information leakage.
[0017] (twenty four); In equation (24): , These are the weight vector and bias term of the logistic regression model, respectively.
[0018] In step 3, accuracy (Ac) and F1 score (F1) are set as evaluation indicators for the multi-condition pattern recognition model, respectively measuring the overall classification accuracy and the balance of recognition among multiple categories. (25); (26); (27); (28); In the formula: The total number of samples; Predict labels for the model; This is a real label; For indicator functions; Number of operating condition categories; , The first Precision and recall for each class; They represent the first The number of true positives, false positives, and false negatives for each class. Through joint evaluation of accuracy and F1, the overall and fine-grained classification performance of the model can be effectively characterized, providing a foundation for misclassification analysis and interpretive modeling in subsequent steps.
[0019] In step 4, the Optuna optimization framework is introduced, and a Bayesian optimization strategy is used to automatically search for the optimal hyperparameter combination. Optuna constructs a posterior probability model of the objective function (usually a Tree-structured Parzen Estimator, TPE), and samples the most promising parameter region based on historical experimental information, balancing exploration and convergence speed. The learnable parameters of the model are continuously updated during training. The "inner layer" optimization differs from the hyperparameter optimization. The determination of this belongs to the "outer layer" optimization. The inner layer parameter optimization function expression is: (29); In equation (29): These are the learnable parameters of the model; To give hyperparameters again The optimal model parameters that minimize training loss are determined below. For hyperparameters; For model mapping functions; The loss function for the training set; These are the training set features and labels, respectively. For in variable Take the value that minimizes the objective. The outer parameter optimization expression is: (30); In equation (30): The optimal combination of hyperparameters; For the hyperparameter search space; The loss function for the validation set; These are the validation set features and labels, respectively. It is the given in the above formula The optimal parameters were obtained. In search space Internal selection minimizes the verification loss. .
[0020]
[0021] To further enhance the expressive power of the fusion structure, a fusion weight adjustment mechanism is introduced in the second-layer meta-learner. The probability outputs of the three base learners for the same input sample... The inputs can be combined into a fusion input using a weighted average method; (31); In equation (31): ; Weights are assigned to the outputs of the three base learners. The combination of these weights is determined through an optimization algorithm or by having the meta-learner fit the relative importance of different model outputs in the final discrimination using vector concatenation.
[0022] With maximizing M-F1 as the objective function, it is defined as: (32); In equation (32): In order to make The optimal hyperparameter that yields the maximum value; To be in a given hyperparameter The macro F1 obtained according to the established verification strategy; The vector of hyperparameters to be tuned includes the learning rate, depth, number of trees, number of leaves, subsampling rate of LightGBM / XGBoost / RF, and the regularization coefficients of the two-layer LR.
[0023] A Bayesian surrogate model was constructed using Optuna's built-in TPE sampler. The hyperparameter combinations and performance indicators recorded in each round of experiments were updated, and the hyperparameters for the next round were sampled based on the expected improvement values.
[0024] (33); (34); (35); (36); In the above formula: For hyperparameter vectors; The goal is to minimize; For a given The macro average F1 index; For the first Hyperparameter experiments; For the first The hyperparameter vector for this experiment; The objective function value obtained from a single trial; For the first The target value for this experiment; for quantiles; The corresponding threshold; A set of historical trials categorized as "good" or "bad" based on a threshold. These are the two agent densities for TPE; This is the candidate set obtained by sampling from the "good" distribution; Hyperparameters for the next round of evaluation; The independent variable that maximizes the objective; Indicates from the 1st to the 2nd The target values collected in this experiment; This indicates that when the target value is less than a certain threshold Distribution of time-sensory hyperparameters; This means that when the target value is greater than or equal to a certain threshold... Distribution of time-sensory hyperparameters; This represents the set of candidate hyperparameters.
[0025] In step 5, the optimized model is used to test the test data, and each sample... The posterior probability vectors for the nine working conditions are given below: (37); (38); In the formula: Indicates the first The posterior probability vector of each sample; Based on the principle of maximum probability; Operators that determine the value of the independent variable to maximize the target; For the index of the sample; For the first One sample; Indicates the first Each sample belongs to category The probability of; Indicates the first Each sample belongs to category The probability of; Indicates the first Each sample belongs to category The probability of; In step 5, the multi-dimensional metrics used to evaluate the multi-condition pattern recognition model include: Accuracy (Ac), Macro Precision (MP), Macro Recall (MR), and Macro Average M-F1. (39); In equation (39): The number of samples that are correctly predicted as positive. The number of samples that are correctly predicted as negative; The number of samples that were incorrectly predicted as positive but were actually negative. The number of samples that were incorrectly predicted as negative when they were positive. Total number of categories; For the first The number of samples in the class that were correctly predicted; The first The number of samples in a class that were misclassified as that class and the number of samples that were misclassified as other classes; The first Precision and recall of a class.
[0026] In step 5, for the 9-class classification scenario (C=9), first, a confusion matrix is calculated to describe the transition relationship from "true class to predicted class"; then, row normalization is performed to obtain the probability from "true to predicted", and the recall / false positive rate of each class is directly read. Further, for each true class, the most common false positive channel (which class it is most frequently confused into) is identified, and column normalization is used to obtain the precision, thereby locating the class pairs that need priority improvement. (40); (41); (42); (43); In the formula: For sample index; For the first The predicted category for each sample; Indexed by category; Total number of categories; For the model to sample Category The predicted probability; The independent variable that maximizes the objective; The total number of samples; For the first The true category of each sample; The transition probability after row normalization; For the truth However, it was predicted to be The number of times; For indicator functions; To sum over all samples; For the truth The total number of samples; For all prediction categories Summation; Recall rate, i.e., the true value of The probability of being correctly identified; For accuracy; that is, judged as In the sample, it really is The proportion; For the first Synthesis of columns; For the truth However, the overall probability of being judged incorrectly.
[0027] In step 6, regarding global interpretation, the SHAP value method is used to quantify the overall impact of each input feature on the prediction result. The specific calculation formula is as follows: (44); In equation (44): Representation of features SHAP contribution value; For the entire set of input features; For features not included A subset of; Representing a feature subset The predicted output is as follows; For the interpreted feature index; Indicates that only feature subsets are enabled. and At that time, the expected output of the model; Indicates in subset Add features based on A set; Indicates that only features are included. A collection of single elements; Represents a set cardinality factorial; Indicates removal and The factorial of the number of residual features; Represents the complete feature set factorial; Indicates from all features Remove from middle A set; For local interpretation, the LIME method is used to interpret individual prediction results. LIME approximates the local behavior of the original model by generating perturbation samples in the neighborhood of the predicted sample and fitting an interpretable linear model. A series of perturbation samples are generated near the sample to be interpreted, the original model is used to predict them, and then a simple local model is trained to approximate the performance of the original model in that neighborhood. The optimization objective function is: (45); In equation (45): This is the original black box model; It is a locally interpretable model; This represents the fitting error between the original model and the explanatory model in the neighborhood. Used to measure the difference between samples in the neighborhood and the sample to be explained. Similarity; This is a regularization term that constrains the complexity of the explanatory model; To find the model that minimizes the objective.
[0028] This invention provides a method for recognizing multiple operating modes of photovoltaic arrays based on Stacking and interpretability analysis, with the following technical advantages: 1) This invention enhances the model's responsiveness to various photovoltaic operating conditions by constructing 16-dimensional electrical and physical features, effectively improving recognition accuracy and robustness.
[0029] 2) This invention uses LightGBM, RF, and XGBoost to construct a Stacking fusion structure, and introduces five-fold cross-validation and out-of-fold strategies to effectively alleviate overfitting and adapt to unbalanced scenarios under multiple operating conditions.
[0030] 3) This invention combines Bayesian optimization to jointly tune the hyperparameters of the base learner and the fusion weights, thereby improving model performance and avoiding the low efficiency and local optima problems caused by traditional grid search.
[0031] 4) This invention improves diagnostic transparency by integrating global and local interpretability analysis methods to reveal the criteria for model discrimination at the feature level. Attached Figure Description
[0032] The present invention will be further described below with reference to the accompanying drawings and embodiments: Figure 1 This is a flowchart of the photovoltaic array operating condition identification method of the present invention.
[0033] Figure 2 The confusion matrix is used to identify operating conditions.
[0034] Figure 3 This is a schematic diagram illustrating the importance ranking of multi-class features in the ensemble model SHAP.
[0035] Figure 4 The LIME feature weight distribution under different operating conditions.
[0036] Figure 5 This is a diagram illustrating the principle of a random forest. Detailed Implementation
[0037] This invention discloses an interpretable multi-model fusion method for recognizing multiple operating conditions of photovoltaic arrays. This method analyzes historical electrical data such as voltage and current collected during the operation of the photovoltaic system to extract key derived features reflecting typical faults such as component aging, pollution, and shading, thereby intelligently assessing the operating status of the photovoltaic array. The method is based on Stacked Generalization (Stacking) learning theory, using the predicted probabilities output by three types of tree models—Light Gradient Boosting Machine (LightGBM), Random Forest (RF), and Extreme Gradient Boosting (XGBoost)—as input to the meta-model. These probabilities are then combined using Logistic Regression (LR) to construct a discriminative model for photovoltaic operating conditions. The model is then used to identify the operating conditions of the samples to be tested, obtaining specific operating condition category predictions. The marginal contribution of each feature to the model's decision is analyzed using the Shapley Additive Explanations (SHAP) method and Local Interpretable Model-agnostic Explanations (LIME), determining the causal relationship between key features and operating conditions. To further verify the reliability and practicality of this method, the operating condition identification performance is compared and analyzed using actual photovoltaic module experimental data. This invention employs multiple original and derived electrical features constructed based on the operating mechanism of photovoltaic modules and implements operating condition identification within an ensemble learning framework. The model prediction mechanism is explained using interpretability algorithms. Detection results show that this method has good accuracy and interpretability in multi-operating condition identification.
[0038] A method for recognizing multiple operating conditions of photovoltaic arrays based on Stacking and interpretability analysis is proposed. Addressing the challenges of complex operating conditions and high recognition difficulty in photovoltaic systems due to environmental disturbances and component aging, this method offers a recognition process that combines high accuracy, strong generalization ability, and interpretability. The method comprises six steps: feature construction, data preprocessing, model construction, parameter optimization, operating condition recognition, and interpretability analysis, as detailed below: 1) Feature Construction: Raw data such as voltage, current, and power output from the components are collected. Combined with electrical mechanisms, a 16-dimensional feature set is constructed, including raw values, first-order differences, curvature, normalized values, fill factor, EMA ratio, and window range. This design enhances the model's ability to distinguish faults such as shading, pollution, and aging, and improves the physical interpretability and sensitivity of the input features.
[0039]
[0040] 2) Data preprocessing: Interpolation and filtering are used to repair missing data and remove noise. Features are uniformly normalized to eliminate the influence of units. The dataset is divided into training and test sets in a 7:3 ratio, and the distribution of work condition categories is kept consistent to ensure the fairness and generalization ability of the model evaluation.
[0041] Table 3. Working Condition Category and Label Mapping Table
[0042] 3) Model Construction: A Stacking-based learning model was constructed. The first layer integrates the class prediction probabilities output by three base learners: LightGBM, RF, and XGBoost. The second layer uses LR as the meta-learner to fuse the results. Five-fold cross-validation and out-of-fold strategies were introduced to utilize information from unleashed labels to generate the second-layer input, enhancing the stability and accuracy of the fusion structure. Accuracy and M-F1 were used as the main evaluation metrics.
[0043] 4) Hyperparameter optimization: The Optuna Bayesian optimization framework is adopted, with M-F1 as the objective function, to jointly tune the key parameters of the base learner and the fusion layer. The TPE sampling strategy is combined to improve the search efficiency and achieve the optimal configuration combination of the fusion model.
[0044] 5) Fault Identification and Assessment: An optimized fusion model is used to infer the test data, outputting the posterior probabilities of nine operating conditions at each time point. The category corresponding to the highest probability is selected as the final identification result. For assessment, the M-F1 score is used as the primary indicator, supplemented by... , , The model performance was comprehensively evaluated, and the recognition effect and misjudgment distribution under various working conditions were analyzed by confusion matrix analysis to verify the model's recognition ability and stability under complex working conditions.
[0045] Table 4. M-F1 values of the fusion model for identification under different working conditions
[0046] Table 5 Multidimensional Performance Indicators of the Integrated Model
[0047] Interpretability analysis: This approach integrates SHAP and LIME methods to quantify feature contributions at both global and local levels. SHAP identifies key features, while LIME explains the local decision-making logic of individual prediction samples. This mechanism enhances model transparency and user trust, providing support for intelligent operation and maintenance strategies.
Claims
1. A method for recognizing multiple operating modes of photovoltaic arrays based on Stacking and interpretability analysis, characterized in that... Includes the following steps: Step 1: Construct a multidimensional photovoltaic array operation characteristic matrix including original values, first-order differences, curvature, normalized values, and exponential moving average ratios; Step 2: Normalize the multidimensional photovoltaic array operation feature matrix constructed in Step 1; divide the normalized feature matrix and its corresponding label set into datasets; Step 3: Based on the K-fold cross-validation mechanism, construct the Stacking learning framework, select LightGBM, RF and XGBoost as base learners, and LR as meta learner to build a multi-condition pattern recognition model; Step 4: Based on the multi-condition pattern recognition model constructed in Step 3, with the maximum F1 score as the optimization objective, the Optuna Bayesian search algorithm is used to jointly optimize the key hyperparameters of each base learner and the weights of the fusion layer. Step 5: Based on the optimal multi-condition mode recognition model obtained in Step 4, reason about the test data to achieve multi-condition mode recognition.
2. The photovoltaic array multi-condition mode recognition method based on Stacking and interpretability analysis according to claim 1, characterized in that: It also includes step 6: combining the SHAP method to analyze the global feature contribution, identify the main influencing factors, and using the LIME method to perform local interpretability analysis on a single predicted sample to verify the rationality and traceability of the identification results.
3. The photovoltaic array multi-condition mode recognition method based on Stacking and interpretability analysis according to claim 1, characterized in that: In step 1, based on the electrical mechanism of the photovoltaic array, a multi-dimensional photovoltaic array operation characteristic matrix is constructed from the raw monitoring data of voltage, current, and power output by the photovoltaic array components. This matrix includes raw values, first-order differentials, curvature, normalized values, short-term / long-term power EMA and ratio, and instantaneous fill factor. The details are as follows: The following six aspects were used to construct derived features as input variables for the multi-condition pattern recognition model; ①. Transient mutations caused by first-order difference extraction faults: (1); In formula (1): For a moment Electrical quantities; The electrical quantity from the previous moment; This is a first-order difference result, used to characterize instantaneous abrupt changes; ②. Using the slope and curvature of the I–V curve to characterize nonlinear variation features: (2); In formula (2): For photovoltaic array current; The voltage of the photovoltaic array; The slope of the I–V curve; Let be the curvature of the I–V curve; ③. Eliminate the influence of environmental factors through normalization and filler factors: (3); In formula (3): These are the original electrical quantities; This is the minimum value of the electrical quantity within the sampling interval; This represents the maximum value of the electrical quantity within the sampling interval; This is the result after normalization; ④. Calculate the EMA ratio of short-term and long-term currents to distinguish between sudden and gradual faults: (4); In equation (4): For a moment The original signal; It is a smoothing factor; Weights are assigned to historical data; For a moment The exponential moving average; It is the exponential moving average of the previous moment; It is a short-term EMA; For long-term EMA; This is the ratio of the short-term EMA to the long-term EMA. ⑤. Introduce a range index within a sliding window to identify local electrical fluctuations: (5); In equation (5): For a moment Electrical quantities; The length of the window; The maximum value within the window; The minimum value within the window; This is a range indicator, reflecting local fluctuations; The current moment in the time series; ⑥. Measure the overall operating efficiency of the array using the fill factor performance index: (6); In formula (6): This is the power at the maximum power point; This is the open-circuit voltage; This is the short-circuit current; The fill factor measures the efficiency of photovoltaic modules. Assume the photovoltaic array at time... Extracted to the following One characteristic: First-order difference characteristic Slope and curvature of the I-V curve ; Normalization results Power short-term / long-term EMA and ratio Instant fill factor Local range index ; exist At time t, the feature vector is: After sliding collection over a long time series, a multidimensional feature matrix is obtained: (7); In equation (7): This is a multidimensional photovoltaic array operation characteristic matrix; For at any time The extracted first The numerical values of each feature; This represents the sampling length of the time series. The dimension of the feature.
4. The photovoltaic array multi-condition mode recognition method based on Stacking and interpretability analysis according to claim 3, characterized in that: In step 2, the multidimensional photovoltaic array operating feature matrix is normalized to eliminate dimensional differences between different features; let the original feature matrix be denoted as: (8); In equation (8): This is the original feature matrix; for 0 real matrix; The number of samples; Indicates the feature dimension; (9); In equation (9): The feature vector of the sample; They represent the first The 1st, 2nd, ..., dth features of each sample; (10); In formula (10): Indicates the first The sample mean of each feature; For the first The sample at the th The original values of each feature dimension; The number of samples; (11); In equation (11): Indicates the first The standard deviation of each feature; The number of samples; (12); In equation (12): These are the normalized standard values; Indicates the first The standard deviation of each feature; For the first The sample at the th The original values of each feature dimension; After normalization, the normalized feature matrix and its corresponding label set are divided into 9 categories: F0–F2 represents normal. F3–F5 indicates fading; F6–F8 indicates cracking. To ensure the balance of training and the objectivity of evaluation, a tiered randomization strategy is adopted, based on... The proportions are divided into training set and test set. This represents the proportion of the training set to the total dataset.
5. The photovoltaic array multi-condition mode recognition method based on Stacking and interpretability analysis according to claim 4, characterized in that: In step 3, a multi-condition pattern recognition model is constructed using a stacking strategy. By integrating multiple complementary base learners and introducing a meta-learner for high-level weighted fusion, the recognition accuracy of multiple conditions is improved. The multi-condition pattern recognition model consists of a two-layer structure: the first layer uses LightGBM, XGBoost and RF as base learners to extract multi-angle discrimination information; the second layer uses LR as a meta learner to perform weighted fusion of the output results of the base learners. The overall input of the multi-condition pattern recognition model is a normalized photovoltaic feature vector, and the output is the predicted probability of each condition category. (13); In equation (13): The input feature vector; For the first Each operating condition category; To provide given input features Under the condition that the sample belongs to category The probability of; For the model to class The rating; To perform exponential calculations on the scores, ensuring that the probability is non-negative; The sum of indices for all categories is used for normalization; This represents the total number of operating condition categories; For category index variables; The normalized training dataset is , For the first one sample 3D input features; For the corresponding photovoltaic array operating condition label; Number of categories; The number of samples; The first layer contains Base learners: LightGBM, XGBoost, and RF; Each base learner is used for input samples Output The probability distributions for each type of fault are as follows: (14); In equation (14): For the first Each base learner on samples Output Class probability vector; For the first Model function for each base learner; for A real vector space.
6. The photovoltaic array multi-condition mode recognition method based on Stacking and interpretability analysis according to claim 5, characterized in that: LightGBM introduces the GOSS and EFB mechanisms, and its objective function is: (15); In equation (15): The training objective for LightGBM; Cross-entropy loss; Output for the model; This is a regularization term used to control model complexity; XGBoost optimizes the loss function using second-order derivative expansion and incorporates a regularization term to control model complexity. Its loss function is: (16); In equation (16): For the first The locally expanded expression of the loss function for each tree; For the first The model function for the tree; For loss function pairs The first derivative of is the gradient term; For loss function pairs The second derivative of is the curvature term; For the first The structural regularization term of a tree; In the first In the first round of boosting Tree samples The predicted output; (17); In equation (17): For the first The true label of each sample; For the front Tree samples The cumulative prediction output; Indicates sample The loss between the predicted value and the actual value; (18); Random Forest (RF) is used for classification tasks with complex features and diverse patterns, such as the operating conditions of photovoltaic arrays. (19); In equation (19): For the first The samples were provided by LightGBM. 3D class probability vector; For LightGBM samples The original score, with dimensions as ; This is a function that converts the score vector into probabilities; (20); In equation (20): For the first The samples are provided by XGBoost. 3D class probability vector; For XGBoost samples The original score, with dimensions as ; (21); In equation (21): For the first The samples were provided by LightGBM. 3D class probability vector; For the first The predicted probability vector of each tree for a sample. The number of trees; Equations (19) to (21) above represent the classification output probabilities of each base learner for a sample.
7. The photovoltaic array multi-condition mode recognition method based on Stacking and interpretability analysis according to claim 6, characterized in that: In step 3, to avoid the second-layer LR using data that overlaps with the base learner, five-fold cross-validation is employed. ) and out-of-fold (OOF) strategy; the training set Divided into For the first Fold, first use Train three types of base learners, and then... Generate the OOF probability, where: For training set; For the first Fold the validation set; (22); In equation (22): For the first Each base learner on samples OOF probability vector; For use The first training One model; After five rounds of iteration, the OOF results for all samples are obtained, and then: (23); In equation (23): For three base learners to pair samples The meta-feature vector formed by concatenating the OOF probability vectors column by column is used to train the two-layer meta-model. as a base learner for samples The softmax probability output; Here is the OOF probability vector for LightGBM; This is the OOF probability vector of XGBoost; This is the OOF probability vector of the random forest (RF); for 3D real vector space; As the training input for the second layer of logistic regression, it ensures that there is no information leakage; (24); In equation (24): , These are the weight vector and bias term of the logistic regression model, respectively.
8. The photovoltaic array multi-condition mode recognition method based on Stacking and interpretability analysis according to claim 7, characterized in that: In step 3, the accuracy Ac and F1 score are set as evaluation indicators for the multi-condition pattern recognition model, respectively measuring the overall classification accuracy and the balance of recognition among multiple categories. (25); (26); (27); (28); In the formula: The total number of samples; Predict labels for the model; This is a real label; For indicator functions; Number of operating condition categories; , The first Precision and recall for each class; They represent the first The number of true positives, false positives, and false negatives in a class.
9. The photovoltaic array multi-condition mode recognition method based on Stacking and interpretability analysis according to claim 8, characterized in that: In step 4, the Optuna optimization framework is introduced, and a Bayesian optimization strategy is used to automatically search for the optimal hyperparameter combination. The inner parameter optimization function expression is: (29); In equation (29): These are the learnable parameters of the model; To give hyperparameters again The optimal model parameters that minimize training loss are determined below. For hyperparameters; For model mapping functions; The loss function for the training set; These are the training set features and labels, respectively. For in variable Take the value that minimizes the objective. The outer parameter optimization expression is: (30); In equation (30): The optimal combination of hyperparameters; For the hyperparameter search space; The loss function for the validation set; These are the validation set features and labels, respectively. For a given The optimal parameters were obtained. In search space Internal selection minimizes the verification loss. ; To further enhance the expressive power of the fusion structure, a fusion weight adjustment mechanism is introduced in the second-layer meta-learner; the probability outputs of the three base learners for the same input sample... The inputs can be combined into a fusion input using a weighted average method; (31); In equation (31): ; Assign weights to the outputs of the three base learners respectively; With maximizing M-F1 as the objective function, it is defined as: (32); In equation (32): In order to make The optimal hyperparameter that yields the maximum value; To be in a given hyperparameter The macro F1 obtained according to the established verification strategy; The vector of hyperparameters to be tuned; A Bayesian surrogate model was constructed using Optuna's built-in TPE sampler. The hyperparameter combinations and performance indicators recorded in each round of experiments were updated, and the hyperparameters for the next round were sampled based on the expected improvement value. (33); (34); (35); (36); In the above formula: For hyperparameter vectors; The goal is to minimize; For a given The macro average F1 index; For the first Hyperparameter experiments; For the first The hyperparameter vector for this experiment; The objective function value obtained from a single trial; For the first The target value for this experiment; for quantiles; The corresponding threshold; A set of historical trials categorized as "good" or "bad" based on a threshold. These are the two agent densities for TPE; This is the candidate set obtained by sampling from the "good" distribution; Hyperparameters for the next round of evaluation; The independent variable that maximizes the objective; Indicates from the 1st to the 2nd The target values collected in this experiment; This indicates that when the target value is less than a certain threshold Distribution of time-sensory hyperparameters; This means that when the target value is greater than or equal to a certain threshold... Distribution of time-sensory hyperparameters; This represents the set of candidate hyperparameters.
10. The photovoltaic array multi-condition mode recognition method based on Stacking and interpretability analysis according to claim 2, characterized in that: In step 6, regarding global interpretation, the SHAP value method is used to quantify the overall impact of each input feature on the prediction result; the specific calculation formula is as follows: (44); In equation (44): Representation of features SHAP contribution value; For the entire set of input features; For features not included A subset of; Representing a feature subset The predicted output is as follows; For the interpreted feature index; Indicates that only feature subsets are enabled. and At that time, the expected output of the model; Indicates in subset Add features based on A set; Indicates that only features are included. A collection of single elements; Represents a set cardinality factorial; Indicates removal and The factorial of the number of residual features; Represents the complete feature set factorial; Indicates from all features Remove from middle A set; In terms of local interpretation, the LIME method is used to interpret individual prediction results. LIME approximates the local behavior of the original model by generating perturbation samples in the neighborhood of the predicted sample and fitting an interpretable linear model. A series of perturbation samples are generated near the sample to be explained. The original model is used to predict these samples, and then a simple local model is trained to approximate the performance of the original model in this neighborhood. The objective function is: (45); In equation (45): This is the original black box model; It is a locally interpretable model; This represents the fitting error between the original model and the explanatory model in the neighborhood. Used to measure the difference between samples in the neighborhood and the sample to be explained. Similarity; This is a regularization term that constrains the complexity of the explanatory model; To find the model that minimizes the objective.
Citation Information
Cited By
Cross-site photovoltaic power generation power prediction model optimization method and system based on knowledge and data dual-drive AI
CN121920863A
