Smart non-intrusive appliance identification using a novel local power histogramming descriptor with an improved k-nearest neighbors classifier

Non-intrusive load monitoring (NILM) is a key cost-effective technology for monitoring power consumption and contributing to several challenges encountered when transiting to an efficient, sustainable, and competitive energy efficiency environment. This paper proposes a smart NILM system based on a novel local power histogramming (LPH) descriptor, in which appliance power signals are transformed into 2D space and short histograms are extracted to represent each device. Specifically, short local histograms are drawn to represent individual appliance consumption signatures and robustly extract appliance-level data from the aggregated power signal. Furthermore, an improved k-nearest neighbors (IKNN) algorithm is presented to reduce the learning computation time and improve the classification performance. This results in highly improving the discrimination ability between appliances belonging to distinct categories. A deep evaluation of the proposed LPH-IKNN based solution is investigated under different data sets, in which the proposed scheme leads to promising performance. An accuracy of up to 99.65% and 98.51% has been achieved on GREEND and UK-DALE data sets, respectively. While an accuracy of more than 96% has been attained on both WHITED and PLAID data sets. This proves the validity of using 2D descriptors to accurately identify appliances and create new perspectives for the NILM problem.


Introduction
Buildings are responsible on more than 32 percent of the overall energy consumed worldwide, and this percentage is expected to be doubled by 2050 as a result of the well-being improvement and wide use of electrical appliances and central heating/cooling systems [1]. Specifically, this is due to population growth, house comfort enhancement and improvement of wealth and lifestyle. To that end, reducing wasted energy and promoting energy-saving in buildings have been nowadays emerged as a hot research topic. One of the cost-effective solutions is via encouraging Two crucial stages in NILM are the feature extraction and inference and learning procedures. The feature extraction step aims at deriving pertinent characteristics of energy consumption signals to help representing appliances from the same category with similar signatures while differencing between power signals from different classes [9]. On the other hand, the inference and learning step is essentially reserved to train classifiers in order to identify appliances and extract appliance-level power footprints [10]. It can be achieved either by using conventional classification models, such as artificial neural networks (ANN), support vector machine (SVM), k-nearest neighbors (KNN), etc. or novel classifiers, including deep neural networks (DNNs). Consequently, the identification of electrical devices simultaneously operating through an interval of time in a household is the central part of the NILM architecture. Its performance is highly dependent on the deployed feature extraction and inference model. To that end, the development of robust schemes belonging to these two modules attracts a considerable interest in recent years [11,12].
In this paper, recent NILM systems are first reviewed based on the principal components contributing into the implementation of such architectures including feature extraction and learning models. In this respect, techniques pertaining to three main feature extraction categories are described among them graph signal processing (GSP), sparse coding features and binary encoding schemes. Following, a discussion of their limitations and drawbacks is also presented after conducting a deep comparison of their performances and properties. Moving forward, a non-intrusive appliance identification architecture is proposed, which is mainly based on a novel local power histogramming (LPH) descriptor. The latter relies on (i) representing power signals in a 2D space, (ii) performing a binary power encoding in small regions using square patches of 3 × 3 samples and (iii) returning back to the initial 1D space through extracting histograms of 2D representations. Following, an improved k-nearest neighbors (IKNN) is introduced to effectively identify appliance-level fingerprints and reduce the computation cost. This has resulted in very short appliance signatures of 256 samples, in which each power signal is represented with a unique histogram, and thus leads to a better appliance identification performance at a low computational complexity. Moreover, it is worth-noting that to the best of the authors' knowledge, this paper is the first work that discusses the applicability of 2D local descriptors for identifying electrical appliances using their power consumption signals. Overall, The main contributions of this paper can be summarized as follows: • We present a comprehensive overview of recent trends in event-based NILM systems along with describing the their drawbacks and limitations.
• We propose a novel NILM framework based on an original 2D descriptor, namely LPH, which can be considered as an interesting research direction to develop robust and reliable NILM solutions. Explicitly, after converting appliance power signals into 2D space, the appliance identification becomes a content-based image retrieval (CBIR) problem and a powerful short description is extracted to represent each electrical device.
According, LPH operates also as a dimensionality reduction, where each resulted appliance signature has only 256 samples.
• We design a powerful IKNN model that efficiently aids in recognizing appliances from the extracted LPH fingerprints and reducing significantly the computational cost.
• We evaluate the performance of the proposed LPH-IKNN based NILM system on four different data sets with distinct sampling frequency rates and in comparison with various recent NILM systems and other 2D descriptors.
The remainder of this paper is structured as follows. An overview of NILM systems is introduced in Section 2 along with a discussion of their drawbacks and limitations. In Section 3, the main steps of the proposed NILM system based on the LPH descriptor and IKNN are described in details. The performance results of the exhaustive empirical evaluation conducted in this framework are presented and thoroughly discussed in Section 4, in which different comparisons are conducted with state-of-the-art works. Finally, Section 5 concludes the paper, discusses the important findings and highlights the future works.
2 Related work 2.1 Overview of NILM techniques NILM frameworks can be categorized into two major groups. The first one called non-event-based approaches, which focus on using algorithms without depending on the training/learning procedures (using data from a particular building). They can segregate the main power signal collected from the overall circuit into various appliance-level fingerprints.
An explicit example of this kind of techniques that have been typically studied is related the deployment of statistical analysis, including hidden Markov models (HMM) [13], higher-order statistics (HOS) [14] or probabilistic models [15]. The second group deals with methods allowing the identification of state changes occurred in power consumption signals using different types event detectors, classifiers, and further implementing appropriate techniques to calculate an individual load usage fingerprint for each electrical device. In this section, we focus on describing recent NILM systems pertaining to the second category because the proposed framework is an even-based NILM framework.
Explicitly, this category of NILM systems deploys two principal components. The first one is a feature descriptor to extract pertinent characteristics of electrical appliances, while the second is a learning algorithm that can help in detecting and classifying each device based on its features. Conventional NILM methods have been basically concentrated on extracting features related to steady-states and transient-states, in addition to the adoption of conventional machine learning (ML) classifiers. On the other side, novel strategies are introduced in recent years to deal with the NILM issue based on the use of new signal analysis procedures and innovative learning models. This class of NILM frameworks is defined as non-conventional, they are classified into four principal sub-categories as follows: Graph signal processing (GSP): A trending research field aiming at describing stochastic characteristics of power signals based on graph theory. In [16], a graph-based method for identifying individual appliances has been introduced after detecting appliance events. This results in a better detection of appliance-level fingerprints and further a reduction of time computation compared to conventional graph-based techniques. In [17], various multi-label graphs have been developed to detect individual devices based on a semi-supervised procedure. In [18], NILM performance have been enhanced via the use of a generic GSP-based technique, which is build upon the application of graph-based filters. This results in a better detection of on/off appliance states, via the mitigation of electric noise produced by appliances.
Sparse coding features: In this category, the NILM framework is treated as a blind source separation problem and recent sparse coding schemes are then applied to split an aggregated power consumption signal into specific appliance based profiles [19]. In [20], a co-sparse analysis dictionary learning is proposed to segregate the total energy consumption into a device-level data and significantly shorten the training process. In [21], a deep learning architecture is used for designing a multi-layer dictionary of each appliance rather than constructing one-level codebook. Obtained multi-layer codebooks are then deployed as features for the source-separation algorithm in order to break down the aggregated energy signal. In [22], an improved non-negative matrix factorization is used to pick up perceptibly valuable appliance-level signatures from the aggregated mixture.
Binary descriptions: Most recently, binary descriptors have been investigated for the classification and fault detection of 1D signals such as electroencephalogram (EEG), electrocardiogram (ECG), and myoelectric signals [23]. For power consumption signals, this concept is novel. The only few works that can be found in the literature are mainly focusing on representing the power signal in a novel space and directly being used to train the convolutional neural network (CNN). In [24], power fingerprints are derived by estimating the similarity of voltage-current (V-I) shapes, encoding it using a binary dictionary and then extracting image graphical footprints that are directly fed to a self-organizing map (SOM) classifier, which is based on neural networks. In [25], V-I binary representation is employed through converting the normalized V-I magnitude into binary matrices using a thresholding process before being fed to a CNN. More specifically, this approach relies on binary coding of the V-I edges plotted in the new representation. These data are then fed into an ML classifier in order to identify each appliance class. In [26], a color encoder is proposed to draw V-I signatures that can also be translated to visual plots. These footprints are then fed to a deep learning classifier to identify each electrical appliance. In [27], a siamese-neural network is employed aims at mapping the V-I trajectories into a novel characteristic representation plan.
Time-frequency analysis: Time-frequency analysis is an imperative research topic, in which much attention has been devoted to it in the past and even nowadays. It is applied in several applications among them energy efficiency [28], NILM or energy disaggregation [29] and power consumption anomaly detection [30]. In [31,32], a novel NILM descriptor is proposed based on the fusion of different time-domain descriptors. In [5], a novel time-scale analysis is adopted based on the use of multi-scale wavelet packet trees (MSWPT) and a cepstrum-based event detection scheme to glean appliance-level power consumption patterns from the aggregated load.

