Abstract
Non-technical losses (NTL) occur during the distribution of electricity in power grids and include, but are not limited to, electricity theft and faulty meters. In emerging countries, they may range up to 40% of the total electricity distributed. In order to detect NTLs, machine learning methods are used that learn irregular consumption patterns from customer data and inspection results. The Big Data paradigm followed in modern machine learning reflects the desire of deriving better conclusions from simply analyzing more data, without the necessity of looking at theory and models. However, the sample of inspected customers may be biased, i.e. it does not represent the population of all customers. As a consequence, machine learning models trained on these inspection results are biased as well and therefore lead to unreliable predictions of whether customers cause NTL or not. In machine learning, this issue is called covariate shift and has not been addressed in the literature on NTL detection yet. In this work, we present a novel framework for quantifying and visualizing covariate shift. We apply it to a commercial data set from Brazil that consists of 3.6M customers and 820K inspection results. We show that some features have a stronger covariate shift than others, making predictions less reliable. In particular, previous inspections were focused on certain neighborhoods or customer classes and that they were not sufficiently spread among the population of customers. This framework is about to be deployed in a commercial product for NTL detection.
Introduction
In the power industry, Non-Technical Losses (NTL)—which include electricity theft, meter tampering, and billing errors—can account for up to 40% of total distribution in emerging economies. To combat this, utilities increasingly rely on machine learning (ML) to flag suspicious consumption patterns. However, these models often fall into the "Big Data trap": the assumption that more data automatically leads to better models.
The fundamental flaw lies in the "ground truth" labels derived from past physical inspections. Technicians do not inspect customers at random; they focus on specific neighborhoods, certain meter types, or areas with known issues. This creates a sampling bias, known in machine learning as covariate shift. If training data represents only a specific subset of customers, the resulting model will be unreliable when deployed across the entire grid.
Methodology: Quantifying Bias
The authors propose a framework to quantify covariate shift by treating it as a classification task. They take the "inspected" dataset (training) and the "uninspected" dataset (production) and assign them binary labels ($s=1$ and $s=0$). A Decision Tree classifier is then trained to distinguish between these two groups.
The Matthews Correlation Coefficient (MCC) is used to measure the classifier's performance. A high MCC indicates that the groups are easily distinguishable, proving a significant covariate shift exists. This approach ensures that the bias measurement is robust and not merely an artifact of model tuning.
Identifying Biased Features
The study utilized a massive real-world dataset from a Brazilian electricity provider, encompassing 3.6 million customers and 820,000 inspection results. Analysis revealed that bias is not distributed equally across features.
As shown in the heatmap above, Location is the primary source of bias (MCC = 0.22). This confirms that inspections are heavily clustered geographically. In contrast, features like "Voltage" and "Contract Status" showed almost no shift, suggesting they are more stable across both inspected and uninspected populations. When features are combined (e.g., Location + Number of wires), the MCC rises further, indicating even stronger bias in multi-dimensional customer profiles.
Hierarchical Visualization and the Granularity Effect
A key insight of the research is that bias is not uniform across different scales. The framework visualizes MCC values across four hierarchical levels: regions, municipalities, localities, and neighborhoods.
At a regional level, the shift appears relatively smooth. However, as the analysis zooms into the neighborhood level, the bias becomes significantly more granular and extreme. This visualization reveals that certain small pockets are heavily over-sampled while others are almost entirely ignored, a critical finding for utilities attempting to deploy grid-wide detection models.
Conclusion and Future Work
This research demonstrates that simply increasing the volume of data is insufficient for reliable NTL detection if the underlying sampling bias remains unaddressed. The proposed framework provides a necessary tool for domain experts to identify and visualize these biases before deploying models.
Future work will focus on moving from measurement to correction. The authors plan to utilize spatial point processes to actively reduce spatial covariate shift, ensuring that future machine learning models are trained on samples that truly represent the entire power grid population.
Summary updated