NILM as a regression versus classification problem: the importance of thresholding

by   Daniel Precioso, et al.
Universidad de Cádiz

Non-Intrusive Load Monitoring (NILM) aims to predict the status or consumption of domestic appliances in a household only by knowing the aggregated power load. NILM can be formulated as regression problem or most often as a classification problem. Most datasets gathered by smart meters allow to define naturally a regression problem, but the corresponding classification problem is a derived one, since it requires a conversion from the power signal to the status of each device by a thresholding method. We treat three different thresholding methods to perform this task, discussing their differences on various devices from the UK-DALE dataset. We analyze the performance of deep learning state-of-the-art architectures on both the regression and classification problems, introducing criteria to select the most convenient thresholding method.



There are no comments yet.


page 10


Profitable Trade-Off Between Memory and Performance In Multi-Domain Chatbot Architectures

Text classification problem is a very broad field of study in the field ...

Subtask Gated Networks for Non-Intrusive Load Monitoring

Non-intrusive load monitoring (NILM), also known as energy disaggregatio...

Topological Deep Learning: Classification Neural Networks

Topological deep learning is a formalism that is aimed at introducing to...

Incorporating Coincidental Water Data into Non-intrusive Load Monitoring

Non-intrusive load monitoring (NILM) as the process of extracting the us...

Non-Intrusive Load Monitoring: A Review and Outlook

With the roll-out of smart meters the importance of effective non-intrus...

Overcomplete Frame Thresholding for Acoustic Scene Analysis

In this work, we derive a generic overcomplete frame thresholding scheme...

Multi Label Restricted Boltzmann Machine for Non-Intrusive Load Monitoring

Increasing population indicates that energy demands need to be managed i...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Non-Intrusive Load Monitoring (NILM) was proposed on 1992 by G. W. Hart [hart1992nonintrusive]

as a method to predict whether an individual appliance is active or inactive, by observing the total aggregated power load, having information of the nominal consumption of each appliance in each state. The first approach to NILM employed Combinatorial Optimization, which at the time was the standard technique for disaggregation problems. For historical review of the evolution of NILM techniques, see for instance

[nalmpantis2018review, do2016applications, klemenjak2016nonintrusive]. This first approach had a major shortcoming: Combinatorial Optimization performed the power disaggregation on each instant independently of the others, without considering the load evolution through time. These original algorithms were very sensitive to noise and were only accurate for houses with very few appliances. Thus, they could not be applied to real-life scenarios.

NILM algorithms received renewed attention at beginning of the 21st century, mostly thanks to the increased number of datasets coming from smart electric meters installed in domestic residences. These meters are able to record the power load from a household at short time intervals (one hour or less) and send those values to the electric company [smartmeter]

. The first open-source NILM datasets were published in 2011 and they triggered further research activity by setting benchmarks for comparison of models. These datasets stored high frequency time series for both aggregated and appliance power load 

[kolter2011redd, anderson2012blued, kelly2015ukdale]. For a recent comprehensive review on NILM datasets, see [klemenjak2019datasets, klemenjak2020comparability]. Many of them are publicly available in the NILM-EU wiki.111

Soon after these datasets became available, the prevailing approach to NILM shifted from the combinatorial optimization problem mentioned above, to a supervised learning problem with times series in Machine Learning  

[revuelta2017survey, faustine2017survey]

. Traditional ML methods such as Hidden Markov Models were initially used 

[kim2011hmm, kolter2012hmm, jia2015nfhmm, mengitsu2018hmm], while in recent years the incredible growth of deep learning algorithms has dominated the field [kelly2016disaggregation, Kim2017NonintrusiveLM, krystalakos2018sliding, harell2019wavenilm, kasemili2019bilstm, kyrkou2019timeseries, massidda2020tpnilm].

Much of the recent effort of the NILM research community has been focused on improving the efficiency of prediction algorithms and computational speed, usually by presenting novel model architectures [kyrstalakos2018sliding, kyrkou2019timeseries] or even trying unconventional approaches such as finite state machines [ducange2014fuzzy] and hybrid programming [kong2016hybrid].

However, fewer works are devoted to investigating the formulation of the problem, and how this can affect the algorithm’s performance. For instance, uniformization of evaluation metrics for easy comparison of different models has been stressed in