Improved k-nearest neighbors
In the building energy sector, KNN has been widely deployed in the literature for different purposes, such as energy disaggregation [33] and anomaly detection [34,35,36] although it has some issues, e.g. the sensitivity of the neighborhood size k could significantly degrade its performance [37,38]. To that end, an improved version is proposed in [39] to address this issue, named generalized mean distance-based k-nearest neighbor. Specifically, multi-generalized mean distances are introduced along with the nested generalized mean distance that rely on the properties of the generalized mean. Accordingly, multi-local mean vectors of a specific pattern in every group are estimated through deploying its class-specific k nearest neighbors. Using the obtained k local mean vectors per group, the related k generalized mean distances are estimated and thereby deployed for designing the categorical nested generalized mean distance. Similarly, in [40], the authors introduce a local mean representation-based KNN aiming at further improving the classification performance and overcoming the principal drawbacks of conventional KNN. Explicitly, they select the categorical KNN coefficients of a particular pattern to estimate the related categorical k-local mean vectors. Following, a linear combination of the categorical k-local mean vectors is used to represent the particular pattern. Moving forward, in order to capture the group of this latter, group-specific representation-based distances between the particular pattern and the categorical k-local mean vectors are then considered.
Moreover, in [41], two locality constrained representation-based KNN rules are presented to design an improved KNN classifier. The first one is a weighted representation-based KNN rule, in which the test pattern is considered as a linear aggregation of its KNN samples from every group, while the localities of KNN samples per group are represented as the weights constraining their related representation elements. Following, a classification decision rule is used to calculate the representation-based distance between the test pattern and the group-specific KNN coefficients. On the other side, the second rule is a weighted local mean representation-based KNN, where k-local mean vectors of KNN coefficients per group are initially estimated and then utilized to represent the test pattern. On the other hand, aiming at improving the performance of existing KNN classifiers and making them scalable and automatic, granular ball computing has been used in various frameworks. This is the case of [42], where a granular ball KNN (GBKNN) algorithm is developed, which could perform the classification task on large-scale data sets with low computation. In addition, it provides a solution to automatically select the number k of clusters.

