Manuscript Offprint
arXiv:2611.00917Benchmarking Classical Machine Learning Models for Shading-Fault Detection in Rooftop Photovoltaic Systems Using Real Sensor Data
Abstract
Most published comparisons of machine-learning classifiers for photovoltaic (PV) fault detection are validated on simulated faults. We compare seven classical and ensemble-tree classifiers on the Réunion dataset, a 4 kW domestic rooftop plant on which shading faults were physically staged and logged. Readings within a staged episode are near-duplicates, so every train/test split is grouped by episode. A 20,800-row subsample that retains all 17 fault episodes was evaluated with three repeats of five-fold group-aware nested cross-validation, with synthetic minority oversampling (SMOTE) applied inside the training folds. Random Forest and XGBoost gave the highest mean accuracy (0.838 and 0.831) and Matthews correlation coefficient (MCC; 0.526 and 0.522). After Holm correction across the 21 pairwise Wilcoxon tests, only Random Forest's accuracy advantage over k-nearest neighbours and the multi-layer perceptron remained significant. Logistic Regression and the Decision Tree (accuracy 0.820) could be separated neither from the ensembles nor from the weakest models. SMOTE lowered binary MCC for six of the seven classifiers. Errors were concentrated in whole episodes: the Random Forest almost entirely missed four of the 17 fault episodes, including one of two uniform-shading and two of five intermittent-shading episodes. A post-hoc diagnostic shows that the no-fault rows were sampled over a wider range of times of day and output levels than the fault rows. Clock time alone reaches an MCC of 0.44, and PV-side voltage alone 0.72. The reported scores therefore reflect operating-condition differences as well as shading signatures. We release the pipeline and the diagnostics, and identify matched no-fault sampling as the step needed before the classifier ranking can be generalised.
Keywords: photovoltaic fault detection; shading faults; classifier comparison; group-aware cross-validation; class imbalance; SHAP
1 Introduction
Partial or uniform shading forces shaded cells into reverse bias. They then dissipate rather than generate power, and the resulting hot spots are a recognised fire-risk pathway. On small rooftop systems the loss is often invisible on a production dashboard, so detection has to come from the inverter's electrical measurements.
Classical and ensemble-tree classifiers are the usual baselines for this kind of tabular monitoring data, and several multi-model comparisons exist (Eldeghady et al., 2024; Khandeparkar et al., 2025; Mouleloud et al., 2025). Most of them use simulated faults, because fault-labelled field data are scarce. Field data bring a problem that simulation hides. A staged fault persists for minutes to hours, so adjacent readings are almost identical, and a random row-level split puts near-copies of the same reading on both sides of the train/test boundary. Rankings obtained
*Corresponding author: Zablon Ombiro, zablon.ombiro@strathmore.edu under such splits, or on simulated data, cannot be assumed to hold under field conditions. The closest real-data comparison we know of (Toche Tchio et al., 2024) does not group its splits and does not test differences between classifiers.
We use the Réunion dataset (Graillet et al., 2022), one of the few public records in which shading faults were staged and logged on an operating plant. Seven classifiers are compared under a protocol that keeps every episode wholly inside one fold, and the pairwise differences are tested with multiplicity correction. Four questions guide the analysis:
-
RQ1. Under episode-grouped evaluation, which classifiers perform best, and which differences survive statistical testing?
-
RQ2. Does SMOTE, applied inside the training folds, change the ranking or only the absolute scores, and does its effect depend on the model family?
-
RQ3. Which electrical signals drive the decisions, and is that consistent across model families?
-
RQ4. Do the less interpretable models give a measurable gain over Logistic Regression and a single Decision Tree?
The contributions are: (i) a seven-classifier benchmark on real staged shading faults; (ii) an episode-grouped nested evaluation, made tractable by documented subsampling; (iii) multi-metric results with Holm-corrected paired tests and effect sizes, and a per-model normalised SHAP comparison; and (iv) episode-level error analysis and confound diagnostics that bound how far the results generalise. The pipeline, results and diagnostics are public.
Real field data have mostly been used for other tasks. Kappler et al. (2024) combine a long short-term memory network with a one-diode model for shading-aware power forecasting. PVF-10 provides real drone thermal imagery (Wang et al., 2024a). Graillet et al. (2022) describe the dataset used here but report no classifier.
The classifiers span distinct inductive biases: k-nearest neighbours (kNN; Cover and Hart, 1967), the maximum-margin SVM (Cortes and Vapnik, 1995), the decision tree (Quinlan, 1986), the multi-layer perceptron (MLP; Rumelhart et al., 1986), logistic regression as the linear reference, and the bagged and boosted ensembles Random Forest (Breiman, 2001) and XGBoost
Table 1: Closest prior studies and how this work differs.
| Study | Data and task | Difference in this work |
|---|---|---|
| Eldeghady et al. (2024) | Simulated PV array faults; several supervised classifiers; accuracy-focused | Real staged faults; six metrics; corrected paired tests |
| Khandeparkar et al. (2025) | Simulated fault signatures, four types; five models incl. RF and XGBoost | Same ensemble baselines on real data with grouped splits |
| Mouleloued et al. (2025) | Seven-class fault dataset; five models incl. RF | MCC and AUC-ROC alongside accuracy; significance testing |
| Toche Tchio et al. (2024) | Low-cost-sensor data incl. partial shading; Extra Trees vs. six classifiers | Episode-grouped CV, repeated paired tests, SHAP |
| Utama et al. (2023) | Comparison of explanation methods for PV faults | SHAP across seven classifiers on a normalised scale |
| Kappler et al. (2024) | Real installation; LSTM + physical model; forecasting | Discrete fault classification; multi-model comparison |
| Graillet et al. (2022) | Data descriptor of the Réunion plant | First classifier benchmark on this record |
(Chen and Guestrin, 2016). A deep sequence model trained on simulated data (Amiri et al., 2024) motivates the sequence-aware extension left to future work.
Native importance measures, such as a logistic coefficient or a tree’s impurity reduction, cannot be compared across model families. SHAP (Lundberg and Lee, 2017) is the usual remedy in PV fault detection (Utama et al., 2023) and in related energy and machinery studies (Cakiroglu et al., 2024; Santos et al., 2024; Bindingsbø et al., 2023). It is comparable across models only when the explained outputs share a scale, a point we return to in Section 4.4.
Accuracy is misleading under class imbalance. The Matthews correlation coefficient (MCC) is symmetric in classes and error types (Chicco and Jurman, 2020). SMOTE (Chawla et al., 2002) is the reference oversampler, but its benefit depends on the classifier (Swana et al., 2022; Maldonado-Correa et al., 2024), and in transformer diagnosis it has mainly helped tree ensembles (Prasojo et al., 2023; Wang et al., 2024b). For comparing classifiers we follow Demšar (2006). All-pairwise testing requires a multiplicity correction (García and Herrera, 2008). Effect sizes (Kerby, 2014) complement p-values, although they do not settle the wider critique of null-hypothesis testing (Benavoli et al., 2017). Wainer and Cawley (2021) show that non-nested tuning is usually adequate in practice, so the nested design used here is the conservative choice.
Table 1 positions this study against the closest prior work.
3 Methodology
3.1 Dataset and target construction
We use the electrical-production log of inverter 1 of the Réunion plant (Graillet et al., 2022): a 4kW, 24-module installation at 26° tilt in a tropical climate. The log has one sample every 5–8s and seven channels: PV-side current , grid current , daily cumulative grid energy , grid frequency , grid power , PV-side voltage and grid voltage . Faults were staged and logged with an explicit code, so the labels record an experimental condition rather than an inference.
After rows with missing values are dropped, the file has 2,988,798 rows from 1 October 2021 to 13 April 2023 (559 days). Table 2 gives the fault-code distribution. No-fault rows make up 97.17% of the record. Splitting the series at every change of fault state gives 35 contiguous runs: 17 fault episodes and 18 no-fault runs. All fault episodes fall between 8 February and 19 May 2022, a window of about 100 days.
Table 2: Fault-code distribution of the full record (2,988,798 rows), before subsampling.
| Code | Description | Rows | Share (%) | Episodes |
|---|---|---|---|---|
| 0.0 | No fault | 2,904,284 | 97.17 | 18 |
| 1.0 | Uniform shading (entire string obscured) | 6,318 | 0.21 | 2 |
| 2.1 | Constant partial shading, 1 module | 2,148 | 0.07 | 1 |
| 2.2 | Constant partial shading, 2 modules | 2,460 | 0.08 | 1 |
| 2.3 | Constant partial shading, 3 modules | 3,287 | 0.11 | 1 |
| 3.1 | Constant partial shading, 1/3 module | 2,717 | 0.09 | 3 |
| 3.2 | Constant partial shading, 2/3 module | 6,292 | 0.21 | 4 |
| 4.0 | Intermittent partial shading (moving shadow) | 61,292 | 2.05 | 5 |
Nested tuning of seven classifiers on about three million rows is not feasible on a single CPU workstation. The pipeline therefore keeps a random contiguous slice of at most 400 rows per fault episode and 2,000 rows per no-fault run, and drops whole no-fault runs at random until no more than 15,000 no-fault rows remain. All 17 fault episodes are retained. The benchmark has 20,800 rows in 24 episodes: 14,000 no-fault, 4,000 constant-partial-shading and 2,800 severe-tier rows, a fault prevalence of 32.7%. A constant no-fault predictor scores 0.673 accuracy (MCC 0) on it. All metrics below describe this capped benchmark, not the 2.83%-prevalence record.
The binary label is read directly from the fault code ( for code 0.0, otherwise ). A three-tier label groups codes by extent, following Graillet et al. (2022, Table 3): tier 0, no fault; tier 1, constant partial shading (2.1–3.2); and tier 2, severe shading (1.0 uniform and 4.0 intermittent). The grouping is a modelling choice, which is why both schemes are reported.
3.2 Features and class-imbalance handling
All 29 features are computed within an episode, so no window crosses an episode boundary. There are four groups:
-
the seven raw channels;
-
four instantaneous features: , , and ;
-
sixteen rolling features: the mean and standard deviation of , , and over and 10 samples (about 30 and 60 s);
-
two first differences, and .
Because stays near 233 V whenever the inverter is connected (s.d. about 4 V over no-fault rows), carries essentially the same information as .
Logistic Regression, kNN, the SVM and the MLP receive features standardised on the training fold; the tree models use raw scales. SMOTE (imbalanced-learn, three neighbours) is fitted inside each training fold, including the inner tuning folds. Every run is repeated without SMOTE.
3.3 Classifiers and tuning
Table 3 lists the search spaces. Hyperparameters are chosen by randomised search (15 draws, or every configuration where the space is smaller, as for Logistic Regression's six) inside each outer training fold. The search uses an inner three-fold group-aware split scored on macro-F1, so the outer test fold never informs selection. Table 4 gives the configuration selected most often under the primary condition. The modal choices are strongly regularised: the smallest C for Logistic Regression, depth 3 for the Decision Tree and XGBoost, and a minimum leaf size of 10
Table 3: Randomised-search space per model ( = number of features; = Minkowski exponent).
| Model | Search space |
|---|---|
| Logistic Regression | ; L2 penalty (all 6 evaluated) |
| kNN | ; weights ; |
| Decision Tree | max depth ; min samples per leaf ; criterion |
| SVM (RBF) | ; |
| MLP | hidden layers ; ; initial learning rate ; early stopping |
| Random Forest | trees ; max depth ; min samples per leaf ; features per split |
| XGBoost | trees ; max depth ; learning rate ; row and column subsampling |
Table 4: Modal configuration across the 15 outer-fold searches (binary scheme, with SMOTE).
| Model | Modal configuration |
|---|---|
| Logistic Regression | ; L2 |
| kNN | ; ; uniform weights |
| Decision Tree | max depth 3; min samples per leaf 1; Gini |
| SVM (RBF) | ; |
| MLP | one hidden layer of 64 units; ; initial learning rate |
| Random Forest | 300 trees; max depth 8; min samples per leaf 10; features per split |
| XGBoost | 100 trees; max depth 3; learning rate 0.01; row subsampling 0.7; column subsampling 0.85 |
for Random Forest. This is consistent with only 17 distinct fault episodes being available for learning.
3.4 Evaluation and statistical testing
The outer loop is five-fold cross-validation, stratified by class and grouped by episode, and repeated three times with different shuffles. This gives 15 outer folds. Five folds is the largest number that leaves several fault episodes on each side of every split. Within a repeat, all 28 runs () share the same outer partitions.
The binary scheme with SMOTE is the primary condition. We report accuracy, fault-class precision, recall and F1 (macro-averaged for the tier scheme), MCC and AUC-ROC. MCC is the headline metric, because accuracy is inflated by the 67.3% majority class:
Pairwise differences in accuracy and MCC are tested with the Wilcoxon signed-rank test on the 15 paired folds. Holm’s step-down correction is applied across the 21 pairs of each metric. The matched-pairs rank-biserial correlation (Kerby, 2014) is reported as the effect size. The three repeats reuse the same 17 fault episodes, so the 15 folds are not independent and the uncorrected tests are anti-conservative. The Holm-adjusted results should therefore be read as the more reliable ones.
Table 5: Software and hardware environment.
| Component | Version |
|---|---|
| Python | 3 (author's workstation) |
| pandas | |
| NumPy | |
| scikit-learn | |
| imbalanced-learn | |
| SciPy (Wilcoxon testing) | |
| matplotlib | |
| XGBoost | (ensemble classifier, Section 3.3) |
| SHAP | (feature attribution, Section 4.4) |
| Hardware | CPU only; all classifiers run unmodified on commodity laptop hardware; no GPU required |
Table 6: Binary scheme with SMOTE; mean s.d. over 15 outer folds.
| Model | Accuracy | Precision | Recall | F1 | MCC | AUC-ROC |
|---|---|---|---|---|---|---|
| Logistic Regression | .820.124 | .776.269 | .766.275 | .741.231 | .483.378 | .893.170 |
| kNN | .772.137 | .707.293 | .689.273 | .663.238 | .388.342 | .822.172 |
| Decision Tree | .820.175 | .806.282 | .773.276 | .764.252 | .500.420 | .861.198 |
| SVM (RBF) | .800.130 | .784.272 | .667.266 | .690.237 | .435.354 | .846.179 |
| MLP | .757.196 | .712.314 | .702.299 | .670.261 | .387.416 | .820.230 |
| Random Forest | .838.156 | .844.267 | .744.297 | .759.256 | .526.416 | .859.260 |
| XGBoost | .831.153 | .822.257 | .755.272 | .767.232 | .522.404 | .870.250 |
3.5 Implementation
All experiments ran on a single CPU-only workstation, with a fixed seed (42) for SMOTE, the classifiers and the search. The outer split of repeat uses seed . The 28 runs took 26,666 s (7.4 h), and the separate SHAP computation about 1.5–2 h, dominated by kNN, the SVM and the MLP, for which no closed-form SHAP algorithm exists. Table 5 lists the software and hardware. The post-hoc diagnostics in Sections 4.7 and 5.6 use the same outer splits and the fixed modal Random Forest configuration.
4 Results
4.1 Primary comparison
Table 6 and Fig. 1 report the primary condition. Random Forest has the highest accuracy (0.838) and MCC (0.526), followed by XGBoost (0.831, 0.522). Logistic Regression and the Decision Tree both reach 0.820 accuracy (MCC 0.483 and 0.500). kNN, the SVM and the MLP trail (0.772, 0.800 and 0.757). Logistic Regression has the highest AUC-ROC (0.893), so its ranking of samples is good even though its default-threshold accuracy is lower. Fold-to-fold standard deviations are large for every model (Random Forest MCC ), because folds differ in which episodes they hold out (Section 4.7).
Without SMOTE (Table 7), Random Forest again leads (0.839, MCC 0.531), and Logistic Regression (0.830) moves ahead of XGBoost (0.814). Removing SMOTE raises accuracy for every model except XGBoost.

Figure 1: Six metrics per classifier (binary scheme, with SMOTE); error bars show the fold-wise standard deviation.
Table 7: Binary scheme without SMOTE; mean ± s.d. over 15 outer folds.
| Model | Accuracy | Precision | Recall | F1 | MCC | AUC-ROC |
|---|---|---|---|---|---|---|
| Logistic Regression | .830±.149 | .824±.265 | .742±.289 | .751±.248 | .511±.406 | .901±.170 |
| kNN | .792±.146 | .763±.278 | .693±.288 | .687±.239 | .439±.362 | .849±.177 |
| Decision Tree | .823±.189 | .818±.290 | .778±.278 | .773±.261 | .516±.442 | .878±.206 |
| SVM (RBF) | .805±.141 | .819±.268 | .657±.261 | .700±.234 | .456±.363 | .841±.175 |
| MLP | .788±.180 | .763±.294 | .722±.291 | .709±.252 | .451±.404 | .854±.220 |
| Random Forest | .839±.157 | .852±.263 | .739±.296 | .761±.255 | .531±.416 | .861±.253 |
| XGBoost | .814±.171 | .824±.287 | .727±.269 | .747±.249 | .508±.415 | .846±.258 |
4.2 Confusion matrices
Table 8 and Fig. 2 pool the out-of-fold predictions: 62,400 per model (20,800 rows × 3 repeats). Random Forest and XGBoost produce the fewest false alarms (2,801 and 3,021). The SVM misses the most faults (6,420 false negatives; recall 0.667). Missing a fault is the costlier error when the hazard is undetected shading.
4.3 Statistical significance
Table 9 gives the uncorrected Wilcoxon p-values on accuracy. Before correction, Random Forest exceeds kNN (, ) and the MLP (, ), and XGBoost exceeds both (, ; , ). On MCC, both ensembles exceed kNN (, ), the MLP ( and .026) and the SVM ( and .016), and the Decision Tree exceeds kNN (). No comparison involving Logistic Regression is significant on either metric. Neither is any comparison among Logistic Regression, the Decision Tree and the two ensembles (all on MCC and on accuracy).
After Holm correction over the 21 pairs, two comparisons survive on accuracy: Random
Table 8: Pooled confusion-matrix counts (binary, with SMOTE; positive class = fault).
| Model | TN | FP | FN | TP |
|---|---|---|---|---|
| Logistic Regression | 36,778 | 5,222 | 4,471 | 15,929 |
| kNN | 35,138 | 6,862 | 6,019 | 14,381 |
| Decision Tree | 37,415 | 4,585 | 4,454 | 15,946 |
| SVM (RBF) | 37,546 | 4,454 | 6,420 | 13,980 |
| MLP | 34,871 | 7,129 | 5,914 | 14,486 |
| Random Forest | 39,199 | 2,801 | 5,026 | 15,374 |
| XGBoost | 38,979 | 3,021 | 4,883 | 15,517 |

(a)

(b)
(c)
Figure 2: Pooled confusion matrices (binary, with SMOTE): (a) Logistic Regression, kNN and Decision Tree; (b) SVM and MLP; (c) Random Forest and XGBoost.
Forest over the MLP () and over kNN (). None survives on MCC; the smallest is , for both ensembles versus kNN. The large effect sizes show that the ensembles beat kNN and the MLP in most folds. But with 17 fault episodes and correlated repeats, the design can confirm only the largest gaps. The lack of significant differences among Logistic Regression, the Decision Tree and the ensembles is a failure to detect a difference. It does not show that they perform equally.
4.4 Feature attribution
SHAP values were computed for every classifier fitted on the full benchmark (binary, with SMOTE). Two caveats apply. First, the explained models use library-default hyperparameters, not the tuned configurations of Table 4, and the attributions are in-sample. Second, the explainers return different output scales: log-odds for Logistic Regression and XGBoost, probability for the others. Raw mean values therefore cannot be compared or summed across models. Fig. 3 normalises each model's attributions to shares of its own total.
Table 9: Pairwise Wilcoxon signed-rank p-values on accuracy (15 paired folds; upper triangle). Bold: significant after Holm correction over 21 pairs. r: matched-pairs rank-biserial correlation, reported where p < .05 uncorrected; positive values favour the column model.
| kNN | DT | SVM | MLP | RF | XGB | |
|---|---|---|---|---|---|---|
| LR | .055 | .599 | .055 | .277 | .720 | .847 |
| kNN | .151 | .188 | 1.000 | <.001 (r=.93) | .009 (r=.79) | |
| DT | .303 | .095 | .679 | .975 | ||
| SVM | .421 | .121 | .121 | |||
| MLP | <.001 (r=1.0) | .010 (r=.73) | ||||
| RF | .421 |

Figure 3: Share of each model's total mean |SHAP| for the twelve features with the largest average share (binary, with SMOTE). : w-sample rolling mean.
ranks first for the Decision Tree, Random Forest, XGBoost and the SVM, third for kNN and fourth for the MLP. kNN's top feature, , is itself a near-linear transform of . Logistic Regression relies mostly on rolling means of and and ranks fifth. Averaged over the seven models, accounts for 23% of the attribution, followed by (9%) and (8%). is a daily cumulative counter, so its prominence is a warning sign rather than a physical finding (Section 5.6).
4.5 Label scheme and resampling
Table 10 compares the binary and three-tier schemes under both resampling conditions. With SMOTE, every classifier loses accuracy and MCC on the tier task, and the ensembles keep the highest tier scores (XGBoost 0.746 / 0.477; Random Forest 0.741 / 0.465). Without SMOTE, the order changes: the Decision Tree (0.763 / 0.527) and Logistic Regression (0.758 / 0.483) lead, and the Decision Tree loses only 6 accuracy points from binary to tier, against 20 with SMOTE. The SVM's apparent robustness to the finer task (Fig. 4b) is therefore specific to the
Table 10: Binary versus three-tier scheme, with and without SMOTE (mean over 15 folds).
| Model | With SMOTE | Without SMOTE | ||||
|---|---|---|---|---|---|---|
| Accuracy bin. | MCC tier | Accuracy bin. | MCC tier | Accuracy bin. | MCC tier | |
| Logistic Regression | .820 | .650 | .483 | .339 | .830 | .758 |
| kNN | .772 | .664 | .388 | .328 | .792 | .699 |
| Decision Tree | .820 | .619 | .500 | .338 | .823 | .763 |
| SVM (RBF) | .800 | .728 | .435 | .428 | .805 | .744 |
| MLP | .757 | .624 | .387 | .295 | .788 | .654 |
| Random Forest | .838 | .741 | .526 | .465 | .839 | .749 |
| XGBoost | .831 | .746 | .522 | .477 | .814 | .747 |

(a)
(b)
Figure 4: (a) Effect of SMOTE on binary MCC. (b) Accuracy under the binary and three-tier schemes, with SMOTE.
SMOTE condition.
Fig. 4a shows the effect of SMOTE on binary MCC. It is negative for six of the seven models: largest for the MLP (-0.064) and kNN (-0.051), and negligible for Random Forest (-0.004). Only XGBoost gains (+0.014). On the tier scheme SMOTE costs Logistic Regression and the Decision Tree 14.4 and 18.9 MCC points.
4.6 Feature ablation
Table 11 varies the feature set of a Random Forest held at the modal configuration of Table 4 (binary, with SMOTE). The configuration was chosen from the outer-fold searches, so these figures are mildly optimistic. Raw channels alone (A) score close to the full set (C). The temporal block alone (B) is clearly worse (MCC 0.366). However, B contains no term, because the rolling features are built from , , and . Its deficit therefore reflects the absence of as much as the use of temporal features. AUC-ROC varies little (0.858–0.870), so the feature set mainly moves default-threshold decisions.
4.7 Per-fault-type and per-episode performance
Table 12 gives the binary Random Forest's recall per fault code (modal configuration, pooled out-of-fold predictions), together with the number of episodes detected. Because every code has between one and five episodes, the row-level recall is in effect an episode count, and each episode is classified almost all-or-nothing. Four of the 17 fault episodes are almost entirely missed (share
Table 11: Random Forest feature ablation (binary, with SMOTE, fixed modal hyperparameters, 15 folds).
| Configuration | Features | Accuracy | MCC | AUC-ROC |
|---|---|---|---|---|
| A: raw channels | 7 | .821±.171 | .504±.423 | .870±.201 |
| B: rolling and difference features (no ) | 18 | .743±.092 | .366±.295 | .860±.223 |
| C: all features | 29 | .839±.156 | .528±.417 | .858±.260 |
Table 12: Binary Random Forest per fault code (specificity for code 0.0), pooled over 15 folds. Episodes detected: share of rows correct .
| Code | Description | Pooled rows | Recall | Episodes detected |
|---|---|---|---|---|
| 0.0 | No fault (specificity) | 42,000 | 0.935 | – |
| 1.0 | Uniform shading | 2,400 | 0.501 | 1 / 2 |
| 2.1 | Constant partial, 1 module | 1,200 | 0.999 | 1 / 1 |
| 2.2 | Constant partial, 2 modules | 1,200 | 1.000 | 1 / 1 |
| 2.3 | Constant partial, 3 modules | 1,200 | 0.007 | 0 / 1 |
| 3.1 | Constant partial, 1/3 module | 3,600 | 0.947 | 3 / 3 |
| 3.2 | Constant partial, 2/3 module | 4,800 | 1.000 | 4 / 4 |
| 4.0 | Intermittent (moving shadow) | 6,000 | 0.595 | 3 / 5 |
of rows correct ): the single code-2.3 episode, one of the two uniform-shading episodes and two of the five intermittent episodes. One code-3.1 episode is partly missed (0.84). All other fault episodes are detected in at least 98% of their rows.
The missed episodes share an operating signature. The code-2.3 episode and one missed intermittent episode were recorded at low output (median of 217 W and 179 W), with of 181 and 169 V. The no-fault median is 184 V, against 151 V for fault rows, so these episodes sit inside the no-fault voltage range. The other missed intermittent episode has near-normal (176 V) at full output. A moving shadow may simply have been off the array for much of the retained 400-row slice, which is 2–15% of each intermittent episode. Both uniform-shading episodes inject no power during their slices; the detected one also has , whereas the missed one holds at about 150 V, a value typical of fault rows at full output. Code 2.1, with fewer raw rows than code 2.3, is detected perfectly, which rules out sparsity as the explanation for code 2.3.
At tier level (three-class Random Forest with SMOTE, pooled; accuracy 0.768, macro-F1 0.564), the per-tier F1 is 0.909 for no fault, 0.587 for constant partial shading and 0.197 for severe shading (precision 0.272, recall 0.154). The faults most closely tied to the fire-risk motivation are the ones detected least reliably.
5 Discussion
5.1 Comparative performance (RQ1)
The ensembles have the best point estimates. The only differences that survive multiplicity correction are Random Forest's accuracy advantages over kNN and the MLP. Logistic Regression and the Decision Tree fall between the two groups and cannot be separated from either. A defensible reading is that the ensembles are at least as good as any alternative tested, and clearly better than kNN and the MLP. A clean split into two tiers is not supported.
5.2 Effect of SMOTE (RQ2)
SMOTE lowered binary MCC for six classifiers and helped only XGBoost, and then marginally. On the tier scheme it reversed the ranking of the Decision Tree and Logistic Regression relative to the ensembles. A likely reason is that fault episodes are long runs of near-identical readings, so interpolating between them adds little information about the class boundary while distorting distance-based, margin-based and single-tree learners. SMOTE should not be applied by default at the benchmark's 32.7% prevalence, in line with reports from machine-fault and wind-turbine SCADA data (Swana et al., 2022; Maldonado-Correa et al., 2024).
5.3 Feature influence (RQ3)
Once attributions are put on a common scale, is the dominant input for most models. A physical mechanism exists: a shaded cell limits the string current and triggers a bypass-diode voltage step, and the resulting multi-peak power-voltage curve can lead maximum power point tracking to a lower-voltage operating point (Kappler et al., 2024). The same direction of change, however, is produced by module heating at high irradiance, and in this benchmark the fault rows are concentrated at midday while the no-fault rows are not (Section 5.6). The present data cannot separate the two mechanisms.
5.4 Interpretability and operation (RQ4)
The ensembles show no detectable gain over Logistic Regression or the Decision Tree. Both are cheaper to retrain and easier to audit: a depth-3 tree can be read as three threshold rules. For an operations team with limited data-science support, the evidence here does not justify the added opacity of an ensemble. That conclusion rests on non-significance in a small-sample design, not on demonstrated equivalence, and it should be revisited on matched data.
5.5 Variability across folds
Each outer fold holds out three or four fault episodes, and episodes are detected almost all-or-nothing. A fold's score therefore depends mainly on whether it contains one of the four hard episodes. This is why the standard deviations are large, and why paired comparison on identical folds is necessary.
5.6 Operating-condition confound
The subsampling keeps a contiguous 400-row slice (33–53 min) per fault episode and a 2,000-row slice per no-fault run. All fault slices fall between 10:00 and 17:00. Most no-fault slices extend into early morning or late afternoon, between 05:51 and 18:11. The median clock hour is similar (12.6 versus 13.4), but the spread is not (s.d. 1.7 versus 3.7 h), and the median grid power differs widely (982 W for fault rows versus 274 W for no-fault rows). To measure the effect, we re-ran the outer protocol with the modal Random Forest and no SMOTE on restricted inputs (Table 13). Clock time alone, which carries no electrical information, gives MCC 0.44, more than kNN or the MLP achieve with 29 features. alone gives 0.72, and the six raw channels without give 0.74; both exceed every tuned model in Table 6.
Two conclusions follow. First, part of what the classifiers learn is when and at what output level each class was recorded, not only the shading signature. The absolute scores in this paper should not be read as field detection rates. Second, the engineered features and SMOTE lowered the performance of the Random Forest instead of raising it. The ranking of the 29-feature models partly reflects how each model copes with redundant or confounded inputs. The remedy is to draw no-fault rows from the same clock window and irradiance band as the fault episodes, which the plant's companion meteorological file allows, and to replace by its rate of change.
Table 13: Post-hoc diagnostic: Random Forest (modal configuration, no SMOTE) on restricted inputs; same 3×5 grouped outer folds.
| Inputs | Accuracy | MCC | AUC-ROC |
|---|---|---|---|
| Clock hour only | .732±.114 | .443±.260 | .792 |
| only | .616±.130 | .196±.269 | .735 |
| only | .880±.075 | .724±.158 | .913 |
| .822±.091 | .592±.189 | .821 | |
| Seven raw channels | .851±.115 | .685±.217 | .876 |
| Six raw channels (no ) | .888±.084 | .744±.185 | .922 |
5.7 Validity and scope
Three controls guard against train/test leakage: scaling and SMOTE are fitted on training folds only, tuning is nested, and no episode is split across folds. Every one of the 28 runs is reported. Pairwise tests are Holm-corrected, although they still treat correlated repeats as independent.
Three further limitations remain. The tier grouping is checked only against the binary scheme. The SHAP analysis explains default-parameter models in-sample. Tables 11 and 12 use a configuration chosen with knowledge of the outer folds.
Externally, the data come from one plant, one climate and one staging campaign, with all faults inside a 100-day window. The results are evidence about relative behaviour on this record under the stated sampling. They are not performance figures to expect at other installations.
5.8 Deployment
A deployed detector would inform maintenance dispatch and, for severe shading, a safety-relevant decision. The per-episode results show that a system built on these models would miss a materially larger share of uniform and intermittent shading than of constant partial shading. Before any operational use, the models would need validation on other plants and module technologies, a human-in-the-loop dispatch process, and monitoring for drift from soiling, degradation and season. None of these steps is undertaken here.
6 Conclusions
We compared seven classical and ensemble-tree classifiers on real, physically staged shading faults, under episode-grouped nested cross-validation with corrected paired tests. Random Forest and XGBoost gave the best point estimates. After multiplicity correction, only Random Forest’s accuracy advantage over kNN and the MLP was significant, and Logistic Regression and the Decision Tree could not be distinguished from the ensembles. SMOTE reduced MCC for six of seven models and should not be a default. Errors concentrate in a few whole episodes, including half of the uniform-shading and two-fifths of the intermittent-shading episodes. A post-hoc diagnostic shows that the no-fault class differs from the fault class in time of day and output level, enough for clock time alone to reach an MCC of 0.44. The scores therefore mix shading signatures with acquisition context.
Future work will (i) re-run the benchmark with no-fault rows matched to the fault episodes in clock time and irradiance, using the companion meteorological data; (ii) replace the Wilcoxon tests with a corrected resampled t-test and report per-episode results; (iii) recompute SHAP on the tuned, out-of-fold models on a common output scale; (iv) extend the ablation to all feature blocks with and without SMOTE; and (v) evaluate sequence models and other real fault-labelled PV datasets as they become available.
Declaration of generative AI and AI-assisted technologies
During the preparation of this work the authors used Claude (Anthropic) to assist with writing, drafting and copy-editing the manuscript, and to cross-check the reported figures against the stored results. All experiments were designed, and all scripts written and run, by the first author. The authors reviewed and edited all AI-assisted text against the experimental outputs and take full responsibility for the content of this publication.
CRediT authorship contribution statement
Zablon Ombiro: Conceptualization, Methodology, Software, Validation, Formal analysis, Investigation, Data curation, Writing – original draft, Writing – review & editing, Visualization.
Bernard Shibwabo: Supervision, Validation, Writing – review & editing.
Declaration of competing interest
The authors declare no known competing financial interests or personal relationships that could have influenced the work reported in this paper.
Data and code availability
The dataset is publicly available on Zenodo (Graillet et al., 2022). The data-preparation, modelling and analysis code, the stored results and the post-hoc diagnostics (review/reanalysis.py) are available at https://github.com/IncognitoGK9/pv-fault-benchmark (Ombiro, 2026).
Acknowledgements
The authors thank the Department of Computing, Strathmore University, for academic guidance and computing resources.
Funding
This research received no external funding.
References
Adhya, D., Chatterjee, S., Chakraborty, A.K., 2023. Diagnosis of PV array faults using RUSBoost. Journal of Control, Automation and Electrical Systems 34 (1), 157–165. https://doi.org/10.1007/s40313-022-00947-6
Amiri, A.F., Kichou, S., Oudira, H., Chouder, A., Silvestre, S., 2024. Fault detection and diagnosis of a photovoltaic system based on deep learning using the combination of a convolutional neural network (CNN) and bidirectional gated recurrent unit (Bi-GRU). Sustainability 16 (3), 1012. https://doi.org/10.3390/su16031012
Benavoli, A., Corani, G., Demšar, J., Zaffalon, M., 2017. Time for a change: a tutorial for comparing multiple classifiers through Bayesian analysis. Journal of Machine Learning Research 18 (77), 1–36.
Bindingsbø, O.T., Singh, M., Øvsthus, K., Keprate, A., 2023. Fault detection of a wind turbine generator bearing using interpretable machine learning. Frontiers in Energy Research 11, 1284676. https://doi.org/10.3389/fenrg.2023.1284676
Breiman, L., 2001. Random forests. Machine Learning 45 (1), 5–32. https://doi.org/10.1023/A:1010933404324
Cakiroglu, C., Demir, S., Ozdemir, M.H., Aylak, B.L., Sariisik, G., Abualigah, L., 2024. Data-driven interpretable ensemble learning methods for the prediction of wind turbine power incorporating SHAP analysis. Expert Systems with Applications 237, 121464. https://doi.org/10.1016/j.eswa.2023.121464
Chawla, N.V., Bowyer, K.W., Hall, L.O., Kegelmeyer, W.P., 2002. SMOTE: synthetic minority oversampling technique. Journal of Artificial Intelligence Research 16, 321–357. https://doi.org/10.1613/jair.953
Chen, T., Guestrin, C., 2016. XGBoost: a scalable tree boosting system. In: Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 785–794. https://doi.org/10.1145/2939672.2939785
Chen, Z., Han, F., Wu, L., Yu, J., Cheng, S., Lin, P., Chen, H., 2018. Random forest based intelligent fault diagnosis for PV arrays using array voltage and string currents. Energy Conversion and Management 178, 250–264. https://doi.org/10.1016/j.enconman.2018.10.040
Chicco, D., Jurman, G., 2020. The advantages of the Matthews correlation coefficient (MCC) over F1 score and accuracy in binary classification evaluation. BMC Genomics 21, 6. https://doi.org/10.1186/s12864-019-6413-7
Cortes, C., Vapnik, V., 1995. Support-vector networks. Machine Learning 20 (3), 273–297. https://doi.org/10.1007/BF00994018
Cover, T., Hart, P., 1967. Nearest neighbor pattern classification. IEEE Transactions on Information Theory 13 (1), 21–27. https://doi.org/10.1109/TIT.1967.1053964
Demšar, J., 2006. Statistical comparisons of classifiers over multiple data sets. Journal of Machine Learning Research 7, 1–30.
Dhibi, K., Mansouri, M., Bouzrara, K., Nounou, H., Nounou, M., 2021. An enhanced ensemble learning-based fault detection and diagnosis for grid-connected PV systems. IEEE Access 9, 155622–155633. https://doi.org/10.1109/ACCESS.2021.3128749
Eldeghady, G.S., Kamal, H.A., Hassan, M.A.M., 2024. Comparative analysis of the performance of supervised learning algorithms for photovoltaic system fault diagnosis. Science and Technology for Energy Transition 79, 27. https://doi.org/10.2516/stet/2024024
Gaaloul, Y., Kechiche, O.B.H.B., Oudira, H., Chouder, A., Hamouda, M., Silvestre, S., Kichou, S., 2025. Faults detection and diagnosis of a large-scale PV system by analyzing power losses and electric indicators computed using random forest and KNN-based prediction models. Energies 18 (10), 2482. https://doi.org/10.3390/en18102482
García, S., Herrera, F., 2008. An extension on “statistical comparisons of classifiers over multiple data sets” for all pairwise comparisons. Journal of Machine Learning Research 9, 2677–2694.
Graillet, A., Lebreton, C., Tang, C., Kbidi, F., Jegado, T., Damour, C., Benne, M., 2022. Electrical production data of a domestic grid-connected rooftop PV plant in normal and shading faults conditions associated with solar and meteorological data in a tropical climate. Data in Brief 46, 108723. https://doi.org/10.1016/j.dib.2022.108723. Dataset: https://doi.org/10.5281/zenodo.7828879
Harrou, F., Taghezouit, B., Khadraoui, S., Dairi, A., Sun, Y., Hadj Arab, A., 2022. Ensemble learning techniques-based monitoring charts for fault detection in photovoltaic systems. Energies 15 (18), 6716. https://doi.org/10.3390/en15186716
Hussain, M., Al-Aqrabi, H., Hill, R., 2022. Statistical analysis and development of an ensemble-based machine learning model for photovoltaic fault detection. Energies 15 (15), 5492. https://doi.org/10.3390/en15155492
Kappler, T., Starosta, A.S., Munzke, N., Schwarz, B., Hiller, M., 2024. Detection of shading for short-term power forecasting of photovoltaic systems using machine learning techniques. EPJ Photovoltaics 15, 17. https://doi.org/10.1051/epjpv/2024013
Kerby, D.S., 2014. The simple difference formula: an approach to teaching nonparametric correlation. Comprehensive Psychology 3, 1. https://doi.org/10.2466/11.IT.3.1
Khandeparkar, V., Shreshtha, Ramu, S.K., 2025. Effectiveness of supervised machine learning models for electrical fault detection in solar PV systems. Scientific Reports 15, 34919. https://doi.org/10.1038/s41598-025-18802-4
Krishna Veni, K.S., Senthil Kumar, N., Gnanavadivel, J., 2025. Non-invasive health status diagnosis of solar PV panel using ensemble classifier. Electrical Engineering 107 (5), 5447–5459. https://doi.org/10.1007/s00202-024-02760-7
Lundberg, S.M., Lee, S.-I., 2017. A unified approach to interpreting model predictions. In: Advances in Neural Information Processing Systems 30, pp. 4765–4774.
Maldonado-Correa, J., Valdiviezo-Condolo, M., Artigao, E., Martín-Martínez, S., Gómez-Lázaro, E., 2024. Classification of highly imbalanced supervisory control and data acquisition data for fault detection of wind turbine generators. Energies 17 (7), 1590. https://doi.org/10.3390/en17071590
Mellit, A., Kalogirou, S., 2022. Assessment of machine learning and ensemble methods for fault diagnosis of photovoltaic systems. Renewable Energy 184, 1074–1090. https://doi.org/10.1016/j.renene.2021.11.125
Mouleloued, Y., Kara, K., Chouder, A., Aouaichia, A., Silvestre, S., 2025. Euclidean distance-based tree algorithm for fault detection and diagnosis in photovoltaic systems. Energies 18 (7), 1773. https://doi.org/10.3390/en18071773
Ombiro, Z., 2026. pv-fault-benchmark: source code for benchmarking classical machine learning models for shading-fault detection in rooftop PV systems. GitHub repository. https://github.com/IncognitoGK9/pv-fault-benchmark
Prasojo, R.A., Putra, M.A.A., Ekojono, Apriyani, M.E., Rahmanto, A.N., Ghoneim, S.S.M., Mahmoud, K., Lehtonen, M., Darwish, M.M.F., 2023. Precise transformer fault diagnosis via random forest model enhanced by synthetic minority over-sampling technique. Electric Power Systems Research 220, 109361. https://doi.org/10.1016/j.epsr.2023.109361
Quiles-Cucarella, E., Sánchez-Roca, P., Agustí-Mercader, I., 2025. Performance optimization of machine-learning algorithms for fault detection and diagnosis in PV systems. Electronics 14 (9), 1709. https://doi.org/10.3390/electronics14091709
Quinlan, J.R., 1986. Induction of decision trees. Machine Learning 1 (1), 81–106. https://doi.org/10.1007/BF00116251
Rumelhart, D.E., Hinton, G.E., Williams, R.J., 1986. Learning representations by back-propagating errors. Nature 323 (6088), 533–536. https://doi.org/10.1038/323533a0
Santos, M.R., Guedes, A., Sanchez-Gendriz, I., 2024. SHapley Additive exPlanations (SHAP) for efficient feature selection in rolling bearing fault diagnosis. Machine Learning and Knowledge Extraction 6 (1), 316–341. https://doi.org/10.3390/make6010016
Suliman, F., Anayi, F., Packianather, M., 2024. Electrical faults analysis and detection in photovoltaic arrays based on machine learning classifiers. Sustainability 16 (3), 1102. https://doi.org/10.3390/su16031102
Swana, E.F., Doorsamy, W., Bokoro, P., 2022. Tomek link and SMOTE approaches for machine fault classification with an imbalanced dataset. Sensors 22 (9), 3246. https://doi.org/10.3390/s22093246
Toche Tchio, G.M., Kenfack, J., Voufo, J., Abessolo Mindzie, Y., Fouedjou Njoya, B., Ouro-Djobo, S.S., 2024. Diagnosing faults in a photovoltaic system using the Extra Trees ensemble algorithm. AIMS Energy 12 (4), 727–750. https://doi.org/10.3934/energy.2024034
Utama, C., Meske, C., Schneider, J., Schlatmann, R., Ulbrich, C., 2023. Explainable artificial intelligence for photovoltaic fault detection: a comparison of instruments. Solar Energy 249, 139–151. https://doi.org/10.1016/j.solener.2022.11.018
Wainer, J., Cawley, G., 2021. Nested cross-validation when selecting classifiers is overzealous for most practical applications. Expert Systems with Applications 182, 115222. https://doi.org/10.1016/j.eswa.2021.115222
Wang, B., Chen, Q., Wang, M., Chen, Y., Zhang, Z., Liu, X., Gao, W., Zhang, Y., Zhang, H., 2024a. PVF-10: a high-resolution unmanned aerial vehicle thermal infrared image dataset for fine-grained photovoltaic fault classification. Applied Energy 376, 124187. https://doi.org/10.1016/j.apenergy.2024.124187
Wang, L., Chi, J., Ding, Y., Yao, H., Guo, Q., Yang, H., 2024b. Transformer fault diagnosis method based on SMOTE and NGO-GBDT. Scientific Reports 14, 7179. https://doi.org/10.1038/s41598-024-57509-w
Wang, M., Xu, X., Yan, Z., 2023. Online fault diagnosis of PV array considering label errors based on distributionally robust logistic regression. Renewable Energy 203, 68–80. https://doi.org/10.1016/j.renene.2022.11.126
Yang, N.-C., Ismail, H., 2022. Voting-based ensemble learning algorithm for fault detection in photovoltaic systems under different weather conditions. Mathematics 10 (2), 285. https://doi.org/10.3390/math10020285