[pereira2018metrics, makonin2015nonintrusive], while the dependence on sampling frequency has been treated in [ruano2019commercial]. This becomes a relevant issue when trying to leverage theoretical NILM results on high frequency benchmark datasets to real life scenarios where records are sampled at lower rates.

NILM datasets typically include both the aggregated power load and that of each monitored device, but not the device status (i.e. whether it is ON or OFF). Thus, a regression problem to predict the consumption of each device is naturally defined by the data. However, most works in NILM address the classification problem of determining whether the device is ON or OFF, rather than its consumption at each time interval. Defining a classification problem requires establishing a threshold or some procedure to determine the output categorical variable from the continuous output power load. Our main observation is that this process involves an external choice of thresholding method which is not included in the initial problem formulation. Depending on how this preprocessing step is performed, the performance and interpretation of the final results may vary in a significant manner. The main contribution of this paper is to highlight this matter and to discuss several possible ways to define a classification problem from the native regression problem.

The paper is organized as follows: in Section 2 we formally introduce the necessary notation to define regression and classification problems for time series in supervised learning. Section 3 introduces three different thresholding methods. Two different deep learning models are introduced and explained in Section 4. The purpose of studying two different models is to have more robust results and to ensure that the reported variations are not model dependent. The detailed methodology is carefully explained in Section 5

, including data preprocessing, definition of training, validation and test sets, loss functions, optimization algorithms, and evaluation metrics. The results are exhibited in Section 

6 for three monitored devices with different characteristics. Together with the results, we include a discussion on the criteria to choose the most convenient thresholding method. In section 7 we introduce architectures that optimize both classification and regression, to see how the two formulations interplay. Finally, we gather concluding remarks and outline open research problems in Section 8.

2 Problem Formulation

NILM is formulated as a supervised learning problem, where the model is trained to take the aggregate power as input signal and predict the power or state (ON/OFF) of each monitored appliance. This power load is measured by the smart meter at a constant rate , which produces a series of power measurements222Strictly speaking, smart meters measure the energy consumption during the interval divided by the length of the interval . at each sampled interval. For the analysis, it is often convenient to resample the original series at a larger sampling interval , which is part of the preprocessing step. For instance, in this paper the native sampling interval for the UK-DALE dataset provided by the meters is , but we choose to resample the series at intervals of

The aggregate power at instant is the sum over all appliances:


where is the total number of appliances in the building, is the power of appliance at time , and is the unidentified residual load. All of these quantities are expressed in watts.

After resampling, the training set comprises a sequence of records that we label as . This series is split in chunks of size

that we group in vectors as

. We have a total of such series, each of which will be an input to the model. The output of the model are sequences for each monitored appliance over the same time intervals. The pairs are considered as independent points in the training set.

Supervised learning problems are usually referred to as classification or regression problems depending on whether the output variables are categorical or continuous. In the NILM literature, both of these approaches have been considered in different contributions, but there has been hardly no works devoted to the interplay between both formulations. It is precisely this gap that we would like to fill with this analysis.

In the regression approach, the predicted quantities are the power load for each device.

In the classification approach the focus is on predicting whether a given appliance is at time in a number of possible states, typically ON or OFF. We assume therefore, for the sake of simplicity, that the appliance can be in one of two states at time , which are (OFF state) and (ON state). It is not evident to ascertain when a given appliance is ON or OFF by just looking at the power load. Thus, the usual criterion is to establish a threshold for each appliance, and define


Multi-state classification problems, where appliances may have more than one ON status (each of them with a different consumption) have also been considered in the literature [desai2019multistate]. A correct definition of the classification approach thus involves a choice of threshold for each appliance . Ideally, this threshold should be determined by the series of data alone, rather than being externally fixed by human intervention. In this paper we review different algorithms to determine this threshold, which lead to rather different outcomes depending on the complexity of the input signal. We address these methods in the following section.

3 Thresholding

In this section we will explore different methods on how to set a threshold to determine the OFF and ON status of an appliance, given its input power signal.

3.1 Middle-Point Thresholding (MP)