Improved k-means clustering
In addition to the use of KNN and its variants, K-means clustering (KMC) is another important data clustering method. It has been widely investigated to classify similar data into the same cluster in large-scale data sets for different applications, such as appliance identification [43], anomaly detection [44], cancer detection [45], and social media analysis [46]. Despite the simplicity of KMC, its performance was not convincing in some applications. To that end, different variants have been proposed in the literature to design efficient, scalable and robust KMC classifiers. For example, in [47], to overcome the vulnerability of the conventional KMC classifier to outliers and noisy data, a tri-level k-means approach is introduced. This was possible through updating the cluster centers because data in a specific data set usually change after a period of time. Therefore, without updating the cluster centers it is not possible to accurately represent data in every cluster. While in [48], the authors focus on improving both the accuracy and stability of the KMC classifier. This has been achieved by proposing a k-means scheme based on density Canopy, which aims at solving the issue corresponding to the determination of the optimal number k of clusters along with the optimum initial seeds. Specifically, the density Canopy has been utilized as a pre-processing step and then its feedback has been considered as the cluster number and initial clustering center of the improved KMC technique. Similarly, in [49], an incremental KMC scheme is introduced using density estimation for improving the clustering accuracy. Explicitly, the density of input samples has been firstly estimated, where every primary cluster consists of the center points having a density superior than a given threshold along with points within a specific density range. Following, the initial cluster has been merged with reference to the distance between the two cluster centers before dividing the points without any cluster affection into clusters nearest to them.
On the other hand, in some specific data sets, e.g. real-world medical data sets, data samples could pertain to more than one cluster simultaneously while traditional KMC methods do not allow that since they are developed based on an exclusive clustering process. Therefore, an overlapping k-means clustering (OKMC) scheme is proposed in [50] to overcome that issue, which have intrinsically overlapping information. Similarly, in [51], the authors introduce a hybrid classifier that aggregates k-harmonic means and OKMC to address the sensitivity problem of the latter to initial cluster centroids.

