Detecting electricity theft in smart grids using optimized machine learning ensemble techniques and eXplainable AI
Electricity theft remains a significant challenge for modern power systems causing major financial damage to utility providers. With increasing adoption of advanced metering infrastructure in smart grids, energy efficiency and real-time monitoring have improved but the vulnerability of smart meters to tampering and cyber manipulation introduces new threats. To address these concerns at scale, this study proposes a cloud-based machine learning framework for intelligent electricity theft detection in residential sectors. The cloud-based setup, utilizing a Google Colab environment, facilitates centralized data processing, streamlined deployment, and real-time decision support. This study systematically resolves several critical limitations in existing approaches. Firstly, it addresses the severe class imbalance in real-world datasets, which significantly underrepresent theft cases compared to honest consumption. The synthetic minority oversampling technique is used to equalize representation and enable fair learning. Second, recognizing that synthetic oversampling can introduce noise and class overlap, a post-balancing noise reduction mechanism is integrated to refine the dataset and eliminate ambiguous samples. Third, by combining the interpretability of Decision Trees (DT) and the robustness of Random Forests (RF), an ensemble model named DTRF is proposed to enhance variance control and generalization. To improve the predictive performance of DTRF, the Firefly Algorithm (FA) is used to smartly adjust the model’s settings based on the specific features of the dataset. The proposed models are tested on two publicly available real-world datasets, Pakistan Residential Electricity Consumption (PRECON) and State Grid Corporation of China (SGCC), showing consistent improvements over standard models in various measures. On the PRECON dataset, the DTRF model outperforms baseline models and achieves a 25.68% reduction in log loss, a 31.23% decrease in Hamming loss, a 3.52% improvement in Cohen’s Kappa (CK), and a 4.10% increase in Jaccard score. The proposed DTRF-FA model further achieves a 40.97% reduction in log loss, a 36.38% decrease in Hamming loss, a 2.71% improvement in CK, and a 3.17% increase in the Jaccard score relative to the DTRF model. On the SGCC dataset, the DTRF model outperforms baselines with a 33.34% drop in Hamming loss, a 3.86% increase in CK, a 3.70% rise in the Jaccard score, and a 1.92% gain in the F1-score. The DTRF-FA model achieves a 75.00% reduction in Hamming loss, a 5.63% gain in CK, a 5.82% rise in Jaccard score, a 2.95% improvement in F1-score, and a 5.39% increase in Matthews correlation coefficient over the DTRF baseline. These improvements affirm the models’ ability to balance sensitivity and specificity while maintaining low false positive and false negative rates. Finally, to promote interpretability and transparency essential for stakeholder trust and regulatory compliance, the framework integrates two powerful explainable artificial intelligence techniques. Local Interpretable Model-agnostic Explanations (LIME) is used to generate local, instance-level explanations of individual predictions, while SHapley Additive exPlanations (SHAP) provides a global view of feature importance using cooperative game theory. By combining LIME and SHAP, the framework helps practitioners understand models’ decisions in detail and as a whole ensuring that it is accurate, clear, adaptable, and suitable for use in the smart grid settings.
Authors
- Nadeem Javaid (ORCID: https://orcid.org/0000-0003-3777-8249)
- Abdul Khader Jilani Saudagar (ORCID: https://orcid.org/0000-0003-4205-3621)
- Hatoon S. AlSagri (ORCID: https://orcid.org/0000-0003-3753-5116)
- Benish Kabir
- Babar Mansoor (ORCID: https://orcid.org/0000-0003-3072-335X)
- Farman Ali Khan (ORCID: https://orcid.org/0000-0002-1748-3016)
- U. Qasim (ORCID: https://orcid.org/0000-0001-7965-2834)
- Malik Najmus Saqib
Institutions
- University of Engineering and Technology Lahore (PK)
- COMSATS University Islamabad (PK)
- Imam Mohammad ibn Saud Islamic University (SA)
- National Yunlin University of Science and Technology (TW)
Publication Details
- Journal
- Energy Reports
- Published
- 2025-10-22
- DOI
- https://doi.org/10.1016/j.egyr.2025.09.019
- Primary Topic
- Electricity Theft Detection Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00