In Middle-Point thresholding we consider the set of all power values from appliance in the training set . We apply a clustering algorithm to split this set into two clusters and consider the centroid of each cluster. Typically, the -means clustering algorithm can be applied for this purpose, [macqueen1967kmeans]. The two centroids for each class, after applying -means, are denoted by (for the OFF state) and (for the ON state). In Middle-Point thresholding (MP), the threshold for appliance is fixed at the middle point between these values


3.2 Variance-Sensitive Thresholding (VS)

Variance-Sensitive (VS) thresholding was recently proposed as a finer version of MP thresholding by Desai et al.,[desai2019multistate]. It also employs

-means clustering to find the centroids for each class, but the determination of the threshold now takes into account not only the mean, but also the standard deviation

for the points in each cluster, according to the following formula


The motivation is that, if , then the threshold should move towards in order not to misclassify the points in class that are further away from the centroid . As a matter of fact, points in the OFF cluster usually have less variance, so the VS approach often sets its threshold lower than the MP approach. A comparison of both thresholding methods on a specific set of power measurements can be seen in Figure 1. Also note that MP is a particular case of VS when .

Figure 1: Distribution of a washing machine power load through all the monitoring time. The records pertain to house 2 of UK-DALE dataset. The graph was cropped vertically as 0 W consumption is more than of the total number of records. Black dashed lines mark the centroids found by -means clustering (1 watts and 1866 watts), while color dashed lines are the thresholds fixed by different methods.

3.3 Activation-Time Thresholding

The last two methods only use data from the distribution of power measurements in order to fix the threshold for an appliance. It often happens that due to noise in the smart meters or devices, some measurements during short time intervals are either absent while the device is operating, or produce abnormal peaks during the OFF state. For this reason, to ensure a smoother behaviour, Kelly and Knottenbelt [kelly2015neural] set both a power threshold and a time threshold. The power threshold could be fixed by MP or VS or fixed externally by hand as done in  [kelly2015neural]. The time threshold specifies the minimum length of time that device must be in a given state, e.g. if a sequence of power measurements are below for a time , then that sequence is considered to be in the previous state (ON in this binary case).

In [kelly2015neural], both power and time thresholds are chosen empirically, after analysing the appliance behaviour. Table 1 shows the values of the thresholds relevant to our work. The threshold is chosen usually at lower values, as the time threshold already filters noisy records. It would be desirable to turn this thresholding method into a fully automated data driven algorithm, in order to remove all subjective inputs.

Threshold Dishwasher Fridge Washing machine
(W) 10 50 20
(s) 30 1 3
(s) 30 1 30
Table 1: Activation time (AT) threshold values used in this work, taken from [kelly2015neural].

Figure 2 compares the three thresholding methods. Each graph shows the three values of for a given device, together with the result of applying each thresholding method to the same input series. Observe that the same power data gives rise to rather different series for the ON/OFF status depending on the choice of thresholding method. We thus see that there are multiple ways to define a classification problem given the input signal.

A comparison and a discussion of each thresholding method after training state-of-the-art NILM for regression and classification problems will be performed in Section 6.

Figure 2:

Sample from the washing machine power load sequence, depicting how different thresholding methods classify each instance as ON or OFF.

4 Neural Networks

Almost all state of the art models propagate their inputs through one or more convolutional layers [depenha2017convolutional, yang2020multilabel]. This is done to ensure that the models are translation invariant. As NILM is related to time series, many studies also add recurrent layers (e.g. LSTM or GRU) to their networks [Kim2017NonintrusiveLM, kasemili2019bilstm]. These layers tend to get very good results on sequence-related problems. In this work, we will try out two different models: one that relies purely on convolutions, and other that also applies recurrent layers after the convolutions.

It is important to stress that both of these neural networks can be applied to train a classification model to predict device status or a regression model to predict device power load, the only difference in their architecture lies in the last layer (see Figure 


), where an additional softmax layer needs to be added for the classification problem.

4.1 Convolutional Network

Our first model relies solely on convolutional layers, inspired on the architecture from the work of Luca Massidda et al. [massidda2020tpnilm]. The general scheme follows the classic approach to the semantic segmentation of images. See Figure 2(a) to better understand the following model explanation.

510 x 1


508 x 32

252 x 64

124 x 128

60 x 256


12 x 256

6 x 256

3 x 256

2 x 256

60 x 64

60 x 64

60 x 64

60 x 64


60 x 512


480 x 32