Drawbacks and limitations
Despite the fact that the outlined event-based NILM systems have recently been widely examined in the state-of-the-art, they can be affected by certain problems and limitations, which impede the development of powerful NILM architectures and even increase the difficulty to implementing real-time NILM systems. Moreover, most of these issues have not yet been overcome. For example, most of existing solutions suffer from a low disaggregation accuracy. Therefore, these approaches need deeper investigation in order to improve their performance. Moreover, they are usually built upon detecting transient states, which can limit their detection accuracy if multiple appliances are turning on/off simultaneously. In addition, most of the reviewed NILM systems are only validated on one category of data with a unique sampling frequency. This restricts the applicability of these techniques on different data repositories. On the other hand, most of the existing classifier have some issue to accurately identify appliance-level data especially if the validation data set is imbalanced.
To overcome the aforementioned limitations, we present, in this framework, a novel non-intrusive load identification, which relies on (i) shifting power fingerprints into 2D space, (ii) deriving binary characteristics at local regions, (iii) representing the extracted features in the decimal field, and (iv) going back to 1D space via capturing novel histograms of the 2D representations. Following, these steps can help in designing a robust identification approach, which has various benefits; (i) via transforming the appliance signatures into 2D space, novel appliance footprints are developed that describe each appliance fingerprint in another way and texture descriptions are derived from local regions using square kernels; (ii) the proposed strategy helps in identifying appliances at accurately without depending on the devices' states (i.e. steady or transient); (iii) the proposed scheme can support real-time applications because it can be run at a low computation cost. Specifically, it acts as a dimensionality reduction component as well, where short characteristic histograms having only 256 samples are collected at the final stage to represent every appliance, and (iv) an improved KNN algorithm has been developed to overcome the issues occurring with imbalanced data sets and improve the appliance identification performance. Moreover, our 2D descriptor can be trained via simple machine learning algorithms without the need to deploy deep leaning models, which usually have a high computation complexity.

Proposed NILM based on 2D feature extraction
This section focuses on presenting the principal steps of the proposed appliance identification system, which relies on the application of an original 2D descriptor. Accordingly, the flowchart of the proposed NILM system is portrayed in Fig. 1. It is clear that the 2D-based load identification system represents the fundamental part of the NILM system.

Background of local 2D feature extraction
In recent years, 2D local feature extraction schemes have received significant attention in various research topics, including image and video processing [52], breast cancer diagnosis [53], face identification [54] and fingerprint recognition [55]. They are generally deployed to derive fine-grained characteristics after partitioning the overall 2D representation into various local regions using small kernels. Explicitly, a local feature extraction can be applied at each local region of the 2D representation to draw pertinent features about the neighborhood of each key-point. The multiple features derived from several regions are then fused into a unique, spatially augmented characteristic vector, in which the initial signals are effectively represented.

Event detection
For the event detection step, various event detection schemes are proposed in the state-of-the-art. Event detection techniques are split into three main groups [56]: specialized heuristics, probabilistic models and matched filters [57,58]. In this framework, the pre-processed aggregated power is segregated into different sections using the edge detector module [59] implemented in the NILMTK platform [60]. Accordingly, the on/off events of electrical devices are generally picked up via the analysis of power level variations in the aggregated signal. This event detector has been elected because of its simplicity and availability of its source code in the NILMTK platform.

Local power histogramming (LPH) descriptor
The proposed appliance identification scheme relies mainly on transforming the appliance consumption signals into 2D space and therefore treating the appliance recognition task as a CBIR problem. With this in mind, all image descriptors could be utilized to extract the fine-grained properties of the obtained 2D power signal representations.
In that respect, the proposed LPH-based feature extraction scheme transforms appliance signals to image representations. Following, an examination local regions around each power sample is performed using a block partition procedure to collect local features. Explicitly, LPH descriptor is introduced for abstracting histogram-based descriptions of the 2D representations of power observations. Accordingly, LPH performs a binary encoding of power blocks through comparing the central power sample of each block with its neighbors. Next, a binary sequence is then acquired by means of a clockwise-based comparison process. Consequently, the gathered binary samples represent the corresponding LPH codes. Moving forward, the overall binary sequences are gleaned from all the regions (kernels) to form a binary array, which in turn, is converted to the decimal field. Specifically, each binary sequence extracted from a specific block is converted to decimal (as it is illustrated in Fig. 2). Lastly, a histogramming procedure is applied on the resulted decimal array, in which an LPH histogram is extracted to represent the initial power signal. The whole steps of the proposed LPH descriptor are summarized in Algorithm 1. Moving forward, a histogram of 256 samples is derived to represent each appliance signature, which has significantly lower number of samples compared to the initial signal. Accordingly, LPH helps also in reducing the dimensionality of the appliance power signals. Therefore, this leads to efficaciously reducing the computation cost of our NILM system.