480 x n


480 x n

(a) CONV

510 x 1


495 x 16

480 x 8


480 x 128

480 x 256


480 x 64


480 x n


480 x n

(b) GRU
Figure 3: Architecture of each model. There are two possible outputs, the model trains differently depending of which output we chose.

The CONV model receives as input a vector with size which represents the household aggregated power over an

hour interval. The vector is propagated through an encoder, characterised by alternating convolution and pooling modules. Each encoder layer begins with a convolution of kernel size 3 and no padding, then applies batch normalization and ReLU activation, and ends with a max pooling of kernel size 2 and stride 2. Only the last layer omits the max pooling step. Encoder layers increase the space of the features of the signal at the cost of decreasing the temporal resolution.

After that, the Temporal Pooling module aggregates the features at different resolutions, which is reminiscent of inception networks [szegedy2014inception]. Four different average poolings are applied, with kernel sizes 5, 10, 20 and 30; having the same stride as kernel size. Each of those layers then propagate their values through convolution layers of kernel size 1 and no padding, followed by a batch normalization and ReLU activation. All of their outputs are then concatenated.

Finally, the decoder module applies one convolution of kernel size 8 and stride 8, followed by batch normalization. It then bifurcates into two different outputs: the appliance status and the appliance power. Both outputs are computed by propagating the network values through one last convolution layer of kernel size 1 and padding 1. In the case of status, we apply the softmax function. Both status and power load output vectors have the same sampling frequency as the input aggregate load, but have a shorter length as explained in Section 5.

4.2 Bidirectional GRU Network

Some authors tend to connect convolutional and recurrent layers to extract temporal correlations out of the input sequence [kyrstalakos2018sliding, kelly2015neural]. This second model follows a prototypical GRU scheme, depicted in Figure 2(b). The input and output layers are the same as in the previous model. For the processing units, the GRU model propagates the input vector through two convolutional layers with kernel size 20, padding 2 and stride 1, before applying the recurrent (bidirectional GRU) layers.

One can see that the model architecture is rather lightweight. However, GRU takes longer to train than CONV: adapting the GRU weights requires a lot of computation, compared to updating the weights of convolutional layers.

5 Methodology

5.1 Preprocessing

In order to make our results reproducible and easy to compare with other works, we restrict to the UK-DALE dataset [kelly2015ukdale], which is a standard benchmark for NILM.

Date of release 2014
Location United Kingdom
Number of households 5
Meter units Watts
Sampling frequency 6 seconds
Table 2: UK-DALE dataset features.
Building 1 2 3 4 5
Total time (days) 365 235 39 206 137
Appliances 53 18 4 11 24
Table 3: UK-DALE dataset.

Only houses 1, 2 and 5 have been used for this work. Our target appliances which are found in the three buildings are: fridge, dishwasher and washing machine. This choice of houses and appliances is common in other works [massidda2020tpnilm, kelly2015neural, shin2019subtask], as they seek to monitor appliances with distinguishable load absorption patterns and relevant contribution to the total power consumption.

Every power load series was downsampled from 6 seconds to 1 minute-frequency. After this downsampling, every input sequence comprises hours of time, which amount to records. Since the models use convolutions with no padding, the first and last records of each series are dropped in the output, thus leading to an output sequence having records, i.e. 8 hours. We have divided the original time series into input sequences with an overlap of 30 records between consecutive input sequences, so that the output sequence are continuous in time and have no gaps. Aggregate power load is normalized, dividing the load by a reference power value of 2000 W for numerical stability. Each input series is further normalized by subtracting its mean. Thus, we can define the following input and output series for the regression problem

Regression: (5)

where .

To define the classification problem, the target is the device status which is computed from using the thresholding methods described in Section 3. More specifically, we have

Classification: (6)

where is a series of binary values defined by (2).

The training set for each problem is built by adding the first sequences from each of the three buildings, which amounts to 1941 sequences (describing a total time of 687 days of measurements). The validation set is built by using the subsequent records from house UK-DALE 1, for a total of 183 sequences (65 days), while the test set is composed of the last sequences of the same building, having the same size as the validation set.