Improved k-nearest neighbors (IKNN)
This stage is responsible on predicting the labels of each power consumption observations P (t) that belongs to a specific micro-moment group. Consequently, the class identification step of SAD-M2 is applied in two stages using a 10-fold validation, i.e. the training and test. In the first one, device load usage fingerprints are learned along with their labels generated based on the rule-based algorithm described previously. Accordingly, 9 folds of the database are utilized randomly in each training phase while the remaining fold is employed for the test purpose.
Moving forward, selecting the value of K is of utmost importance for KNN model. However, power abnormality detection data sets suffer from the imbalanced classes issue, in which some classes include more consumption observations (i.e. majority classes) than other classes (i.e. minority classes). Accordingly, a salient drawback of conventional KNN schemes is related to the fact that if K is a fixed, user-defined value, the classification output will be biased towards the majority groups in most of the application scenarios. Therefore, this results in a miss-classification problem.
To avoid the issue encountered with imbalanced data set, some works have been proposed with the aim of optimizing the value of K, such as [61,62]. However, they are very complex to implement and can significantly increase the computational cost, which hinders developing real-time abnormality detection solutions. In contrast, in this paper, we introduce a simple yet effective improvement of KNN, which can maintain a low computational cost. It is applied as explained in Algorithm 2.
Overall, the proposed improved KNN helps in improving the appliance identification performance through enhancing the classification accuracy and F1 score results in addition to reducing the execution time as it will be demonstrated in the next step. Therefore, this could help in developing real-time abnormality detection solutions.

Evaluation and discussion
We concentrate in this section on presenting the outcomes of an extensive empirical evaluation conducted on four real-world data sets, namely UK-DALE [63], GREEND [64], PLAID [65] and WHITED [66]. They are which are vastly deployed to validate NILM and load identification frameworks in the state-of-the-art.  Step 1. Normalize and transform the appliance signature Y (i, :) into 2D space (image representation), as explained in Fig. 3.
Step 2. Calculate the LPH values of each power pattern (u c , v c ) in each specific kernel of size S × S, by comparing the central power pattern with its neighbor as follows: where j c refers to the central power sample, j n represents the n th surrounding power neighbor in a patch of size S × S and N = S 2 − 1. Moving forward, a binary encoding function b(u) is generated as: Step 3. Glean the binary samples LP H n,S (u c , v c ) generated from every kernel and therefore transform the obtained binary data into a decimal field in order to design a new decimal array I D (as it is explained in Fig. 2).
Step 4. Perform a histogramming procedure on the obtained decimal matrix for extracting an LPH histogram H LP H (n, S), which is measured from each patch. Thus, the resulted histogram is then used as a texture feature vector to represent the initial appliance signature. Finally, after conducting the histogramming process, a description histogram H LP H (n, S) is produced, which has 2 N patterns (i.e. with relation to the 2 N binary samples generated by N power sample neighbors of each block of data).
Step 5. Normalize the resulted histogram to make the value of each bin in the range [0,1].
end Figure 3: Conversion of 1D signal into 2D representation.

Algorithm 2: IKNN algorithm used to classify appliances based on their LPH signatures.
Result: Predicting class labels of test samples Read the training appliance histograms extracted using LPH in Algorithm 1. while j ≤ J (with J is the number of test appliance histograms to be identified) do Step 1: Compute the information-entropy of every appliance histogram b that is deployed to estimate its information gain. Thus, it operates as the weight of appliance histograms power consumption observations to allocate priorities to each of them; where B is the training ensemble, |B| as the number of training data, a i = |c i , B| / |B| and a i refers to the probability that an random histogram in B pertains to class c i Step 2: Define the k values of the training ensemble; Step 3: Partition the training ensemble into m sub-groups; Step 4: Estimate the mean value of each sub-group to derive its center; Step 5: Identify the sub-group that is closest to a test histogram b j via estimating the Euclidean distance between each test observation and the center of each sub-group as follows: where c i represents the central instance of the i th sub-group and i = 1, 2, · · · , m.
Step 6: Estimate the weighted-Euclidean distance wd j between the test histogram b j and every histogram in the closest sub-group as follows: Therefore, this results in determining the k nearest neighbors; Step 7: Compute the weighted class probability of the test histogram b j as follows: where y 1 , y 2 , · · · , y k refer to the k nearest neighbors of the test histogram b j , C denotes the finite set of the appliance class labels, δ(c, c(y i )) = 1 if c = c(y i ) and δ(c, c(y i )) = 0 otherwise. end

data set description
The three power consumption repositories considered in this framework are gleaned at distinct sampling rates (i.e. 1/6 Hz, 30 kHz and 44 kHz) to perform a thorough evaluation study and inform the effectiveness of the proposed solution when the sampling rate of the recorded appliance consumption signals varies.
Under UK-Dale, power usage footprints have been gathered for a long time period ranging 2 to 4 years at both sampling frequencies of 1/6 Hz and 16 kHz (for aggregated data). In order to assess the performance of proposed scheme, we exploit the consumption fingerprints gleaned from a specific household at 1/6 Hz, which encompasses nine appliance categories and each category includes a large number of daily consumption signatures. Moving forward, power traces of six different appliances collected under GREEND [64] are also considered, in which a sampling frequency of 1 Hz has been used to record energy consumption footprints for a period of more than six months. Under PLAID, the power signatures of 11 device groups have been recorded on the basis of a frequency resolution of 30 kHz. Moreover, load usage footprints of the WHITED have been gleaned with reference to 11 appliance classes at a frequency resolution of 44 kHz. The properties of each data set, their appliance categories and the number of observed appliance/days are recapitulated in Table 1.

Evaluation metrics
Aiming at evaluating the quality of the proposed appliance identification objectively, various metric are considered, including the accuracy and F1 score, normalized cross-correlation (NCC) and histogram length. The accuracy is introduced to measure the ratio of successfully recognized devices in the testbed, but it is nonetheless not enough to evaluate the performance of an appliance identification system giving that alone it is not regarded as a reliable measure. This is mainly the the case of imbalanced data sets, in which the power samples are not uniformly distributed (e.g. in this framework, both PLAID and WHITED data sets are imbalanced). To reinforce the objectivity of the evaluation study, F1 score is also recorded as well, which is considered as a fairly trustworthy metric in such scenarios. Explicitly, F1 score describes the specified as the harmonic average of both the precision and recall measures.
where T P , T N , F P and F N depict the number of true positives, true negatives, false positives and false negatives, respectively.
F 1score = 2 × precision × recall precision + recall (10) where [precision = T P T P +T F ] and [recall = T P T P +F P ]. Additionally, normalized cross-correlation (NCC) has been deployed to measure the similarity of the raw appliance signatures and LPH histograms derived form original power signals. NCC is also described via calculating the cosine of the angle θ between two power signals (or extracted characteristic histograms) x and y:

Performance in terms of the NCC
It is of utmost importance to comprehend at the outset how LPH histograms varies from the initial appliance power signatures. Accordingly, this subsection focuses on investigating the nature of the relation between appliance power signatures that pertain to the same appliance class. In addition, this can aid in understanding the way LPH histograms could improve the discrimination ability between appliances belonging to different classes and on the other flip increasing the similarity ratio between appliance from the same group.
To that end, six appliance signatures s1, s2, · · · , s6 have been considered randomly from every device category of the UK-DALE data set. Moving forward, the NCC performance has been measured between these signatures to evidently demonstrate why the LPH can results in a better correlation between the signatures of the same device category. Fig. 4 outlines obtained NCC matrices, which are calculated between the six raw power signals (left side) and the LPH feature vectors (right side), respectively. Both raw power signals and LPH vectors are gleaned from four device groups, defined as the washing machine, fridge w/ freezer, coffee machine and radio. It can be shown from the plots in the left side of Fig. 4 that NCC rates are quiet low and vary randomly. Specifically, it is hard to identify a certain interval specifying the limits of the NCC rates. On the other side, when measuring the correlation between LPH vectors as indicated in the right side of Fig. 4, NCC values outperform those obtained from the raw power signals. Overall, NCC rates gleaned from LPH vectors are generally more than 0.97 for all appliance groups investigated in this correlation study. Fig. 5 portrays an example of six appliance signals extracted from UK-DALE database, their encoded 2D representations and final histograms collected using the LPH descriptor. It is worth noting that each appliance signal is represented by a unique image in 2D space and further by a specific histogram in the final step. It has been clearly seen that via transforming the appliance signals into 2D space, they have been considered as image, where we can use any 2D feature extraction scheme to collected pertinent features. Moreover, through adopting the 2D representation, every power sample has been encircled by eight neighboring samples instead of only two neighbors in the 1D space. Therefore, more opportunities have been available for extracting fine-grained characteristics from each device signature in reliable way. Consequently, it could help effectively correlate between devices that pertain to the same device group, and in contrast, it increases the distance between devices corresponding to distinct categories. In addition, the LPH-based load identification system does not relies on capturing the appliances' states (steady or transient). This represents and additional benefit of the proposed solution, which could recognize each electrical device without the need to collection state information.
Moreover, even the neighborhood is temporary distant in 2D space but this gives us various possibilities to encode the power signal. Therefore, this results in better correlation and discrimination abilities and hence a better classification performance of the power signals. In the contrary, if the signal is processed in the original 1D space, the possibilities for encoding the signal are very limited. Thus, the correlation and discrimination abilities lose their efficacy since the classifiers frequently make confusion in identifying appliances using the features generated in this space.