Train Validation Test
Number of points () 1941 183 183
Total time (days) 687 65 65
Table 4: Training, validation and test sets. Each point is a pair (, of time series, where has records, and has records, both of them at 1 min. intervals.

In order to judge whether we are dealing with a balanced classification problem, it will be useful to report how often a given device has been ON during the training and test sets, depending on which thresholding method has been applied. The results can be seen in Table 5.

Threshold Set Dishwasher Fridge Washing Machine
MP Train 0.77 42 0.97
Test 0.62 46 1.70
VS Train 0.83 44 1.80
Test 0.67 47 2.50
AT Train 2.30 42 4.60
Test 2.40 45 7.30
Table 5: Fraction of activation time (in %) for each device over the train and test sets.

It is important to stress a number of things from the observation of this table. First, the fraction of ON states is clearly dependent on the thresholding method, as it was already clear from Figure 2. Next, dishwasher and washing machine are only sparsely activated, while the fridge is considered to be ON roughly half of the time. In these two cases we are dealing with an imbalanced class problem, which should be taken into account when defining and interpreting the appropriate metrics. Finally, in all cases but specially for the washing machine, the prevalence of the positive class differs greatly from the training to the test set. This of course could happen because these periods have been chosen consecutive in time (in accordance with other works). If the train-validation-test split was done randomly over the 2307 series records, we would observe a similar class distribution across sets. Splitting training and test sets for a time series in machine learning problems always involves a delicate choice: whether to split records randomly (which ensures homogeneous distribution) or chronologically (which is closer to the real operating conditions).

5.2 Training

Each of the models described in Section 4

was trained for 300 epochs. Training data was fed to the model in batches of 32 sequences, shuffled randomly.

The loss function for the regression problem is the mean square error or L2 metric, given by


The standard choice of loss function for the classification problem is binary cross entropy:



is the probability that device

is ON at each time step.

During the 300 training epochs, we keep the model that achieves the minimum loss over the validation set, using an Adam optimizer for weights update, with a starting learning rate of .

Both data preprocessing and neural network training were performed on Python. Specifically, the models were written on Pytorch and trained in a GPU NVidia GeForce GTX 1080 with 8 GB of VRAM, NVIDIA-SMI 440.95.01 and CUDA v10.2. The code for this paper is available online

333Open-source repository: and the data comes from a public dataset, so all results reported in this paper are reproducible. Using the configuration stated in this section, CONV models took from 7 to 8 minutes to train 300 epochs, while GRU architectures took 16 minutes.

5.3 Metrics

Although metrics are clearly related to loss functions used for model training, the main difference is that the reported metrics are not required to be differentiable. When the output is a continuous variable (power load in our case), we use as the relevant metric the L1 error or MAE rather than RMSE, since the latter tends to give too much importance to large deviations.


When the output variable is categorical, we can use the

-score to balance precision and recall in balanced problems where there is no preference to achieve a better classification of the ON or OFF classes. The

-score is the harmonic mean of precision and recall, or directly


where the true positives (TP), false positives (FP), true negatives (TN) and false negatives (FN) in each series are given by

where in this case is the state of device at instant , and is the predicted state as defined by


For imbalanced problems, such as NILM for the dishwasher and washing machine (see Table 5), the -score might not be the best metric to report. Rather, since those devices are ON roughly 1% of the time, it is better to consider a suitable metric for imbalanced classification problems, like the area under the ROC curve. [fawcett2006introduction].

6 Results

6.1 Regression problem

We begin our discussion of results by reporting the metrics obtained over the test set by the two models (CONV and GRU) in the regression problem for each of the three appliances .

Model Dishwasher Fridge Washing Machine
CONV 11.59 26.95 18.25
GRU 8.07 28.68 15.00
Table 6: MAE scores (in watts) for regression models on each appliance

The analysis of these metrics needs a word of caution: it is natural to expect that if a device has been sparsely activated during the test set, the predicted load will give an overall lower MAE than a similar device that has been used more often (see Table 5). For this reason, some authors have suggested other metrics such as the energy error [mayhorn2016load, batra2014nilmtk]. For a recent review of all metrics that have been used in NILM, see [pereira2018metrics].

To understand the complexity of disaggregating the power signal in NILM, we have plotted a time series from the test set in Figure 4. In the plots we show the input signal (aggregated power load), together with the real power of each device and the predicted power obtained from the CONV network .

Figure 4: CONV regression: aggregated power load (input signal) and real and predicted loads for each device.

In the first graph of Figure 4 we see that the model has identified correctly the two main power peaks of 2200 W corresponding to the dish washer, but has properly ignored other similar large peaks occurring earlier in the series. In the second graph, we observe that the fridge power prediction is often masked by the presence of other devices, having a mean value of just 100 W but a very periodic activation pattern. When the aggregate power load is small, the model is able to better resolve the signal coming from the fridge. The washing machine has a more complex consumption pattern during its activation period, but the model has also been able to identify correctly the activation peaks while ignoring other similar peaks of the same magnitude occurring earlier in the series that do not correspond to washing machine operation.

6.2 Classification problem

As we have mentioned above, the classification problem is not uniquely defined since the raw data do not include the real intervals where each device was ON/OFF, but only its consumption. Thus, we have three different classification problems depending on the choice of thresholding methods described in Section 3. For each possible value of we report the -score (10) over the test set in Table 7.

Threshold Model Dishwasher Fridge Washing Machine
MP CONV 0.93 0.87 0.93
GRU 0.84 0.87 0.87
VS CONV 0.93 0.87 0.88
GRU 0.84 0.87 0.82
AT CONV 0.91 0.86 0.97
GRU 0.90 0.86 0.96
Table 7: -scores for classification models on each appliance and threshold

The next to last line shows that our results are in good agreement with those reported by the authors of [massidda2020tpnilm]. Also, we can observe that CONV has a slightly better -score that GRU for the classification problems in all three devices and thresholding methods, although both of them show a very good performance (see Figure 5). In general, the classification problem for the fridge is harder, for reasons that have been already mentioned above. We raised the idea of using AUC over -score in Section 5.3. We computed AUC and realized it was almost identical to -score, so we will keep using the latter as it is more common in the literature.

It is also instructive to represent the input signal , together with the real output signal describing the status of device and the predicted status , to grasp the nature of NILM problem for classification. We have plotted in Figure 5 the output of CONV on a given series of records from the test set where the three devices have been activated (sometimes simultaneously). Observe that the model is able to discriminate, with a very good precision, the periods in which each of the devices are activated, just from the observation of the aggregated power signal.

Figure 5: CONV model applying AT threshold: aggregated power load (input signal), real device status (output signal) and predicted status.

6.3 Reconstructing the power signal

A very natural question to address is which of the three proposed thresholding methods should be preferred. One would naively think that the one leading to a better -score would be the best choice, if this was only based on prediction performance. However, placing a trivial threshold of zero would yield state ON for all time intervals at the training and test sets, and any decent ML method would immediately learn this, thus reaching a perfect -score but having no useful interpretation at all. Thus, we need to balance predictive performance with a way of judging which method is more meaningful. In the absence of any other external information on when each device can be considered to be ON or OFF, we need to find an objective quantitative argument to tackle this question.

For this purpose, we propose to reconstruct the power signal from each device and compare the reconstructed signal with the original power load of the device. We compute the average power , (resp. ) for device during the periods that are considered to be ON, (resp. OFF) after applying the thresholding method, and reconstruct the power series with these binary values.

More specifically, we have


and reconstruct a binary power load for device as


The reconstructed power series can be seen, together with the original series in Figure 6 for two of the thresholding methods, corresponding to the same data as Figure 2.

Figure 6: Device power load reconstruction from two different thresholding methods.

We can compute the MAE between the original and reconstructed series averages over the training set, which we call the intrinsic error, since it is prior to any prediction method. The results for the three devices and thresholding methods are shown in Table 8.

Threshold Dishwasher Fridge Washing machine
MP 3.48 4.67 3.96
VS 4.39 4.71 6.60
AT 26.37 4.66 7.42
Table 8: Intrinsic error: MAE between the original and reconstructed power series.

From this comparison, we see that the Activation Time (AT) thresholding is the one having the largest intrinsic error, while Middle Point (MP) thresholding offers the closest reconstructed power series. The fridge has similar intrinsic error for all three methods since the original series is very regular, being almost a binary series itself (see Figure 4).

As we mentioned above, it is not enough to look only at the classification metrics in Table 7 to judge which is the best thresholding method for a NILM problem. For this reason, given the prediction output of the classification problem, we compute the reconstructed binary series and compare it with the original power series. MAE averaged over the test set are reported in Table 9 for the two models (GRU and CONV).

Threshold Model Dishwasher Fridge Washing Machine
MP CONV 9.09 21.45 39.45
GRU 11.25 21.80 41.66
VS CONV 9.25 21.01 40.74
GRU 11.59 22.19 41.85
AT CONV 19.75 21.26 57.23
GRU 21.07 22.45 56.35
Table 9: MAE scores (in watts) for classification models after reconstructing the power load, on each appliance and threshold.

The first thing to note is that naturally the MAE errors are larger than the intrinsic errors, as they incorporate the errors in the classification. However, it is worth noting that for the dishwasher in AT thresholding this error is actually smaller than the intrinsic one. We find the explanation for that phenomenon in Figure 6: current AT parameters contain a large time threshold for the dishwasher (see Table 1), which might lead to incorrect thresholding and large deviations in the reconstructed series. This suggests that the free parameters in AT thresholding should be optimized my minimizing the intrinsic error for each device over the training set. As shown in previous tables, CONV has a slightly better performance than GRU. It is also worth noting that the MAE for the washing machine has increased by a factor of 10 with respect to the intrinsic error, while in the other two devices, the factor is close to 4. The most likely explanation for this deviation is due to the train-test splitting: most of the error comes from activation periods, and these occur twice more often in the test than in the training set for the washing machine (see Table 5) while there is hardly no variation in the other two devices. This brings back the already mentioned remark on the importance of having a train-test split that preserves the distribution of classes.

Finally, these MAE values should be compared with the ones obtained by training our models for a pure regression problem (see Table 6). We observe that the results are comparable, and for the fridge they are even better in the reconstructed case. The explanation comes from the fact that the raw power signal for the fridge is almost binary, so the reconstructed signal matches this behaviour properly and the ON/OFF values and calculated over the training set are very close to the real values. Thus, in this case good metrics for the classification problem immediately translate into good MAE for the reconstructed series. By contrast, addressing the regression problem is harder for the fridge, where the regression curve often fails to reconstruct this signal, specially when it is masked by larger signals coming from other devices (see Figure 4b).

6.4 Classification metrics on the regression problem

In the last section we trained the model for classification but evaluated the MAE for the reconstructed power signal and compared it with the MAE obtained by directly training the model for regression. Now we do the opposite: we apply the thresholding methods on the real and predicted power signal to obtain the real and predicted status at each time interval, and then we calculate the metric over these values. The results can be seen in Table 10.

Threshold Model Dishwasher Fridge Washing Machine
MP CONV 0.89 0.77 0.93
GRU 0.90 0.74 0.91
VS CONV 0.77 0.78 0.81
GRU 0.81 0.75 0.83
AT CONV 0.09 0.76 0.46
GRU 0.27 0.72 0.65
Table 10: -scores for regression models after thresholding, on each appliance and threshold

These scores are on average worse than the ones from the original classification approach (Table 7). In particular, -scores of AT for dishwasher and washing machine are extremely low, which is caused by the small power threshold set by the thresholding formulation (see Table 1). During periods of inactivity, regression models output values that, although being relatively small compared to the power peaks of dishwasher and washing machine, are high enough to surpass the AT power threshold, thus triggering the ON state and causing many FPs.

7 Balancing classification and regression

So far we have trained our models to solve a pure classification or regression problem. However, as we explained in Section 4, our network architectures contain two different output layers, one for regression and the other for classification. This means that we can also train the model to solve both problems simultaneously, with a weighted combined loss function. The total loss of the model would then be:


where is the binary cross entropy (8), is the MSE (7), and

is a constant to normalize both losses so that they have comparable magnitude, estimated to be

. The constant allows to shift between pure classification and regression.

We train both models using different values of the weight with MP thresholding. Other thresholding methods showed a similar behaviour. For each value of , the model is trained five times with random weight initializations, as explained in Section 5. We show the output metrics MAE and -score for varying in the figures below.

Note that when the model does not train for classification. For this reason, we include for a single point for the curve, corresponding to applying the thresholding method on the regression output, as we did in Section 6.4. Likewise, for the model does not train for regression. For this reason, we include for the MAE obtained by reconstructing the power signal from the classification output, as explained in Section 6.3.

Figure 7: Model scores for dishwasher depending on classification weight
Figure 8: Model scores for fridge depending on classification weight
Figure 9: Model scores for washing machine depending on classification weight

Looking at the results in Figures 79 we observe a very different behaviour for the fridge than for the other two devices, due to their different characteristics already mentioned. In the dishwasher and washing machine, the -score grows monotonically with for CONV as one would expect, but is almost constant for GRU, with a small drop for values of close to 1 which are hard to explain. Likewise, the MAE in both models and devices tends to grow for larger , which is natural since the model has a smaller weight for the regression problem. As for the extra points in the graphs, for the dishwasher we see that the -score obtained by thresholding a pure regression output (red dot) is comparable to the best score obtained by larger weights in classification. Rather surprisingly, the reconstructed power signal from pure classification output (blue dot) has a lower MAE than the best regression weight for CONV and still a comparable value in GRU. This discussion also holds for the washing machine, except the reconstructed series behaves poorly in this case, as we have already discussed by the activation pattern of the signal (see Table 9 and the ensuing remarks). For the fridge, the behaviour is consistent for both models, but different from the other two devices. While the -score behaves similarly, the MAE for regression decreases with , which is clearly counter-intuitive: the model prioritizes classification loss, and in doing so it performs better in the regression problem as well. Also, the purely reconstructed signal for (blue dot) has a better MAE than any of the models trained for regression. This fact can again be explained by the second graph in Figure 4: the regular (almost binary) activation pattern of the fridge is much better captured by a classification model with the right threshold than by a regression model, since the weak signal of the fridge is often masked by that of other devices.

8 Summary and conclusions

Non Intrusive Load Monitoring is typically framed as a classification problem, where the input data is the aggregated power load of the household and the output data is the sequence of ON/OFF states of a given monitored device. It is important to stress that this problem is derived, as the raw data do not contain the variable that needs to be predicted but only the power consumption. Creating a classification problem from the raw power signal data requires an external determination of the status by some thresholding method. We have discussed three possible methods in Section 3 and how they lead to classification problems with different results.

A discussion of what is the most appropriate method should not be based on the performance achieved by prediction models alone, but include also some objective way to judge the interpretability of the results. We suggest as an objective criterion to use the intrinsic error, i.e. MAE between the original power series and reconstructed binary series.

We show that deep learning models can be trained to minimize the regression loss (7) or the classification loss (8

), but it is also possible to combine both into a weighted loss introducing an extra hyperparameter. This parameter balances the weight given to both problems, that are effectively solved both at a time. The optimal choice of this parameter depends strongly on the characteristics of the device.

To conclude we would like to mention possible improvements and future extensions of this work.

First, two of the thresholding methods (MP and VS) are entirely algorithmic, but AT needs some external parameters to be fixed. We suggest that these free parameters, the time thresholds for each device, should be fine tuned to minimize the intrinsic error defined in Section 6.3.

Second, some of the results highlight the importance of discussing chronological vs. random splitting of records to form the training, validation and test sets. This choice will become less significant in the large data size limit, but for moderate sizes they can still lead to different results. Similar issues are key in discussing fraud detection methods, where fraud techniques evolve in time and differ chronologically throughout the time span of the dataset.

Finally, we have chosen to address the simpler NILM problem of recognising the same devices seen in the training and test sets. Training models on certain households and generalizing to unseen devices in different households is a harder problem that lies at the root of industrial large scale applications of NILM.

Our purpose for this paper was to highlight an important factor at the foundations of NILM as a supervised learning problem, so we focused on a simple, well known benchmark dataset. We envisage to extend our study to larger, more recent datasets like Pecan Street [parson2015dataport] or ECO [kleiminger2015eco], addressing also the generalization capacity of deep learning models to cope with unseen devices in households not present in the training set.

9 Acknowledgements

This research has been financed in part by the Spanish MICINN under grants PGC2018-096504-B-C33 and RTI2018-100754-B-I00 and the European Union under the 2014-2020 ERDF Operational Programme and by the Department of Economy, Knowledge, Business and University of the Regional Government of Andalusia (project FEDER-UCA18-108393). DP gratefully acknowledges an Industrial PhD grant from Universidad de Cádiz.