Performance compared to different ML classifiers
We present in this subsection the performance of the proposed appliance identification system based LPH-IKNN in comparison with different classifiers, namely conventional KNN, DT, SVM, DNN and EBT. Specifically, Table 2 reports the accuracy and F1 scores collected under UK-DALE, PLAID and WHITED data set, in which a 10-fold cross validation is adopted.
It is clearly shown that the proposed IKNN classifier based on both Euclidean distance and weighted Euclidean distance outperforms the other classification models, it provides the best results on the three data sets considered in this framework. For instance, it achieves 98.50% and 98.49 F1 score under UK-DALE while the performance has slightly propped for both the PLAID and WHITED data sets. Accordingly, 96.85% accuracy and 96.18% F1 score have been obtained under PLAID and 96.5% and 96.04% have been attained under WHITED. This might be justified by the rise of the sampling frequency in both PLAID and WHITED data sets, where data have been gleaned at 30 kHz and 44 kHz, respectively, in contrast to UK-DALE, in which consumption footprints have been gathered at a resolution of 1 Hz. Moreover, it is important to notice that the LPH descriptor serves not only as a feature extraction descriptor but as a dimensionality reduction approach as well. Explicitly, for each appliance signal, the resulting LPH vector encompasses only 256 samples while the initial appliance signals include much higher samples (e.g. 22491, 57600 and 30000 samples WHITED, UK-DALE and PLAID, respectively). This drives us to determine that the proposed LPH-IKNN solution operates better under low frequencies. All in all, the performance obtained with LPH-IKNN are very promising because they are all superior than 96% for all the data sets considered in this study.
On the other side, it is worth noting that the proposed LPH descriptor can be trained using simple ML algorithms without the need to deploy deep leaning models, which usually have a high computation complexity. In this direction, it was obvious that conventional classifiers, e.g. LDA, DT, EBT, SVM and KNN outperforms significantly the DNN classifier, especially under UK-DALE and GREEND data sets.

Comparison with existing 2D descriptors
The promising results of the proposed LPH obtained under the three data sets considered in this study has pushed us to investigate the performance of other 2D descriptors in comparison with our solution. Accordingly, in this section, we investigate the performance of three other feature extraction schemes.
• Local directional patterns (LDP): After transforming the power signal into 2D space, for each pattern of the power array, an 8-bit binary sequence is derived using LDP [67]. The latter is measured via the convolution of small kernels from the power array (e.g. 3 × 3) with the Kirsch blocks in 8 different orientations. Fig. 6 portrays an example of the Kirsch blocks used in LDP. • Local ternary pattern (LTeP): Unlike LPH, LTeP does not encode the difference of power patterns in every kernel into 0 or 1, but encode them into other quantization values using a thresholding process [68]. Let consider thr is the threshold parameter, s c presents the central power pattern in a patch of 3 × 3, and s n stands for the neighbor patterns, every central pattern s c can be encoded as follows: if s n > s c + thr 0 if s n > s c − thr and s n < s c + thr −1 if s n < s c − thr   • Local binary pattern (LBP): Is a texture descriptor that presents a low computation complexity along with a capability to capturing a good part of textural patterns of 2D representations. LBP represents micro-patterns in power matrices by an ensemble of simple computations around each power sample [70].  Figure 6: Kirsch kernels utilized in the LDP approach.
• Binarized statistical image features (BSIF): It constructs local descriptions of 2D representations via effectively encoding texture information and extracting histograms of local regions. Accordingly, binary codes for power patterns are extracted via the projection of local power regions onto a subspace, where basis-vectors were learnt using other natural images [71]. Conversely, the performance variation reported under the different data sets is due to frequency resolutions variation, in addition because UK-DALE records appliance power consumption for multiple days (i.e. it collects the consumption   Figure 7: The performance of LPH descriptor compared to other 2D feature extraction schemes in terms of (a) accuracy, and (b) F1 score.
from the same devices but for distinct days for a long period) while PLAID and WHITED data sets observe different devices from distinct manufacturers (brands) and which are belonging to the same device category.
Moving forward, we have evaluated the computation cost of the proposed appliance identification scheme based on different 2D descriptors in order to demonstrates its applicability in real-time scenarios. Accordingly, the computation time for the training and test phases of our approach have been computed using MATLAB 9.4. The computational costs are computed on a laptop having a Core i7-85500 with 32 GB RAM and 1.97 GHz. Table 4 depicts the obtained computational times (in sec) with regard to various 2D descriptors under the three data sets adopted in this framework.
Accordingly, it has been clearly seen that the appliance identification based LPH achieves the lowest computational time in comparison with the other descriptors for both the training and test stages under the three data sets. Moreover, the test time of LPH based solution under PLAID and WHITED is less than 1 sec, which can proves that it is possible to implement it for real-time applications since most of the transmitter can transmit data with a sampling rate of more than 1 sec. On the other flip, the test time of the LPH based solution has increased under UK-ALE to more than 2 sec because in this case long daily consumption signatures are analyzed. In contrast to PLAID and WHITED, where short appliance fingerprints from are considered.   increases the credibility of the our study and proves that it could be deployed under different scenarios without caring about the sampling rate.

Comparison with existing load identification frameworks
All in all, it is of significant importance to mention that the proposed LPH-IKNN has been validated using four different data sets (i.e. UK-DALE, GREEND, PLAID and UK-DALE) including different kinds of power signatures recorded (i) with distinct frequency resolutions, and (ii) under different scenarios. For instance, under both UK-DALE and GREEND, we collect the power consumption signatures that vary through the time for a set of appliances (i.e. each daily consumption trace represents a power signature); while under both PLAID and WHITED, for each appliance category, the power traces are gleaned from different manufacturers. In this regard, validating our solution under these data sets using different scenarios, has helped in (i) showing its high performance although the frequency resolution has been changed, and (ii) proving its capability to be implemented in real-application scenarios since it can identify appliance-level data even if they are from different manufacturers and although the power signatures change from a day to another.

Conclusion
In this paper, a novel method for performing accurate appliance identification and hence improving the performance of the NILM systems has been presented. The applicability of a local 2D descriptor, namely LPH-IKNN, to recognize electrical devices has been successfully validated. Consequently, other types of 2D descriptors can be investigated in order to further improve the identification accuracy, such as local texture descriptors, color histograms, moment-based descriptors and scale-invariant descriptors. This line of research is full of challenges and plenty of opportunities are available. Moving forward, in addition to the high performance reached, the LPH-IKNN based appliance identifications scheme has shown a low computational cost because of the use of a fast 2D descriptor along with the IKNN, which uses a smart strategy to reduce the training and test times. Furthermore, LPH-IKNN acts also as a dimensionality reduction, in which very short histograms have been derived to represent appliance fingerprints.
On the other hand, although LPH-IKNN has shown very promising performance, it still has some drawbacks among them is its reliance on a supervised learning process. Explicitly, this could limit its application in some scenarios, where it might be difficult to collect data to train the proposed model. To that end, it is part of our next future work to change the learning process by building an improved version of this LPH-IKNN using an unsupervised learning approach. Moreover, another option is by adding a transfer learning module to eliminate the need to collect new data for training our system if the sampling frequency of collected data is changed. Moreover, IKNN classifier could be replaced by any other improved algorithm that enables an automatic selection of the k value to simplify the use of LPH-IKNN in real application scenarios. In this context, the GBKNN classifier discussed in Section 2.2.1 seems to be a good alternative that could be investigated in our future work.
On the other hand, due to the size of appliance identification based data sets is not very large, it will be of significant importance to investigate the use of other feature extraction methods in our future work, which are very convenient for small data sets, e.g. rough set based techniques [78,79]. The latter helps also in attribute reduction and feature selection and hence it could further reduce the computational cost of the appliance identification task to support real-time applications. Finally, it will also be part of our future work to focus on developing a powerful recommender system, which can use the output of the LPH-IKNN based NILM system to detect abnormal power consumption in buildings before triggering tailored recommendations to help end-users in reducing wasted energy.