FSM Finite State Machine. 23

Keywords: Integer Programming, 51, 14 PCR Principal Component Regression, 9 WSN wireless sensor network, 56 ix

This work was carried out in the "Systèmes et Technologie de l'Information et de la Communication (STIC)" laboratory at the University of Tlemcen. I would also like to thank the members of this laboratory. Starting with the heads of this laboratory, Mr LEHSAINI and Mr FEHAM, who welcomed me to the laboratory for their availability, invaluable advice

List of Figures

 1.18The difference between traditional machine learning and deep learning [START_REF] Wang | Deep learning algorithm-based financial prediction models[END_REF] 1. [START_REF] Xie | Unsupervised deep embedding for clustering analysis[END_REF] The structure of deep embedded clustering (DEC) [START_REF] Kaddour | Toward unsupervised nonintrusive load monitoring using convolutional deep embedded clustering[END_REF] . . . . . . . . . . .

Introduction

Introduction

Context

Over the last ten years, increasing energy demand and climate change restrictions have put pressure on energy resources. To tackle this challenge, researchers worldwide have been exploring two main streams of energy-related research. One focuses on finding renewable energy sources (RESs) like solar, wind, and hydro energy to reduce greenhouse gas emissions. According to the 2DS paradigm report, a 74% increase in RESs alone can lead to net-zero CO2 emissions in the power sector by 2060. While they offer a promising alternative to fossil fuels, these technologies face challenges such as weather dependence and high troubleshooting costs. The second research stream of scientists is dedicated to discovering innovative optimization technologies capable of meeting energy demands with both efficiency and adaptability to unexpected surges or drops in power.

Achieving energy preservation requires a crucial initial step of keeping track of energy usage in residential areas, which accounts for 33.6% of global energy demand. The grids must be flexible and reliable to ensure seamless power generation, transmission and distribution according to available resources and demand. In addition, energy monitoring systems installed in buildings must be efficient in promoting energy conservation and wastage reduction. Intelligent systems play an important role in this regard as they require detailed knowledge regarding energy consumption at the appliance level. Such knowledge is essential in improving response time, accuracy of detection, and facilitating proactive measures.

In the realm of acquiring measurements, two research directions hold sway: intrusive and Non-Intrusive Load Monitoring (NILM). The intrusive approach involves embedding sensors and meters on each device, rendering it highly precise but financially demanding in troubleshooting and implementation. On the other hand, with NILM, one smart sensor installed at the electricity entrance is sufficient to infer energy usage across all appliances from the load aggregate. However, an accurate energy desegregation model is crucial for effective implementation.

This thesis offers a comprehensive work-plan that focuses on developing a non-intrusive load monitoring (NILM) technique that caters mainly to residential buildings. Although NILM techniques for appliance event detection and load desegregation have been around for nearly three decades, this work provides solutions that address the specific challenges posed by commercial and industrial settings. Commercial and industrial environments typically involve the use of multiple equipment simultaneously, which makes detecting Introduction and monitoring sub-machine loads and events more complex. In contrast, residential buildings present unique challenges such as the variety and number of appliances that can impact the accuracy of event detection when multiple appliances function simultaneously.

Motivation

The evolution of energy technology such as smart grids has opened up a world of possibilities for energy monitoring in the future. To achieve this, intelligent "smart meters" were introduced into the grid to communicate and generate vital data on end-user energy consumption behavior to stakeholders. Though these meters provide an overall view of consumption to both customers and stakeholders, the data collected is insufficient for accurate predictions or to infer insightful details on energy usage.

The path towards efficient electricity usage lies in the hands of consumers and their behavior. Conscious consumption is key to reducing overall energy consumption. Awareness of real-time, appliance-specific details is necessary to achieve this goal. By adopting this strategy, Demand-Side Management (DSM) programs can be monitored and implemented more effectively. The inherent variability of weather patterns, which impact renewable energy sources (RESs), necessitates a degree of adaptability in managing the resulting fluctuations in energy production and demand. As a solution, providing detailed consumption information at the appliance level to end-users has proven effective in saving significant amounts of energy, as demonstrated in J. Kelly's research [START_REF] Kelly | Neural NILM: Deep Neural Networks Applied to Energy Disaggregation[END_REF][START_REF] Kelly | The UK-DALE dataset, domestic appliance-level electricity demand and whole-house demand from five UK homes[END_REF]. In fact, findings indicate that raising awareness and providing real-time feedback can result in energy savings up to 4.5%.

The upcoming trend in architecture involves the integration of intelligent technology into homes and buildings. This technology not only assists residents in automatic management of essential operations but also employs weather-based renewable generation and storage systems and Home Energy Management Systems to ensure optimal functioning. The key to precise operation lies in measuring the energy consumption of individual appliances; this information allows consumers to distinguish between power-hungry appliances and perform demand response (DR) for local load management.

Methods for obtaining appliance-level consumption information can be categorized as either single-point or multi-point sensing meters. The latter involves installing specific meters on home energy appliances, known as Intrusive Load Monitoring (ILM). This technique provides precise readings, but can be challenging and costly to implement and troubleshoot, even with long-lasting, cost-effective sensors. The former approach, singlepoint sensing, involves taking measurements at the main electrical input, making it a simpler and more straightforward option. The aim is to gauge the total energy consumption of the establishment, akin to smart meters. As machine learning methods rose in popularity, novel processes surfaced for determining appliance-level usage through a solitary point sensing system-known as non-invasive load monitoring.

Introduction

particularly in complicated settings. The objective of this study is to enhance the monitoring systems for residential energy consumption and the event detection abilities of energy monitoring systems based on NILM. An effective home energy monitoring system should be capable of obtaining precise readings of energy consumption, and also of deducing significant data about unusual consumption and measurements at the appliance level to enable the seamless processing of operations.

Challenge 1: What are the machine learning approaches that can be employed to identify household appliances with irregular energy-consumption patterns in residential structures ?

Challenge 2: What are the necessary features to be employed during the DAQ stage in order to identify events? Challenge 3: What is the impact of sampling frequency on the accuracy of detecting appliance events? And can simultaneous events be minimized through the use of highfrequency DAQ? Challenge 4: What is the best way to utilize high-frequency DAQ without compromising data quality and overwhelming storage capacity? Challenge 5: Is utilizing supervised approaches for addressing NILM application a restricted solution in regards to scalability and portability? Challenge 6: Given that readings of residential energy consumption are confidential by law, what is the most appropriate strategy to safeguard the privacy of residents?

Approaches used

The primary focus was on monitoring home energy consumption. To achieve this, three innovative approaches were proposed. Firstly, a machine-learning method was utilized to develop an appliance-level energy consumption detector. Secondly, an event detection algorithm founded on Tukey's fences approach was introduced to analyze the collected data for switch event detection. Lastly, a deep clustering-based unsupervised solution was proposed for NILM application. Let us explore these strategies in greater detail.

Abnormal energy consumption detection in residential buildings

The implementation of Smart Grids necessitates the collection and examination of copious amounts of data. This process, however, has its limitations, as data overload can lead to difficulties in identifying malfunctioning apparatus and appliances, ultimately causing a drop in performance. To address this problem, researchers shifted their focus towards identifying local variances in Home Energy Management System (HEMS) level buildings. When irregular shifts in electricity consumption patterns are detected, building proprietors and occupants are promptly notified of the issue, whether it is a result of human or material error. This approach also benefits energy providers within Smart Grids, as it im-Introduction proves their ability to estimate and anticipate future energy consumption trends through better demand-response performance.

NILM Event Detection for residential buildings

To achieve effective NILM decomposition, detecting events with precision is vital. Home Electrical Appliance (HEA) switching events (on/off) require precise feature extraction, diverse HEA representation, and occupancy statistics. In reality, detecting lower power consumption devices becomes increasingly arduous as the power consumption percentage drops. Wong et al.'s [START_REF] Wong | Recent approaches to non-intrusive load monitoring techniques in residential settings[END_REF] study classifies NILM methods into two categories: event-based and non-event-based methods. The former identifies critical points in time when power consumption varies significantly and then monitors the responsible devices to estimate the event duration. The latter, however, focuses on detecting device states from the instantaneous properties of the current and voltage signals rather than detecting events. Low-powered SMPS-equipped office appliances require an event-based approach for accurate event detection.

DEC-based NILM Application (DEC-NILM)

Developing successful DNN-based NILM prototypes demands vast amounts of labeled training data on the client side, which can be both expensive and difficult to obtain, raising concerns about data security and user privacy. This issue is addressed in this section through our proposed unsupervised deep learning method, Seq2point, which is event-based and comprises two steps. The first step is event detection utilizing TFED detector, and the second is load identification via DEC algorithm. Further details on the TFED detector, the DEC algorithm [START_REF] Xie | Unsupervised deep embedding for clustering analysis[END_REF], and the UK-Dale dataset are discussed in the following chapters.

Contributions

Several methods have been proposed for detecting abnormal energy consumption through unsupervised approaches.

• To detect any unusual spikes in energy consumption at the household appliance level, we employed a machine learning technique. Our approach leverages three methods that include the one-class SVM, isolation forest, and KMeans.

• To detect unusual energy consumption, we employed unsupervised methods to improve the flexibility and expandability of Home Energy Monitoring System (HEMS).

Detecting events from an aggregated load is a complex task, particularly in intricate settings where several comparable appliances function simultaneously. Our NILM-derived approach to event detection offers significant contributions, such as:

• Our proposed method relies on an unsupervised approach, eliminating the need for a probabilistic model or training process. Instead, it simply identifies a valid change point.

• By combining Tukey's fences outlier detection method with fast Fourier transform, we have developed an adaptive threshold to handle unforeseeable and intricate fluctuations in the load, including high variations. Our solution ensures accurate and reliable event detection through an extensive case study conducted on the BLUED dataset, which is a building-level fully-labeled electricity desegregation database [START_REF] Makonin | Exploiting HMM Sparsity to Perform Online Real-Time Nonintrusive Load Monitoring[END_REF]. Even with one random set of initial parameters, our method displays superior accuracy and robustness as compared to existing fixed-parameter techniques, which are often insufficient to manage highly complex load variations.

The DEC-NILM methodology boasts several unparalleled contributions, which we outline below:

• Our innovative approach to NILM involved the development of a DEC-NILM solution. By leveraging the unsupervised clustering capabilities of Deep Embedded Clustering (DEC) in tandem with the non-linear problem-solving capacity of autoencoders, we were able to create a powerful tool that effectively reduces dimensionality and allows for K-Means clustering.

• We enhanced confidentiality, Our approach included local processing of confidential information and employing unlabelled data to train the model, which effectively minimized the risk of leakage.

• Our efforts to prioritize confidentiality were successful, as we adopted a method of processing sensitive information locally and utilized unmarked data for model training. By doing so, we were able to significantly reduce the possibility of any potential data leaks.

Manuscrit organization

This thesis is organised into five chapters:

• Chapter 1 is introduced to provide a comprehensive understanding of the basics of energy monitoring, particularly the non-intrusive load monitoring technique and presents the background of existing smart energy technologies.

• Chapter 2 examines the methods used for detecting abnormal energy consumption and different event detection techniques utilized in NILM literature, with a particular focus on high-frequency energy event detectors.

• In Chapter 3, the focus is primarily on addressing challenge 1. Here, the various machine-learning approaches used for online anomaly detection in energy consumption are discussed, with a view to enhancing the performance of HEMS and enlightening customers on over-consumption issues For convenience, the event detector proposed in this chapter is based on Tukey's Fences.

• The focus of Chapter 5 lies on addressing challenges 5 and 6 via an innovative strategy called the DEC-NILM approach. This unsupervised technique uses the DEC model, a fusion of autoencoders and K-Means, to tackle these challenges. Moreover, this chapter offers insights into various aspects of designing and assessing anomalous energy consumption and NILM event detectors in intricate and demanding settings, along with suggestions for future work.

Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies

Chapter 1

Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies

Introduction

Humans, energy, and the environment have a complex relationship. Nowadays, the main concern is to efficiently guarantee dependable energy provision to users without impacting the environment. Indeed, With the rapidly growing population worldwide, new energybased activities and enhancing living standards will eventually expand the electricity demand. Hence, electric utility companies face new challenges. The "Energy Information Administration (EIA)" predicts that the power sector electricity demand will reach 40%.

In addition, the residential and commercial sectors' electricity demand will be 25% more than the current year in 2025. Furthermore, EIA projects that electricity consumption will be increased by 50% between 2018 and 2050 [START_REF]Energy Information Administration: International Energy Outlook 2019[END_REF]. Traditional power technologies cannot meet this rising electricity demand and cope with modern challenges. Fossil fuel-based power plants have been constructed to cope with increasing electricity demand. However, fossil fuel-based power plants emit greenhouse gases, influencing environmental sustainability. Society needs to mitigate such threats and improve environmental sustainability by taking counteractions regarding ecological concerns.

Limited fossil fuel, intermittent "RESs", carbon emissions, and rising electricity demand are the challenging aspects that enforce the research and development of new smart energy solutions. Soft sensors and complex systems, Modern energy-related solutions such as "Smart Grids (SGs)", "Energy Monitoring Systems (EMS)", "Smart Meters (SM)", "NILM", "Machine Learning (ML)", and "Deep Learning (DL)" are discussed in this chapter.

Soft Sensing

Soft sensor, a widely used term in the process industry, is a fusion of "software" and "sensor". These models are typically computer programs that provide analogous data to their hardware equivalents. Another synonym used for predictive sensors is "inferential sensors" [START_REF] Kadlec | Data-driven Soft Sensors in the process industry[END_REF][START_REF] Haimi | Data-derived soft-sensors for biological wastewater treatment plants: An overview[END_REF]. Soft sensing refers to the use of mathematical models and algorithms Chapter 1. Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies to estimate and predict process variables in industrial processes or systems. It is a noninvasive method of measuring physical or chemical properties that are difficult or expensive to measure directly, such as temperature, pressure, flow rate, or composition. A more simple definition is that soft sensors are models that infer hard-to-measure variables using easy-to-measure variables as illustrated in Figure 1 Soft sensing offers a number of advantages over traditional measurement techniques, such as reduced costs and maintenance, improved accuracy and reliability. It also allows processes to be monitored and controlled in real time, enabling rapid adjustments to maintain optimum performance. It has applications in a wide range of industries, including chemical processing, power generation, pharmaceuticals, food and beverage, and many others. It is an important tool for process optimisation, quality control and process safety.

Soft sensors in the processing industry

The topic of soft sensors is thoroughly explored in this section. Firstly, the two types of soft sensors are differentiated. This is followed by an in-depth analysis of the state-of-theart Soft Sensor development approach. Furthermore, this section presents an extensive overview of various case studies that have implemented soft sensors.

• Model-driven and data-driven Soft Sensors: Soft sensors are broadly classified into two types: model-driven and data-driven. White-box models, also known as model-driven models, have complete knowledge of the background to the process. On the other hand, black-box models, also known as data-driven models, rely solely on empirical observations to operate. Many models lie between these two extremes, some combining data-driven methods to model complex phenomena that cannot be explained by phenomenological models. Such models are called grey-box models, to differentiate them from hybrid combinations of computational learning methods, which are referred to as hybrid models [START_REF] Haimi | Data-derived soft-sensors for biological wastewater treatment plants: An overview[END_REF].

Soft Sensing

Focused on the planning and development of process plants, "Model-Driven Models (MDMs)" such as FPM are based on equations that detail the physical and chemical principles governing the process. For instance, a reaction rate equation accounts for mass-preservation principles, energy balances, and exothermal equations. Despite their usefulness, MDMs have a significant drawback: they require expert process knowledge, which is not always available. In addition, describing the intricacies of a biochemical process presents a challenge since there is often limited phenomenological knowledge to rely on. Moreover, while MDMs provide a theoretical background of the process, they often fall short of depicting the practical, real-life factors that shape the process. While model-driven models emphasize the ideal steady state of a process, they are not suitable for describing transient states. However, they remain a popular choice as soft sensors for inferential control. The first principle of soft sensors is applied to inferential control in various cases.

Our primary focus lies on "Data-Driven Models (DDMs)", which have attracted the attention of experts for their exceptional ability to improve diagnostic, prognostic and decision-support techniques in plant operations. These models are based on actual recorded and stored measurements, which are made available by PIMS as historical data. MDDs are based on empirical predictive methods such as "Principal Component Regression (PCR)", "Multi-Layer Perceptron (MLP)" and new deep learning techniques.

• Soft sensor development methodology: The procedure outlined in this section covers the general steps and challenges involved in developing soft sensors as depicted in 1.2, which can be used in both continuous and batch processing, as well as in any of the discussed application areas.

Figure 1.2: Soft sensor development methodology [START_REF] Kadlec | Data-driven Soft Sensors in the process industry[END_REF] Chapter 1. Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies 1. First data inspection: During this initial phase, the data is analyzed to understand its structure and to recognize any obvious flaws that may affect the model. An accomplished developer can determine the complexity of the model's requirements, which will influence their decision on whether to utilize a simple regression model, a more complex "Principal Component Analysis (PCA)" regression model, or a nonlinear neural network. However, it is important to assess and compare the performance of the models against other alternatives later in the development process as the family of models chosen at this stage may not be accurate. The evaluation of the target variable is also necessary to determine whether there is sufficient variance in the output variable that can be accurately modelled.

Selection of historical data and identification of stationary states:

The first step in preparing a model is to select the data for training and evaluation.

Identifying and selecting the stationary elements of the dataset is essential for modelling. In general, only stationary states of the process are considered for further modelling. Determining the stationary states of the process generally requires manual annotation of the data.

3. Data pre-processing: For machine learning models, data pre-processing is an essential initial step. It involves modifying the data to optimise its use by the model and encompasses a wide range of operations such as handling missing data and outliers, normalizing, variable selection, identifying delays between variables and dealing with drifting data. When working with data from the processing industry, pre-processing is particularly crucial, as it usually requires iterative manual effort and expert advice. This stage highlights the importance of pre-processing such data, while emphasizing the need to improve the streamlining and automation of the process.

Model selection, training, and validation:

The development of a soft sensor involves crucial decisions about model selection and its parameters, which have a significant impact on sensor performance. Unfortunately, there is no established framework for this process, and model selection is often based on personal preference or ad hoc methods, which can be detrimental to the final product. To address this problem, one possible approach is to start with a simple model and gradually increase the complexity of the model until there is a significant improvement in performance. To evaluate model performance, independent data and statistical error estimation techniques such as ensemble methods and K-fold cross-validation should be used. Finally, it is essential to evaluate the performance of the soft sensor using numerical or visual evaluation tools on independent data. It is necessary to apply process knowledge during the development phase of the soft sensor in order to improve its performance.

5. Soft Sensor maintenance: Soft sensors are sensitive to inaccuracies and registration errors, which can have a negative impact on their performance and require regular maintenance and modification of the model. However, most soft sensors do not have automated maintenance mechanisms, resulting in high manual maintenance costs. In addition, it is not always possible to determine whether a soft sensor model is of high quality, making it subjective to determine 1.2. Soft Sensing whether a model is effective or ineffective. In literature, we can find various adaptive methods for soft sensor maintenance, including adaptive versions of "PCA" and "Partial Least Squares (PLS)", neuro-fuzzy-based software sensors and local learning. These methods have the advantage of being automated, but the model operator still plays an important role in selecting the appropriate parameters for the adaptation methods, based on his knowledge of the process and his judgement.

Soft sensor applications

Soft sensors are used in many areas of the manufacturing industry. Common examples include the chemical, pulp and paper and steel industries. The following sections provide examples of the three most common uses of soft sensors in these different areas of the process industry.

• Online Prediction: Soft sensors are used to predict values that cannot be measured immediately using automated technology, for example because of a technological or economic barrier. Soft sensors are frequently employed in industrial processes that have complex dynamics, where rigorous models cannot be easily built, and historical data is used to build data-driven models. In addition, "Linear Regression Models (LRM)" and "Locally Weighted Regression (LWR)" are used in soft sensor models and provide examples of soft sensor applications in processes such as milling, fermentation, polymerization and refining. The paper also compares the performance of soft sensors to other common techniques such as ANN, and demonstrates that soft sensors can give comparable or better results in certain scenarios.

• Process monitoring and process fault detection: Another purpose of soft sensors is process monitoring. Process monitoring can be an unsupervised learning or binary classification task. These systems can be instructed to describe/analyse the typical operational state or to recognise potential process faults. Often, process monitoring methods are derived from statistical techniques that involve multiple variables.

• Sensor fault detection and reconstruction: Faulty sensors and faulty processes need to be identified and replaced before soft sensors can be developed and implemented in the process industry. The use of "PCA" is recommended to detect and treat faulty sensors and processes. Faults are identified in the residual space of the PCA and the specific sensor responsible for the fault is identified. The method is evaluated in the continuous process of an industrial boiler and then extended to dynamic processes using timed PCA. Other PCA-based soft sensors are also examined, including one for a centrifugal cooling system and one for monitoring an "Air Handling Unit (AHU)", which uses an expert system to process signals from two PCA sub-models.

This question is addressed in the field of soft sensing. The most common methods for building soft sensors are statistical techniques that use multiple variables, known as Chapter 1. Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies multivariate techniques, which together account for 38% of the applications in this study. Neural network-based approaches such as MLP, RNN, DNN, etc. are another popular methods of soft sensing. However, some of the more recent approaches are based on methods that have only recently become common in wider applications. These include neuro-fuzzy methods, which have the advantage of having an intrinsic mechanism for adaptation and evolution. In addition, "Support Vector Machines (SVMs)" are based on a theoretical foundation of machine learning and have proven their performance in a large number of different fields. Complex systems are characterized by the interconnection of multiple components, giving rise to emergent behaviors that cannot be understood by analyzing the individual components in isolation. These systems often exhibit feedback loops, non-linear dynamics, and self-organization, leading to intricate and unpredictable behavior. In contrast, environments encompass the external conditions, both physical and social, in which a system operates. An environment can be seen as the collective influence of all external factors and conditions that impact the behavior and development of a system.

Complex systems

Within the realm of complex systems, environments are dynamic and constantly evolving entities. They consist of numerous interacting components that can both shape and be shaped by the complex system under consideration. Understanding the intricate interplay between a complex system and its environment is crucial for accurately modeling, analyzing, and controlling the system's behavior.

In the context of energy management, one encounters one of the most complex systems due to its reliance on external factors. The behavior and performance of an energy management system are heavily influenced by a multitude of external factors, including 1.4. Smart Grids weather conditions, economic situations, political decisions, social habits, and geographical location as shown in 1.3. The intricate interdependencies among these factors make the modeling and analysis of energy management systems particularly challenging. Additionally, some of these external factors, such as political decisions and social habits, are inherently difficult to predict accurately, further adding to the complexity of the system.

Effectively navigating and managing energy management systems requires a comprehensive understanding of the interactions between the system and its environment. By considering the dynamic nature of the environment and the intricate relationships between external factors and system behavior, it becomes possible to develop more robust models, devise effective control strategies, and make informed decisions to optimize energy management processes.

In conclusion, complex systems exhibit emergent behaviors that cannot be predicted by analyzing their individual components in isolation. Environments, on the other hand, encompass the external conditions that influence the behavior and development of a system. Understanding the interplay between a complex system and its environment is essential, particularly in the case of energy management systems, where external factors play a significant role. By accounting for the dynamic and evolving nature of the environment, it becomes possible to develop more accurate models and strategies for effective energy management.

Smart Grids

A Smart Grid (SG) is an intelligent electrical grid that incorporates multifarious loads, production, grid infrastructures, energy standards, and varous analytical strategies [START_REF] Amin | Toward a smart grid: Power delivery for the 21st century[END_REF]. In the smart grid, a combination of appliances, productions, meters, RESs, battery energy sources (BESs), and electric vehicles (EVs) can be present, as depicted in 1.4. The smart grid should be characterized by its dependability, sustainability, flexibility, efficiency, and marketing capacity.

Operating and controlling this new network structure, based on microgrids and aggregators, is a technical challenge that requires the development of new distributed, efficient and cost-effective strategies. These strategies have to be able to support network operation by deploying user flexibilities and adapting to a scalable and evolving system. Challenges can be inherent or epistemic, and inherent challenges are correlated with non-deterministic sources, and sources of challenges include, but are not limited to, the following.

1. Demand Side Management (DSM): Due to the development of electricity grids [START_REF] Liu | Probabilistic load forecasting via quantile regression averaging on sister forecasts[END_REF], electricity demand is more dynamic and difficult to predict. The modernization of the grid has not only led to an upgrade of the grid infrastructure, but also to the incorporation of different types of household appliances, which has led to a radical change in the way electricity is used. This different usage pattern adds complexity to the load.

Generation Side Management (GSM):

Electricity production became hard to monitor and forecast because of the increasing emergence of intermittent RESs. As reported in [START_REF]Analysis and Forecasts to 2O23[END_REF], RESs generation accounted for 24% of global electricity in 2017; the penetration level is expected to increase to 30% in 2023. Between 2017 and 2023, Chapter 1. Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies RESs are expected to cover more than 70% of global electricity production growth conducted by solar. The solar photovoltaic (PV) capacity expanded the most in electricity generation growth in 2017 (97GW) [START_REF]Analysis and Forecasts to 2O23[END_REF]. The generations from RESs, such as solar and wind, are extremely doubtful as weather can change dramatically within moments. Countless factors can cause divergences in solar and wind productions, such as temperature, humidity, wind speed and direction, and seasonality.

3. Producer-Consumer Entities (PCEs): Unlike traditional networks, smart grid consumers can also supply energy to the network. They can therefore be both consumers and producers. The PCE can be an individual dwelling equipped with a renewable energy source or a solar energy source. According to reports, the number of electric vehicles owned worldwide was 5.5 million in 2018, an increase of 2 millions on the previous year [START_REF]Global ev outlook 2019: Scaling up the transition to electric mobility[END_REF]. Given that high-power EV charging will change demand, the popularity of "EVs" could have a further impact on charging patterns. However, EVs also offer us the opportunity to improve the reliability of smart grids by taking advantage of their vast storage capacity. The same applies to BESs.

Sources of epistemic uncertainty are those that result from the absence of complete knowledge. They include, but are not limited to, the following.

1. Modeling Challenges: Many factors can be at the root of modelling imperfection, such as imperfect model observability, inadequate model structures and variability in model parameters.

Observations Challenges:

The observations can include noise, anomalies, and even missing values.

1.4. Smart Grids 3. Computing Challenges: Processing resources may not be adequate to support precise computing. For example, due to the limit of computing power, we may reduce the sampling rate to reduce the response time when computing locally.

The inherent challenges cannot be solved, while the epistemic challenges can be reduced by utilizing more developed models, and obtaining more data and computing power.

Types of Demand-Side Management methods

DSM actions are handled by utilities or the consumers themselves. Utilities make efforts to convince consumers to adjust their demand behavior by introducing positive tariff motivations. It will allow the users to shift their demand activities at periods that minimize their electricity bills and assist utilities to shift the demand away from peak periods. Consumers can either reduce their energy consumption directly or shift their demand activities to off-peak periods to reduce their bills. The types of DSM strategies can be categorized as follows:

1. Energy reduction methods: This category covers a wide range of practical actions that can be taken to reduce energy consumption in all sectors. 1.5 shows some energy-saving tips. Chapter 1. Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies DSM techniques reduce the cost of energy consumption, minimize peak demand, improve the ratio between peak and average, decrease user discomfort by changing the HEAs' operating habits and increase the energy consumption acquired through "RESs". The main purposes of demand-side management are listed below:

Home energy monitoring systems

A HEMS as illustrated in 1.6 is a demand response (DR) technology that modifies and shortens demand to improve a home's energy consumption and production profile based on electricity price and consumer comfort. The HEMS can communicate with home MEAs and the utility, if required, and obtain external information (e.g. solar energy production and electricity prices) to improve the energy consumption and production schedule of home appliances. The HEMS plans the optimum counter-action using a predefined algorithm and distributes the signals appropriately.

HEMS would benefit both demand and production. However, it is often found that the use of these techniques threatens user comfort. Recent research on energy monitoring systems for residential households focuses on scheduling appliances during off-peak periods, which can lead to delays in appliance operation and increase the ratio of peak to average hours. Nor are these techniques flexible according to the user's schedule. Different environmental variables determine user conveniences, such as ambient temperature, outside temperature, and humidity. In order to fully utilize the advantages of the DR incentive program while ensuring user comfort, it is crucial to consider additional parameters that directly affect the user experience. A comprehensive comprehension of the operation of the air conditioning (HVAC) system and its impact on indoor temperature is essential for optimizing energy consumption. The creation of a rule-based system for fuzzy inference is a complex undertaking. Employing a method to facilitate this process would minimize the chance of human error and enable the incorporation of other input parameters in generating control commands for energy consumption optimization.

Load forecasting in smart grids

Electric Load Forecasting (ELF) is a discipline that examines the inherent link between things and rules of development change by studying known electrical systems, and economic, social, meteorological, and other historical data. In order to make predictions and formulate hypotheses about the evolution of the electrical load [START_REF] Niu | Power Load Forecasting Technology And Its Application[END_REF]. An accurate short-term LF can effectively reduce generation costs and guarantee the safety and robustness of the electricity network [START_REF] Li | Study on the daily characteristic load forecasting based on the optimized algorithm of decision tree[END_REF]. However, grid data is expanding explosively with

Types and sources of information in residential sector

Energy consumption in the residential sector accounts for 33.6% of global consumption in some countries, as shown in 1.8. This high level of consumption merits a straightforward understanding of the consumption features of the residential sector in order to prepare and help shape the sector's energy consumption in a world increasingly aware of the importance of energy, from the point of view of supply, efficient use and the consequences of consumption. In response to climate change, high energy prices, and energy Chapter 1. Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies supply/demand, it is of interest to understand the complex characteristics of residential sector consumption in order to encourage conservation, efficiency, technology implementation, and the switch to alternative energy sources, such as RES. Depending on the modeling methodology used, the input data required to design residential energy models contains details of the physical characteristics of homes, residents and their MEAs, historical energy consumption, climatic conditions, macroeconomic indicators, and geographical information. Data can be collected independently or simultaneously, it can cover the whole country or records from a single residence, and it varies considerably in terms of detail. The main method of collecting information is the survey, in which results are published in raw or analyzed form. The initial estimation of total energy consumption in the residential sector is generally published by the governments that collect the gross energy submitted by energy providers. These estimates provide indicators of the sector's energy consumption but may be inaccurate because they do not take account of unreported energy or on-site production. A more detailed source of data on energy consumption, usually on a monthly basis and for each home, is billing statements from energy suppliers (for example, the dwelling's monthly electricity bill). However, in the absence of additional information about the dwelling, these energy consumption records are difficult to correlate because of the diversity of homes and occupants. Housing surveys are carried out. These surveys target a sample of the population in order to determine the characteristics of buildings and occupants, as well as appliance penetration levels. The Tyndall Centre has carried out a worldwide study of these surveys [START_REF] Macmillan | Modelling energy use in the global building stock: a pilot survey to identify available data sources[END_REF]. Surveys typically attempt to define the geometry and thermal envelope of the home, the ownership of appliances, the occupants, their appliance use and preferred settings, and demographic characteristics. In addition, surveys may attempt to obtain billing data from energy suppliers (described above) and information on alternative energy sources (e.g. unreported use of wood) in order to establish a correlation between the energy consumption of the house and its characteristics identified during the survey. This makes it possible to calibrate the model by updating energy consumption forecasts with actual energy billing data. This level of information is superior to the energy supplier statements mentioned above, but is limited by the difficulties of collection and cost. Consequently, the sample selected must be highly representative of the population. In addition, occupants' descriptions of the use of their appliances are highly subjective and may be influenced by the season during the survey [START_REF]Survey of household energy use-detailed statistical report[END_REF]. Examples of surveys that have been condensed for energy simulation are presented in [START_REF] Persily | A collection of homes to represent the u.s. housing stock[END_REF][START_REF] Swan | Canadian housing stock database for energy simulation[END_REF]. Sub-metering makes it possible to eliminate subjective 1.5. Energy consumption profiling estimates of appliance use. This method consists of placing energy meters on the household appliances that consume the most energy in order to determine their share of energy consumption in the home and their usage profile as a function of time (for example, [START_REF] Knight | European and canadian non-hvac electric and dhw load profiles for use in simulating the performance of residential cogeneration systems[END_REF]). This level of information is difficult to obtain because of its high cost. Total sector energy calculations, individual billing data, surveys and sub-metering have been used to develop residential energy consumption models. The choice of information used depends on the availability and purpose of the model. The purpose of the models is highly variable and can be geared towards determining supply requirements, price and income elasticity, and the impact on energy consumption of improvements, technologies or changes in behavior.

Energy consumption profiling

Load classification plays a crucial role in understanding energy consumption patterns, optimizing energy usage, and facilitating demand response (DR) strategies. Loads can be categorized based on their energy consumption characteristics into three primary groups: brown goods, white goods, and small appliances [START_REF] Dickert | Residential load models for network planning purposes[END_REF][START_REF] Gulnar | Electricity consumption constraints for smart-home automation: An overview of models and applications[END_REF]. Brown goods encompass relatively lightweight electrical appliances, including office equipment and leisure devices. These loads typically have lower energy consumption levels and are often used for entertainment or convenience purposes. Examples of brown goods include televisions, computers, and gaming consoles. White goods and large appliances make up the second group of loads. These appliances have higher energy consumption levels and are typically associated with heating, ventilation, and HVAC systems. Modeling the behavior of this group mathematically can be challenging due to their stochastic nature. White goods include items such as refrigerators, washing machines, and air conditioners. Small appliances constitute the third group and consist of light electrical devices that are used infrequently. These loads, such as blenders and mobile phone chargers, typically consume relatively low amounts of energy compared to other appliances. Load classification can also consider the capabilities and constraints related to demand response. Shiftable loads, non-shiftable loads, storage loads, and thermal loads are classifications based on the flexibility of load management. Shiftable loads are those that can be shifted from their current usage time to a later time without significant impact. These loads offer flexibility in scheduling their operation, allowing for the optimization of energy consumption. Examples of shiftable loads include dishwashers, washing machines, and electric vehicle charging. Non-shiftable loads, on the other hand, are loads that have constraints preventing them from being shifted in time due to operational cycles or user comfort requirements. Appliances such as refrigerators and lighting fall into this category. These loads need to operate continuously or at specific times and cannot be easily rescheduled. Storage loads refer to appliances that can store energy for later use, such as batteries or electric vehicle batteries. These loads offer the potential for load shifting and energy management through storage and release. Thermal loads are associated with heating and cooling systems, which are often critical for maintaining comfort in residential buildings. Managing these loads efficiently requires considering factors such as thermal inertia and occupant comfort.

To facilitate demand response applications, "EMS" utilize load clustering techniques to generate models and extract relevant features. Load clustering helps identify groups of similar loads based on their energy consumption profiles, enabling more effective DR Chapter 1. Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies strategies and load forecasting.

Overall, load classification based on energy consumption and demand response capabilities provides insights into the nature and behavior of connected loads. This information is crucial for optimizing energy usage, implementing efficient demand response programs, and promoting energy efficiency in residential buildings.

Anomalous energy consumption detection

Anomaly detection is a problematic area of research used in many applications, including biomedical [START_REF] Ali | A survey of feature extraction and fusion of deep learning for detection of abnormalities in video endoscopy of gastrointestinal-tract[END_REF][START_REF] Sial | Detecting anomalous energy consumption using contextual analysis of smart meter data[END_REF], power generation [START_REF] Yan | One-class extreme learning machines for gas turbine combustor anomaly detection[END_REF], network traffic [START_REF] Bialas | Anomaly detection in network traffic security assurance[END_REF], cybersecurity [START_REF] Hong | Integrated anomaly detection for cyber security of the substations[END_REF] and energy consumption [START_REF] Gaur | Performance evaluation of techniques for identifying abnormal energy consumption in buildings[END_REF]. Detecting and examining abnormal patterns of energy use in real-time can boost the energy conservation process, although it can also help detect deficiencies in HEAs by analyzing sudden and unpredictable changes in energy use [START_REF] Gaur | Performance evaluation of techniques for identifying abnormal energy consumption in buildings[END_REF]. Once abnormal energy consumption behavior is identified, the end user is informed, enabling them to implement practical energy efficiency strategies. Furthermore, with the addition of wireless sensors and sub-meters, the study of household consumption behavior in installations can detect abnormal use. As a result, there is growing interest worldwide in placement technologies that support the detection of abnormal consumption during use [START_REF] Chou | Real-time detection of anomalous power consumption[END_REF]. Anomaly detection solutions aimed at identifying irregular energy patterns can be classified into three main categories based on whether or not labeled data is available: supervised, semi-supervised, and unsupervised approaches [START_REF] Gaur | Performance evaluation of techniques for identifying abnormal energy consumption in buildings[END_REF][START_REF] Capozzoli | Automated load pattern learning and anomaly detection for enhancing energy management in smart buildings[END_REF].

Non-Intrusive Load Monitoring

Recently, the deployment of NILM has increased as it takes advantage of single-point sensing i.e. at the power grid level, to determine which electrical appliances are operating [START_REF] Giri | An energy estimation framework for event-based methods in non-intrusive load monitoring[END_REF][START_REF] Armel | Is disaggregation the holy grail of energy efficiency? the case of electricity[END_REF]. NILM, as shown in Figures 1.10, breaks down the overall energy consumption to effectively distinguish specific HEA loads. To clarify the NILM problem, as illustrated in 1.9, we present a formula that calculates the primary reading Y (t) for each given time 1.5. Energy consumption profiling interval. Essentially, Y (t) represents the total active power generated by the devices. Given that Y (t) holds significant importance for each time interval, it can be expressed as shown in equation 1.1.

Y (t) = N i=1 X i (t) + e(t) (1.1)
X i (t) is the power measurement of device i at time t, N is the number of devices, and e(t) is a variable representing the contribution of the considered device and the measurement noise. In general, the noise variables follow a Gaussian function with mean 0 and variance igmat, i.e.e(t) ∼ N (0, σ 2 (t)).. Several smart meters such as Yomo [START_REF] Klemenjak | Yomo: The arduino-based smart metering board[END_REF] and c-meter [START_REF] Makonin | Inspiring energy conservation through open source metering hardware and embedded real-time load disaggregation[END_REF] have been developed to measure total building load. The use of smart meters, which are currently being used as a prerequisite for smart grids, is a cost-effective way of collecting data on total electricity. The performance data collected can be recorded at different sampling rates. The DAQ stages can be divided into two different categories: High Sampling Rate (HSR) and High Sampling Rate (LSR). HSR is when the sampling rate is 1 KHz or more. In fact, it is useful to have detailed data. It is possible to press events to happen, but under the latest General Data Protection Regulation, energy suppliers are prohibited from collecting detailed data on energy consumption in order to protect privacy, which is not the case for personal use, and besides, HSR measurements are expensive. LSR refers to sampling rates below 1 KHz. LSR devices and meters are affordable and inexpensive, but they may not collect enough data to detect appliances that switch on and off quickly.

In the DAQ step, we need to specify exactly which readings to sample, the readings are divided into two categories, steady state characteristics such as current, voltage, active power, and reactive power. These readings are easily obtained using the LSR method, transient harmonics, and wavelet characteristics such as "FFT" where FFT requires HSR methods.

Event Detection (ED):

The NILM algorithm must detect the operating states of the device such as on and off from the power measurements as depicted in 1.13. The detector processes the changes in power level e.g. ON/OFF. This is a complex process because different types of equipment in the building have different states to detect, such as simple on/off states, finite states, constant on states, and continuously variable states. Current NILM methods can be classified into event-based and state-based depending on the different event detection strategies.

Event-based approaches focus on the state transition edges generated by devices and use shift detection algorithms to identify the boundaries of the event window. The role of an event detector is to detect changes in aggregated time series metrics due to the switching on or off of one or more devices or a change of state. Having identified the window of event that has occurred, the device signatures, e.g. rising/falling edge, etc. are extracted, etc. and then used as input to the classification models to The state-based NILM approach does not include an event detection step but uses a state machine to represent each process in the device, with different state transitions depending on the application mode and the appropriate probability distribution for that device. State-based NILM techniques are inherently limited. Extensive training has built up the experience needed to define predefined values for each device state. In addition, they have significant computational complexity and do not have sufficient means to deal with the fact that the state may remain unchanged for a long period of time.

Load Identification (LI) :

At this stage, the signature of the extracted appliance is analyzed to determine the specific state of the appliance and to estimate the associated energy consumption. Statistical and machine learning algorithms are used to learn the model parameters, allowing the state of the appliance to be inferred from the observed total power data and the associated energy consumption to be estimated. Using the features listed above that are derived from the total load, the objective is to identify the equipment that is active at any given time. This can be described as a complicated and not-so-simple optimization or classification problem. Four models of appliances are typically considered:

• On/Off appliances: many common household appliances HEAs, such as light bulbs and toasters,

• Finite State Machine (FSM): This type of device typically has periodic states . e.g. appliances like washers/dryers, refrigerators, etc.,

• Continuously Varying Appliances: The capabilities of these devices fluctuate over time, but not consistently. Examples of this include dimmers and tools,

• Permanent consumer appliances: These devices have a perpetual power source, but they operate continuously, such as B. Alarms and external power.

Chapter 1. Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies 4. Energy Usage Inference: During this step, specific load identifier data can be used to predict future energy use patterns. This is crucial for effective energy demand management and policy development. Accurate knowledge of energy use patterns is vital for utilities in their ability to meet consumer market energy demand and regulate energy use. Minute-based load forecasting can prevent direct load monitoring systems from being fooled, and predictive analytics can help in making decisions regarding indirect load inference. Algorithms used for load prediction in energy management can be trained using supervised or unsupervised learning methods.

b) NILM Evaluation Metrics

This section describes how to statistically determine the quality of a classifier. The definitions presented here are based on the classification of device events, but can be transferred in a similar way to other pattern recognition systems. A classifier assigns patterns to classes based on certain characteristics. These patterns may be similar, but not necessarily identical. Classifiers often make mistakes if the patterns are very different.

In this way, they assign the pattern to the wrong class (for example, for event detection, they detect events that are not present or, similarly, do not detect events that are present).

Quantitative measures for evaluating event reporters can be derived from the relative frequency of these errors. There are two scenarios for detection: an event is detected or an event is not detected. The quality metrics presented here describe the binary case.

The different quality standards are described below.

• Confusion Matrix: To evaluate an event detector, several cases need to be applied. At least that's what we should know a posteriori about the true class of switching times. The classification of an event can define four situations as shown in 1.14:

True Positive (TP):

The event exists and the detector has identified it.

False Positive (FP):

No event exists, but the detector detects one.

True Negative (TN):

The event does not exist and was not identified by the detector.

false Negative (FN):

An event exists, but the detector does not recognize it.

The detector correctly identifies whether the device is a true positive (TP) or a true negative (TN). In the other two cases, errors were detected. Finally, the frequency of each of the four cases is counted to evaluate the algorithm.

On the other hand, a load identifier is considered to be a multi-label classifier, in which case a multi-label confusion matrix is used. A multi-label confusion matrix is a type of confusion matrix used to evaluate the performance of a classification model that can predict multiple labels or classes for each input instance. In a multi-label confusion matrix, the rows represent the true labels or classes, and the columns represent the predicted labels or classes. Each cell of the matrix represents the number of instances that belong to a particular combination of true and predicted labels. More precisely, the diagonal cells represent the number of correctly predicted instances for all labels, while the off-diagonal cells represent the number of incorrectly classified instances for one or more labels. Given the definitions of FPR and PPV, we can rearrange the equations to obtain an expression for FP:

F P R = F P F P + T N = 1 - T N F P + T N P P V = T P T P + F P
Solving for FP, we get:

F P = T N 1 -F P R -T N = 1 -P P V P P V /(1 -F P R) • T N 7. F1 score: F 1 = 2 • P recision • Recall P recision + Recall

Similarities between NILM and Soft Sensing techniques

NILM and soft sensing are two techniques used in the field of industrial engineering to estimate or infer information that is difficult or expensive to measure directly. NILM is a technique used to estimate the energy consumption of individual appliances in a household or building by analyzing energy consumption data from the overall electrical load, whereas soft sensing is a technique used to estimate the values of variables in a manufacturing process by analyzing the available data from sensors or other measurements. Despite the differences between their applications, NILM and soft sensing have some similarities in terms of basic principles and approaches.

Firstly, both techniques rely on statistical and machine learning algorithms to analyze data and make predictions. For example, NILM algorithms may use techniques such as Hidden Markov Models (HMM) or neural networks to analyze energy consumption data, while soft sensing algorithms may use techniques such as Principal Component Analysis (PCA) or Partial Least Squares (PLS) to analyze sensor data.

Secondly, both techniques aim to estimate information that is difficult or expensive to measure directly. For example, it may be difficult to measure the energy consumption of individual appliances in a building without installing additional sensors or meters. Similarly, it may be expensive to install sensors to measure all the process variables in a manufacturing process.

Thirdly, One of the key similarities between NILM and soft sensing techniques is that they are both non-intrusive methods of estimating information. This means that they do not require additional sensors or equipments to be installed, which can be costly and time-consuming. Instead, they rely on existing data sources, such as power consumption data or sensor measurements, to infer information about the system being monitored. This non-intrusive nature makes these techniques attractive for applications where the cost or disruption of installing additional sensors or equipments is prohibitive.

Machine learning

Finally, both techniques have potential applications in energy management and process optimization. By estimating the energy consumption of different appliances, NILM can help households and buildings to identify energy-saving behaviors and appliances. Soft sensing can help manufacturers to optimize their processes by providing estimates of important variables, such as temperature or pressure, that are difficult to measure directly.

In summary, although NILM and soft sensing are used in different fields and have different applications, they share some similarities in their basic principles and approaches. Both techniques rely on statistical and machine learning algorithms to analyze data and estimate information that is difficult or expensive to measure directly, and both have potential applications in energy management and process optimization. For this reason, we consider MNIL as a soft technique used in the context of smart energy.

Machine learning

Machine learning is a subset of artificial intelligence (AI) as illustrated in 1.15 that enables machines to learn automatically from data and improve their experience without being explicitly programmed [START_REF] Bishop | Pattern Recognition and Machine Learning[END_REF]. Machine learning algorithms are classified into three categories: supervised learning, unsupervised learning, and reinforcement learning. Machine learning is a field that involves building algorithms capable of automatically learning models and ideas from data. Supervised learning involves using labeled data to train a model to predict an output variable, while unsupervised learning involves using unlabeled data to learn the underlying structure of the data. Both supervised and unsupervised learning have a wide range of applications in various sectors, including healthcare, finance, and e-commerce.

Supervised Machine Learning

Supervised learning involves the use of labeled data to train a machine learning model. labeled data refers to data that has already been annotated with the correct output or target variable. The objective of supervised learning is to learn a correspondence between the input variables and the output variables based on the training data. The training process involves adjusting the model parameters to minimize the difference between the predicted and actual outputs in the training data. Supervised learning can be divided into two categories: classification and regression. In classification, the objective is to predict a categorical variable, such as a binary classification (yes/no) or a multi-class classification (for example, predicting different types of flowers). In regression, the objective is to predict a continuous variable, such as the price of a house or the temperature.

• Linear Regression: a simple algorithm used to predict a continuous output variable based on one or more input variables. The algorithm finds the best-fit line or plane that minimizes the difference between the predicted output and the actual output.

• Logistic Regression: a binary classification algorithm used to predict the probability of belonging to one of two classes. The algorithm estimates the probability using a logistic function, and the predicted class is determined based on a threshold.

• Decision Trees: a versatile algorithm used for classification and regression problems. Decision trees create a model of decisions and their possible consequences, allowing the algorithm to identify the best split for each decision. The algorithm recursively splits the data according to the feature that provides the best split until a stopping criterion is met.

• Random Forest: an ensemble learning method that combines multiple decision trees to improve accuracy and reduce overfitting. Random forests build a multitude of decision trees, and the final prediction is determined based on the most frequent prediction of the individual trees.

• Naive Bayes: a probabilistic algorithm used for classification problems based on Bayes' theorem, which assumes that the presence of a feature in a class is independent of other features. Naive Bayes calculates the probability of each class given the input features and selects the class with the highest probability.

• SVMs: a linear and nonlinear classification algorithm that separates data points into different classes using hyperplanes. SVMs aim to find the hyperplane that maximally separates the data points of different classes while minimizing the margin of error.

• K-Nearest Neighbors (KNN): a lazy learning algorithm that stores all available cases and classifies new cases based on the similarity of their features to the features of existing cases. The algorithm selects the k-nearest neighbors and determines the class of the new case based on the most common class among the neighbors.

Unsupervised Machine Learning

Unsupervised learning, on the other hand, involves the use of unlabeled data to train a machine-learning model. Unlabeled data refers to data that has no predefined output or target variable. The goal of unsupervised learning is to learn the underlying structure of the data without any prior knowledge of the output or target variable. Unsupervised learning algorithms can be used for tasks such as clustering, dimensionality reduction, and anomaly detection. Clustering involves grouping similar data points together based on their characteristics, while dimensionality reduction involves reducing the number of input variables to simplify the data and improve the performance of machine learning models. Anomaly detection involves identifying data points that are significantly different from the rest of the data.

• PCA : An unsupervised learning algorithm used for dimensionality reduction. PCA transforms the data into a lower-dimensional space while retaining as much of the original variation as possible. The new dimensions are called principal components and are calculated as linear combinations of the original variables.

• Association Rule Learning : An unsupervised learning algorithm used to identify patterns in data. Association rule learning aims to find frequent patterns, associations, or correlations in the data. It is commonly used in market basket analysis to find products that are frequently purchased together.

• Self-Organizing Maps (SOMs) : An unsupervised learning algorithm used for dimensionality reduction and visualization. SOMs create a low-dimensional representation of high-dimensional data while preserving the topology of the data. The resulting map can be used for data visualization and clustering.

• Hierarchical Clustering : An unsupervised learning algorithm used to group similar data points together based on their attributes. Hierarchical clustering algorithms create a hierarchy of clusters that can be visualized as a tree-like structure.

Anomaly detection can be solved using both supervised and unsupervised learning. Anomaly detection algorithms aim to find data points that are significantly different from the majority of data points. Some of the methods that can be used to identify anomalies are mentioned below:

• Isolation Forest (IF): Isolation Forest [START_REF] Liu | Isolation forest[END_REF] [START_REF] Kelly | Neural NILM: Deep Neural Networks Applied to Energy Disaggregation[END_REF]. This split depends on the time required to separate the points. The advantage of this algorithm is that it works with large dimensional datasets. Using this technique, we found the contamination parameter, which represents the percentage of points in our data that are likely to be outliers. In contrast,as depicted in 1.6 in the case of one-class SVM [START_REF] Chandola | Anomaly detection: A survey[END_REF], the support vector model is trained on data that contains only one ordinary class. It models the patterns of normal cases and, from these patterns, can predict which examples are different from the ordinary samples. This method is useful for anomaly and novelty detection, as it is the lack of training examples that defines anomalies.

• K-Means approach: K-Means clustering method [START_REF] Jin | K-Means Clustering[END_REF] is a classic unsupervised learning algorithm that is used to solve clustering problems. It performs a simple task of classifying a given data set into a number of clusters, which is defined beforehand and refereed with K. The clusters are then positioned as points and all observations or data points are associated with the nearest cluster, computed, adjusted, and then the process starts over using the new adjustments until a target result is reached. K-Means method aims to minimize an objective function represented by a squared error function as shown in the equation (1.2).

M inf (x) = K r=1 x i ∈Cr |x i -g r | 2 (1.2)
1.7. Machine learning Figure 1.17: One-Class SVM illustration [START_REF] Kaddour | Electricity consumption data analysis using various outlier detection methods[END_REF] Where

(|x i -g r | 2
) is the Euclidean distance between the item (x i ) and the center of the cluster (centroid) (g r ), (C r ) is the cluster number (r), (x i ) is an item in a cluster, and (g r ) is the centroid of (C r ).

K-Means is performed as follows:

1. Choose K points in the space represented by the clustered objects. These points represent the initial set of centroids.

2. Assign each point to the cluster having the closest centroid.

3. When all points have been affected by their corresponding clusters, we compute again the positions of the K centroids.

4. Repeat steps 2 and 3 until the centroids do not move. This generates clusters of points from which the metric to be minimized can be computed.

Another outlier detection method is a statistical method and cannot be classified with machine learning approaches is Tukey's Fences.

• Tukey's Fences: method is among the most popular simple outlier detectors for one-dimensional number arrays, a nonparametric outlier detection method. It is calculated by creating a "fence" boundary at a distance of 1.5 IQR beyond the first and third quartiles. Any data beyond these fences are considered to be outliers.

f (x) =    0, if x ∈ R 1, otherwise R = [Q1 -k(Q3 -Q1) , Q3 + k(Q3 -Q1)] (1.3)
As outliers, the typical recommendation for K is 1.5 for "regular" outliers and 3.0 for "far-outliers".

Chapter 1. Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies

Deep learning

Deep learning and traditional machine learning have distinct differences. Traditional machine learning techniques frequently involve feature engineering, a process in which experts extract pertinent features from the data by hand. On the other hand, deep learning methods strive to learn these characteristics autonomously from the raw data.

When comparing deep learning and traditional machine learning as shown in 1.18, one of the most significant differences lies in the architecture of their models. In deep learning, models frequently consist of numerous layers of interconnected artificial neurons, which are also referred to as artificial neural networks. These networks may contain hundreds or even millions of neurons, affording them the ability to create intricate representations of data. Conversely, traditional machine learning models often employ more straightforward algorithms like decision trees, support vector machines, or logistic regression.

A notable contrast lies in the degree of abstraction and intricacy that deep learning models can manage. These models are capable of spontaneously developing hierarchal depictions of data, where each layer of neurons gradually extracts more intricate features. This proficiency grants deep learning models the ability to apprehend complex patterns and associations within the data, making them incredibly successful for tasks such as image recognition, natural language comprehension, and speech synthesis. In contrast, traditional machine learning algorithms often face difficulties when handling high-dimensional or unstructured data and may necessitate extensive feature engineering to produce positive outcomes.

Training in deep learning heavily depends on the availability of large volumes of labeled data. The more data accessible, the higher the possibility of deep learning models to generalize and make precise predictions. In contrast, conventional machine learning algorithms can function with smaller datasets or in cases where labeled data is scarce.

Figure 1.18: The difference between traditional machine learning and deep learning [START_REF] Wang | Deep learning algorithm-based financial prediction models[END_REF] There are three categories of deep learning: supervised, unsupervised, and reinforcement.

• Supervised Learning: Supervised learning is a type of deep learning that involves training a neural network on labeled data. Labeled data includes input features and 1.7. Machine learning their corresponding output labels. Supervised learning aims to learn a mapping function between input and output that can accurately predict the output for new, unseen data.

• Unsupervised Learning: Unsupervised learning is a type of deep learning that involves training a neural network on unlabeled data. The aim of unsupervised learning is to learn the underlying structure of the data and discover patterns and relationships that can be used for data analysis and visualization.

• Semi-Supervised Learning: Semi-supervised learning is a type of deep learning that combines labeled and unlabeled data to improve the performance of a model. This method is particularly useful when labeled data is expensive or difficult to obtain. The model is trained on a small amount of labeled data and a large amount of unlabeled data, and the aim is to learn a better representation of the data that can be used for prediction or classification.

• Reinforcement Learning: Reinforcement learning is a type of deep learning that involves training a neural network to make decisions based on feedback from the environment. Feedback comes in the form of rewards or punishments, and the objective of reinforcement learning is to learn a policy that maximizes the accumulated reward over time.

• Transfer Learning: Transfer learning is a type of deep learning that involves using a pre-trained model on a related task to improve the performance of a model on a new task. For example, a pre-trained model for image classification can be refined for a specific application, such as detecting tumors in medical images.

• Generative Models: Generative models are a type of deep learning used to generate new data similar to the training data. This method includes models such as Generative Adversarial Networks (GANs), which are used to generate realistic images, and variational autoencoders (VAEs), which are used to generate new data samples that have properties similar to the training data.

• One-Shot learning: One-shot learning is a type of deep learning that involves learning from a single example. This method is particularly useful when labeled data is sparse or when new classes are introduced over time. One-shot learning algorithms learn to generalize from a small number of examples, making them useful in applications such as face recognition or object detection.

• Federated learning: Federated learning is another category of deep learning that has gained popularity in recent years. It is a distributed learning approach that allows multiple devices to collaborate on a machine learning task without exchanging data with each other or with a central server. Instead, models are trained locally on each device, and updates are sent to a central server, which aggregates the updates and sends the new model back to each device for further training.

Chapter 1. Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies

Methods of Deep Learning

There are several methods of deep learning, including convolutional neural networks, recurrent neural networks, and deep belief networks, among others.

• Convolutional Neural Networks (CNNs): CNNs are a type of neural network that are commonly used in computer vision applications, such as image classification and object detection. CNNs consist of multiple layers, including convolutional layers, pooling layers, and fully connected layers, and they are designed to learn features directly from the raw data.

• Recurrent Neural Networks (RNNs): RNNs are a type of neural network commonly used in natural language processing and speech recognition. RNNs are designed to process sequential data, such as text or audio, and have a memory that allows them to learn long-term dependencies in the data.

• Deep Belief Networks (DBNs): DBNs are a type of neural network that are commonly used in unsupervised learning applications, such as feature learning and dimensionality reduction. DBNs consist of multiple layers of restricted Boltzmann machines (RBMs) and are trained using a combination of unsupervised and supervised learning techniques.

• Long Short Term Memory (LSTM): LSTM is a type of RNN that is designed to better capture long-term dependencies in sequential data. It is able to selectively remember or forget information from previous time steps, which makes it well-suited for tasks such as language modeling or speech recognition.

• Autoencoders: Autoencoders are a type of neural network that are commonly used in unsupervised learning applications, such as data compression and feature learning. Autoencoders consist of an encoder network that maps the input data to a low-dimensional representation and a decoder network that reconstructs the original input from the low-dimensional representation.

• GANs: GANs are a type of deep learning model capable of generating new samples of data similar to a given data set. They consist of two neural networks: a generator network that generates new samples and a discriminator network that attempts to distinguish between real samples and generated samples. GANs have been used to generate images, video and text.

• Attention Mechanisms: Attention mechanisms are used to selectively focus on specific parts of the input data when making predictions. They are commonly used in natural language processing and have been shown to improve performance on tasks such as machine translation and language modeling.

While AutEncoders, LSTM, and GANs can function as unsupervised techniques, the subsequent method is a deep clustering approach that operates using Autoencoders and K-Means:

1.8. Conclusion

• DEC: The problem consists in classifying a set of n points {x i inX} n i=1 into k clusters, each cluster being characterized by a centroid µ j , j = 1, ..., k. Junyuan et al. [START_REF] Xie | Unsupervised deep embedding for clustering analysis[END_REF] proposed a clustering approach that is not applied directly in the data space X, but on transformed data using a nonlinear mapping f θ : X -→ Z, where θ is the learnable parameter and Z is the latent feature space. From a dimensional point of view, Z is much smaller than X to circumvent the "curse of dimensionality" [START_REF] Wilcox | Adaptive control processes: a guided tour[END_REF]. To parameterize f θ , "Deep Neural Networks (DNNs)" are a natural selection due to their theoretical properties of function approximation [START_REF] Hornik | Approximation capabilities of multilayer feedforward networks[END_REF] and their demonstrated feature learning capabilities [START_REF] Bengio | Representation learning: A review and new perspectives[END_REF]. The DEC algorithm as presented in 1.9 clusters data points by simultaneously learning a set of k cluster centers {µ j ∈ Z} k j=1 in the feature space Z and the parameter θ of the DNN that maps data points to Z. DEC has two phases:

-Parameter initialization using a deep autoencoder [START_REF] Vincent | Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion[END_REF] and K-Means in order to get initial estimates of θ and {µ j } k j=1 . -Parameter optimization i.e. clustering, an auxiliary target distribution is computed then minimizing the Kullback-Leibler (KL) divergence to it. This operation is repeated until the criterion is met.

Conclusion

This chapter has offered a thorough introduction to several topics pertaining to complex systems, smart grids, energy consumption profiling, NILM, soft sensing, and machine learning.

The technique of soft sensing has become increasingly essential in the process industry as it can estimate variables that are not measured. This technique has many practical applications, from quality control to fault diagnosis and detection. Furthermore, this chapter delved into the notion of complex systems, which are known for their intricate interconnections and nonlinear behaviors. During the discourse on smart grids, there Chapter 1. Background: Soft Sensors, Machine Learning, and Energy Efficiency Technologies was a notable emphasis on the significance of demand-side management techniques and the implementation of home energy monitoring systems. In addition, the discussion also involved an examination of load forecasting in smart grids. This included an exploration of the various kinds and origins of information in the residential sector.The identification of unusual patterns in energy consumption is of utmost importance in energy consumption profiling. Non-invasive load monitoring (NILM) techniques were developed to extract detailed information on energy consumption at the appliance level. The NILM process and the means of measuring its effectiveness were extensively reviewed and explained.

The chapter highlighted the similarities between NILM and soft sensing techniques, pointing out how both aim to deduce unmeasured variables from the data at hand. The concluding section delved into various methods of machine learning, comprising both supervised and unsupervised learning, as well as deep learning. These approaches provide potential pathways for constructing reliable and effective models in the domains of soft sensing, intricate systems, intelligent grids, and profiling of energy consumption. The current chapter sets the groundwork for the upcoming sections of the thesis, providing a thorough comprehension of the foundational subjects that are crucial for the proposed research. The insights obtained from this chapter will serve as the underpinning for the creation and execution of machine learning algorithms in the ensuing chapters. The ultimate objective is to improve the effectiveness of soft sensing methods in the realm of intelligent power grids and the profiling of energy consumption.

State of Art: Public Datasets and Energy Monitoring Techniques

Chapter 2

State of Art: Public Datasets and Energy Monitoring Techniques

Introduction

The analysis of energy demand and the detection of anomalies in residential buildings have become indispensable facets of energy management. To effectively tackle these challenges, it is essential to make use of top-notch datasets that capture the nuances of residential energy consumption with accuracy. In this chapter, we explore the latest techniques and methodologies implemented for public residential energy demand analysis, anomaly detection, and event detection in Non-Intrusive Load Monitoring (NILM) applications. Section 2.1 provides an introduction to the chapter, setting the stage for subsequent discussions. We then proceed to Section 2.2, where we focus on public residential energy demand datasets. These datasets serve as the foundation for research and development in the field, enabling the evaluation and comparison of various algorithms and techniques. We explore the characteristics, availability, and relevance of these datasets, emphasizing their significance in driving advancements in residential energy analysis.

Next, in Section 2.3, we narrow our focus to anomalous energy consumption detection in residential buildings. This crucial task involves identifying energy consumption patterns that deviate significantly from the expected behavior, indicating potential faults, abnormalities, or inefficiencies. We examine different approaches for anomaly detection, including outlier detection techniques and specific methods for detecting anomalous energy consumption. Additionally, we delve into the existing literature that explores anomalous energy detection in residential settings, discussing prediction-based and clustering-based anomaly detection methodologies.

In Section 2.4, we shift our attention to event detection for the NILM application. NILM is a technique that aims to disaggregate the total energy consumption of a building into individual appliance-level loads without the need for intrusive sensing. Event-based NILM focuses on detecting and classifying individual appliance events from aggregated energy data. We explore the concept of event-based NILM, discuss related work in the field, and address the challenges associated with energy disaggregation.

Furthermore, Section 2.5 explores the utilization of deep learning techniques for NILM applications. Deep learning has shown promising results in various domains, and its Chapter 2. State of Art: Public Datasets and Energy Monitoring Techniques application to NILM brings new opportunities for accurate load identification and event detection. We delve into the three key stages of the NILM pipeline: data acquisition (DAQ), event detection (ED), and load identification (LI) discussing the use of deep learning algorithms and architectures for each stage.

Finally, in Section 2.6, we conclude the chapter, by summarizing the key points discussed and highlighting the importance of datasets in the advancement of residential energy demand analysis, anomaly detection, and event detection for NILM applications. The comprehensive understanding of the state-of-the-art techniques and methodologies presented in this chapter forms the foundation for the subsequent chapters, where we delve deeper into specific aspects and propose novel approaches to address the challenges in the field.

Public residential energy usage datasets

The availability of public datasets substantially impacts the accomplishments of research areas among researchers. They allow researchers to reproduce the existing research and enhance results. In the context of NILM, multiple datasets have been provided to explore energy breakdown and load identification of residential building appliances. NILM datasets are categorized according to the sampling frequency of the measurements. Datasets with sampling frequencies in Hz are considered low-frequency datasets and are typically used for energy disaggregation tasks; In contrast, datasets with a sampling frequency of kHz and above are considered high-frequency datasets. In addition, Some datasets only provide power consumption at the device or building level, while others supply metadata or other meters data such as water and gas usage. As mentioned earlier, the temporal resolution of the acquisition can also be very different. We start with datasets sampled with a high enough temporal resolution (i.e., 1 Hz or faster) to allow for non-intrusive load monitoring, HSF datasets are summarized in table 2.1 :

1. The BLUED energy disaggregation dataset contains high-frequency (12 kHz) raw current and voltage data of the entire residential building and the corresponding calculated active power (60 Hz) [START_REF] Anderson | BLUED: a fully labeled public dataset for Event-Based Non-Intrusive load monitoring research[END_REF]. The dataset also includes a list of event timestamps where an event is considered when the power consumption status of a HEA changes by 30 watts or more and lasts at least five seconds. The number of HEAs is about 50, and a number of 2335 events were registered in the dataset. In addition, another 2482 events from unidentified sources are also registered in the dataset.

2. In addition, the reference energy decomposition dataset (REDD) includes building and circuit-level electricity consumption measurements for 6 US residential units for 3-19 days. At a high level, REDD delivers high-frequency information sampled at 0.5-1 Hz for up to 20 port-level monitors and 24 independent circuits, along with the names of the HEAs classes connected to them. Power and voltage information is registered at a higher sampling frequency of 15 kHz [START_REF] Kolter | REDD : A Public Data Set for Energy Disaggregation Research[END_REF]. 5. The dataset of the ADRES concept provides data on electricity consumption and voltage curves for 30 Austrian households, sampled at 1 Hz. The measurement period was two weeks, one in the winter of 2009 and the other in the summer of 2010. However, the dataset does not include detailed device-level data [START_REF] Einfalt | Energie der zukunft publizierbarer endbericht, adres-concept[END_REF].

The

6. UK-DALE is a device-level electricity dataset from five UK households. This dataset contains energy demand at the building and equipment level with a sample rate of 1/6 Hz. In three of the five places (Houses 1, 2, and 5), the house voltage and current were also recorded at 16 kHz. Household 1 data is now available for more than four years and can be used for long-term analysis of seasonality and trends [START_REF] Kelly | The UK-DALE dataset, domestic appliance-level electricity demand and whole-house demand from five UK homes[END_REF].

7. The DRED dataset (Dutch Residential Energy Dataset) provides equipment and house-level energy consumption data (sampled at 1 Hz) for Dutch buildings for six months. It also includes minute-level measurements of environmental conditions (in-outdoor temperatures, GIS) with metadata concerning the building (occupancy, building design, application mapping) [START_REF] Uttama Nambi | LocED: Location-Aware Energy Disaggregation Framework[END_REF].

8.

The ECODS dataset provides measurement data for six households over an observation period of 8 months between June 2012 and January 2013 at 1 Hz. This dataset contains aggregate energy demand and sub-metered measurements for refrigerators, freezers, television, and coffee machines [START_REF] Beckel | The ECO Data Set and the Performance of Non-Intrusive Load Monitoring Algorithms[END_REF].

9. The ENERTALK dataset provides measurements sampled at 15 Hz for active and reactive power drawn in 22 houses in South Korea, on both the appliance and aggregate building levels. The measurements range from 29 days to 122 days, depending on the building, while the monitored appliances include a refrigerator, kimchi refrigerator, rice cooker, washing machine, and television [START_REF] Shin | The ENERTALK dataset: 15 Hz electricity consumption data from 22 houses in Korea[END_REF].

In addition to datasets with a high temporal resolution, many other datasets have low sampling rates. Due to the relatively small number of data points, these typically cover a large number of buildings and span more than a few days or weeks, LSF datasets are summarized in 2.2.

1. The Smart* data set [START_REF] Barker | Smart*: An Open Data Set and Tools for Enabling Research in Sustainable Homes[END_REF] is a large-scale dataset that provides minute-level electricity usage data from over 400 anonymized houses. It includes electricity consumption and generation, weather conditions, and HEMS operational data and meta-data on three households. Additionally, the same source contains data for 114 single-family apartments with a time granularity of 1 minute and records spanning from 2014 to 2016 for aggregated electricity consumption and weather conditions during this period. Another closely related dataset, the NIOM dataset, combines electricity consumption with occupancy patterns for three weeks of minute-level data on consumption and occupancy.

2. The PecanStreet Inc. Dataport [START_REF] Parson | Dataport and NILMTK: A building data set designed for nonintrusive load monitoring[END_REF] is a comprehensive dataset that contains device-level electricity consumption data for nearly 1400 households in three regions of the United States (New York, Texas, and California). The dataset spans multiple years and provides data at different levels of granularity, ranging from 1 second to 15 minutes. However, the data are not fully public, and only a subset of 25 households is available for each location and granularity, with up to 6 months or one year of data.

3. The REFIT [START_REF] Murray | An electrical load measurements dataset of united kingdom households from a two-year longitudinal study[END_REF] dataset offers power measurements for 20 households in the UK at both an aggregate and appliance level. The dataset covers a two-year period and has a sampling period of 8 seconds.

4. The AMPDs [START_REF] Makonin | AMPds: A public dataset for load disaggregation and eco-feedback research[END_REF] dataset provides minute-level measurements of electricity, water, and natural gas usage for a residential building in Canada over a two-year period. It includes data from 21 power meters, as well as ambient conditions.

5. The PRECON [START_REF] Nadeem | PRECON: Pakistan Residential Electricity Consumption Dataset[END_REF] dataset offers minute-level electricity demand data from 42 houses in Lahore, Pakistan, spanning one year. The dataset also includes additional meta-data, such as demographics information and device-level sub-metering.

6. The CoSSMic [START_REF] Amato | Software agents for collaborating smart solar-powered micro-grids[END_REF] (Collaborating Smart Solar-powered Microgrids) dataset contains sub-metered energy demand data for 11 households in Konstanz, Germany. The data is sampled at 1-minute intervals and covers the period from October 2013 to December 2016.

7. The SustData [START_REF] Pereira | SustData: A Public Dataset for ICT4S Electric Energy Research[END_REF]

Anomalous energy consumption detection in residential buildings 2.3.1 Anomaly Detection (Outliers detection)

Anomaly detection (also known as outlier detection) involves identifying unusual patterns in a given dataset that do not correspond to typical behavior [START_REF] Chandola | Anomaly detection: A survey[END_REF]. This technique is used in many applications such as healthcare, fraud detection, defect detection, and many others.

Based on the outlier detection literature, energy anomaly detection can be classified into several categories, as shown in Figure 2.1. This taxonomy takes into account the following three main steps:

• Input: the nature of the dataset can be binary, uni-variate or multi-variate, timeseries or continuous.

• Processing: processing methods can be based on statistical methods or machine learning. In addition, machine learning can be divided into three categories (supervised, semi-supervised and unsupervised).

• Output: there are different types of anomalies, such as context anomalies, point anomalies, correlation anomalies, and many others.

Anomaly Detection

Input Processing Output

Anomalous energy consumption detection

Since the data is not labeled, the problem of detecting anomalies in energy consumption is obviously not supervised i.e it is unsupervised. Furthermore, it is not easy to create a one-off energy consumption model for a building. Energy consumption is dynamic due to seasonal fluctuations and external environmental factors such as the type of day (holidays, working days) or occupancy. In this case, the proposed solutions can be classified according to the different parameters mentioned below (2.2):

• Buildings Type: Energy consumption differs between the commercial, residential and industrial sectors due to heating, ventilation, and air conditioning (HVAC) and internal building loads. The proportion of energy consumed for each end-use depends on many factors, including building type, construction plan, GIS, local climate, season, occupancy and number of appliances [START_REF] Seem | Using intelligent data analysis to detect abnormal energy consumption in buildings[END_REF].

• Data Acquisition Level: Anomalies are detected at two different levels. When electricity consumption measurements can be captured from a single point, such as the input energy load, smart meter readings can be used. On the other hand, detailed readings of appliance consumption loads require multi-point detection. Whatever the objective adopted, a global approach requires detailed data on the state of appliance consumption. In practice, only aggregate data from smart meters is • Processing Level: The reading data collected by energy consumption sensors can be processed at several levels, with data processing being online, offline, or cloudbased. In online approaches, data is processed in real-time. Offline approaches deploy local databases to store sensor readings where the processing task is scheduled to run on predefined dates. Other solutions propose a cloud-based approach that processes readings data at the cloud level, which is not feasible due to high latency and the risk to residents' privacy.

Anomalous energy detection literature

The main challenge in developing and evaluating anomaly detection techniques is the lack of labeled ground-truth datasets. In addition, it is difficult to find the best classification techniques that can be used to automatically classify energy consumption observations and the appropriate evaluation rules. In order to overcome these obstacles, most previous work has focused on anomaly detection using unsupervised approaches, as illustrated in 2.3. These solutions can be divided into two categories: prediction-based solutions and clustering-based solutions. Prediction-based solutions extract the behavior of past power readings to predict future readings, and then compare the predicted power usage P(t) with the real power usage R(t) as depicted in 2.4. Real values that are far from the predicted values are considered abnormal observations. Clustering-based solutions where each value is assigned its appropriate cluster and values far from the centroid of their cluster are considered anomalies as shown in 2.5. In this context, there has been considerable work in the literature to build robust machine algorithms to facilitate energy savings.

a) Prediction-based anomaly detection

In [START_REF] Himeur | A Novel Approach for Detecting Anomalous Energy Consumption Based on Micro-Moments and Deep Neural Networks[END_REF]

b) Clustering-based anomaly detection

In [START_REF] Eisses | Anomaly detection in electricity consumption data of buildings using predictive models[END_REF], the authors implemented an "LSTM" based anomaly detector; LSTM is defined as a deep neural network used for forecasting. In this approach, they used the single point sensing technique to focus on building input load readings. However, this type of load sensing will only acquire data on the overall value of energy consumption at the building level rather than at the appliance level. In many studies, it has been reported that information on overall energy consumption would not significantly change consumer energy use behavior [START_REF] Gopinath | Energy management using non-intrusive load monitoring techniques -State-of-the-art and future research directions[END_REF][START_REF] Hazas | Look back before leaping forward: Four decades of domestic energy inquiry[END_REF].

In [START_REF] Zhang | Anomaly detection in premise energy consumption data[END_REF], Zhang et al. used several approaches, including SVM and K-Means. Their objective was to detect abnormal days in order to improve the accuracy of demand re-2.4. Event detection for NILM application sponse on the electricity provider level. K-Means performed well in terms of detection rate (72.22%) but the false alert rate is high (30.88%), In this solution, the authors excluded the weekday and holidays features, which have a strong influence on energy consumption behavior. Thus, a deficient intake model can lead to an under-fitted trained model.

In [START_REF] Khan | Fault detection analysis of building energy consumption using data mining techniques[END_REF], the authors applied three methods: classification and regression tree, K-Means and DBSCAN, to detect anomalies in the energy consumption of an office building. They found that the classification and regression tree-based method is more practical for automatically detecting abnormal energy consumption.

In contrast, the clustering methods failed to detect faults that were strongly related to temporal variables.

In [START_REF] Kim | Applications of clustering and isolation forest techniques in real-time building energyconsumption data: Application to leed certified buildings[END_REF], the authors presented an isolation forest-based solution for detecting energyinefficient commercial buildings. The aim is to comprehend the energy consumption routines of buildings for the post-construction stage and discover anomalies in energy consumption data by using clustering and isolation forest methods during data processing. However, the solution proposed is for anomaly detection in commercial buildings where they process aggregated energy loads.

An anomaly detection and irregular consumption monitoring framework based on unsupervised machine learning was proposed by [START_REF] Xu | A hybrid data mining approach for anomaly detection and evaluation in residential buildings energy data[END_REF]. The "Recurrent Neural Network (RNN)" was performed to determine the erroneous interval, the energy consumption, and quantile regression was used to evaluate the results. The framework was only applied to three different residential houses. This work used the HUE dataset provided by BCHydro and collected from different residential homes located in Burnaby, British Columbia, Canada. This dataset contains consumption values with a global load of hourly energy consumption. Therefore, this proposal is considered as a single-point sensing-based solution for consumption detection in residential buildings.

Event detection for NILM application

A large number of NILM methods have been reported in the literature [START_REF] Pereira | Performance evaluation in non-intrusive load monitoring: Datasets, metrics, and tools-a review[END_REF][START_REF] Ruano | Nilm techniques for intelligent home energy management and ambient assisted living: A review[END_REF]. Most of the methods can be classified as supervised or unsupervised methods as shown in 2. the former relies on classification algorithms that require a sufficient amount of labeled data for training [START_REF] Ruano | Nilm techniques for intelligent home energy management and ambient assisted living: A review[END_REF][START_REF] Nalmpantis | Machine learning approaches for non-intrusive load monitoring: From qualitative to quantitative comparation[END_REF]. In contrast, the second method is based on a clustering method that does not require a labeled training dataset. Finally as presented in 2.6, NILM methods can be divided into two categories: those that are not event-based and those that are event-based [START_REF] Dan | Review of non-intrusive load appliance monitoring[END_REF], depending on whether or not they rely on transition detection and classification and on the sampling frequency of the data. NILM approaches can be classified as "Low Sampling Frequency (LSF)" (1 Hz or less) or "High Sampling Frequency (HSF)" (hundreds of Hz to MHz) approaches.

Event-based Non-intrusive Load monitoring

The following steps typically appear in event-based methods as depicted 2.7: data acquisition, data pre-processing, event detection, event classification and energy demand inference. The event detection phase is particularly important because it precedes the NILM system. Most works on event-based methods use active and reactive power as input to the detection stage [START_REF] Kong | Home appliance load disaggregation using cepstrum-smoothing-based method[END_REF][START_REF] Girmay | Simple Event Detection and Disaggregation Approach for Residential Energy Estimation[END_REF]. However, few of them use inputs other than voltage distortion [START_REF] Cox | Transient event detection for nonintrusive load monitoring and demand side management using voltage distortion[END_REF] or current signals [START_REF] Wild | A new unsupervised event detector for nonintrusive load monitoring[END_REF]. The goal of event detection is to extract the occurring event window, which is also referred to as a transient signature. Transient signatures are short-term, momentary fluctuations in power or current before settling into a steadystate value associated with any turn-on, turn-off, speed adjustment, and function/mode changes. As the nature or type of an appliance is closely related to its transient characteristics [START_REF] Leeb | Transient event detection in spectral envelope estimates for nonintrusive load monitoring[END_REF], these can be used as a decent signature of the appliance. Transients have been used by many works in the past [START_REF] Leeb | Transient event detection in spectral envelope estimates for nonintrusive load monitoring[END_REF][START_REF] Shaw | Nonintrusive load monitoring and diagnostics in power systems[END_REF][START_REF] Kamat | Fuzzy logic based pattern recognition technique for non-intrusive load monitoring[END_REF].

Related work

In [START_REF] Lu | A Hybrid Event Detection Approach for Non-Intrusive Load Monitoring[END_REF], the proposed approach includes an algorithm based on moving average variation with a time limit and two auxiliary algorithms based on derivative analysis and filtering analysis to detect false events, using features of active power with a low sampling rate 2.4. Event detection for NILM application with fixed parameters. The strategy used in this approach may affect the accuracy of detecting increased time events with fast transition states.

In [START_REF] Wild | A new unsupervised event detector for nonintrusive load monitoring[END_REF], using the BLUED dataset [START_REF] Anderson | BLUED: a fully labeled public dataset for Event-Based Non-Intrusive load monitoring research[END_REF], the authors proposed an unsupervised solution based on a sliding-window kernel Fisher discriminant analysis (KDFA) where they define an event as an active session that deviates from one steady-state section to another. Furthermore, it is known that event sessions vary in terms of duration; therefore, a critical task for the NIM detector is to accurately detect the start and end duration.

In [START_REF] Nait Meziane | High accuracy event detection for Non-Intrusive Load Monitoring[END_REF][START_REF] Meziane | A New Measurement System for High Frequency NILM with Controlled Aggregation Scenarios[END_REF], the researchers presented a "High Accuracy NILM Detector (HAND)", an unsupervised event-based algorithm. This solution outperformed the KFDA approach and achieved a detection probability of 96.7% on simulated data. The HAND algorithm is based on the envelope function of the current signal and the standard deviation, which makes it fast and efficient.

The authors of [START_REF] Yang | Comparative Study of Event Detection Methods for Non-intrusive Appliance Load Monitoring[END_REF][START_REF] Baets | On the bayesian optimization and robustness of event detection methods in NILM[END_REF] used the GLR approach to test whether two consecutive periods share a typical distribution by deriving a decision function from the log-probability distribution ratio before and after a potential change in the mean value. In [START_REF] Anderson | Event detection for non intrusive load monitoring[END_REF][START_REF] Zhu | A novel CUSUM-based approach for event detection in smart metering[END_REF], the authors apply a CUSUM algorithm to detect the beginning and end of a HEA transient active power signal.

Z. Zhu et al. [START_REF] Basu | Time series distancebased methods for non-intrusive load monitoring in residential buildings[END_REF] achieved a detection probability of 90 % by applying their approach to actual data, including 200 events of eight different HEAs turned on and off.

L. Yan et al. [START_REF] Yan | Adaptive event detection for representative load signature extraction[END_REF] proposed a dynamic time-window-based method for event detection, which dynamically adjusts the size of time windows and other parameters to deal with diverse load variations. It further extracts representative load signatures based on event detection results for NILM and other applications. However, a low sampling rate can lead to minor changes in traces lost.

Some proposed solutions, such as the one proposed by K. Leslie et al. [START_REF] Norford | Non-intrusive electrical load monitoring in commercial buildings based on steady-state and transient load-detection algorithms[END_REF] tried to correlate known appliances' transient signals with aggregated consumption signals to find the corresponding appliances. These solutions are also known as matched filters. This idea was further developed in [START_REF] Baets | Event Detection in NILM using Cepstrum smoothing[END_REF] by applying Cepstrum analysis to the power signal. However, small appliances with low fluctuations can have a negative impact on the performance of the matched filter. this related work are summarized in table 2.3

Energy disaggregation problem

Recently, energy service providers, energy aggregators, and distribution system operators have become increasingly interested in the deployment of NILM applications and systems, In this section, the NILM model is described in detail. Existing NILM machine learning methods are reviewed. These methods are mainly divided into unsupervised and supervised learning methods. We describe the problem of non-invasive load monitoring by providing a formula showing the main reading Y (t) for each time period. In this case, Y (t) represents the sum of all devices' active power consumption. Since Y (t) is a main reading for every time interval, it can be represented as presented in equation 2.1.

Y (t) = N i=1 X i (t) + e(t)
(2.1)

X i (t)

Deep learning for NILM application

The main task clearly single-channel Blind Source separation problem where we have to recover all the on-state appliances X i = {X i (t)} T t=1 (i = 1, ..., N ), from the main observed power readings Y i = {Y i (t)} T t=1 as shown in Figure 2.8. A typical NILM algorithm consists of the following steps: (i) data acquisition, (ii) event detection (optional), (iii) load identification, and (iv) load usage inference. in 2.8 we present the taxonomy of the literature of NILM solutions.

Data acquisition (DAQ)

The first step in any NILM algorithm involves collecting total load readings at an appropriate rate in order to identify distinctive load patterns. Several Smart meters, such as Yomo [START_REF] Klemenjak | Yomo: The arduino-based smart metering board[END_REF] and c-meter [START_REF] Makonin | Inspiring energy conservation through open source metering hardware and embedded real-time load disaggregation[END_REF] have been developed to gauge the total load of a building. A cost-effective way to collect aggregated electricity data is to use smart meters, which are currently deployed as a prerequisite for smart grids. The acquired power data can be recorded at different sampling frequencies where the DAQ step can be categorized into two distinct categories: "HSR" and "LSR". HSR is used when the sampling rate is 1 kHz or more. This is because having detailed load data makes it possible to specify the switching on and off events that occur over time. However, the latest General Data Protection Regulation prohibits energy suppliers from sampling detailed energy consumption data for privacy purposes, which is not the case for personal use, and HSR measurements are expensive. LSR is used when the sampling frequency is less than 1 kHz. LSR devices and meters are affordable and less expensive, but the amount of data acquired may be insufficient to detect appliances that switch on and off quickly.

In the DAQ phase, we need to specify the readings to be sampled. The readings are classified into two categories: steady-state features such as current, voltage, active power and reactive power, which are easy to obtain using the LSR approach, and transient signatures such as transient harmonics, wavelets and FFT, which require an HSR approach.

Event Detection (ED)

The NILM algorithm must detect device operating states (eg ON and OFF) from power measurements. Power level changes (eg ON/OFF) are handled by the detector. This is a complex process because of the different equipment types in the building and the different states to be detected, such as simple ON/OFF states, finite states, constant ON states, and continuously variable states. Based on different event detection strategies, current NILM methods can be divided into event-based methods or state-based methods.

• Event-based approaches focus on the state transition edges generated by appliances and use shift detection algorithms to identify the boundaries of the event window. The task of the event detector is to detect changes in time series of aggregated readings data due to one or more appliances being switched ON/OFF or changing their state. After detecting the event window, device signatures, e.g. active power, increasing/decreasing edge, etc. are extracted and then used as input to classification models to identify load appliances.

• The state-based NILM approaches do not include an event detection step, but deploy a state machine to represent each device process, with distinct state changes based on the application model, with a probability distribution adapted to that device. Statebased NILM techniques are limited by the need for expertise in defining predefined values for each device state through long-term training. In addition, they present significant computational complexity and there is no adequate method to deal with the fact that the state may remain unchanged for long periods of time.

Load Identification (LI)

At this stage, the extracted appliance signature is analysed to classify the specific state of the appliance and estimate the corresponding energy consumption. Statistical and machine learning algorithms are used to learn the model parameters, allowing the state of the appliances to be inferred from the observed total power data and the corresponding energy consumption to be estimated. Using the above features calculated from the total load, the aim here is to identify the equipment that is operating at any given time. This can be formulated as a not-so-simple optimization or classification problem, as four models of equipment are generally considered:

• On/Off appliances: Most household appliances, such as light bulbs and toasters;

• Finite State Machine (FSM): Such devices typically present states in a periodic fashion. e.g. washer/dryer, refrigerator, etc.;

• Continuously Varying Appliances: The performance of these devices changes over time, but not on a regular basis. Such as dimmers and tools.

• Permanent consumer appliances: These devices have a constant power source but operate 24/7, such as B. Alarms and external power.

NILM applications have changed dramatically over the years as they evolve. This guide provides some commonly used learning methods, methods are summerized in figure 2.9.

Graph-based signals:

GSP techniques are novel and flexible methods for solving problems. They were created as a replacement for NILM learning methods, which do not detect events. GSP methods are concerned with data mining and signal processing, and they were first proposed in order to apply them to energy decomposition. The researchers in [START_REF] Zhao | Improving event-based nonintrusive load monitoring using graph signal processing[END_REF][START_REF] Zhao | On a training-less solution for nonintrusive appliance load monitoring using graph signal processing[END_REF][START_REF] He | Non-intrusive load disaggregation using graph signal processing[END_REF] showed that GSP methods were as effective as HMMs in this area. Traditional learning methods face a significant problem in that they require a lot of training before they can be used. With the GSP methods, researchers were able to effectively overcome this issue and demonstrate high performance. Additionally, NILM researchers have come up with other EMI-based, wavelet design and power spectrum-based methods.

2.5. Deep learning for NILM application 2. Optimization: When working with machine learning, it is important to optimize. This is because the nature of machine learning is optimization; it matches known power measurements to existing appliance power signals in the database by minimizing the mismatch. Several optimization methods have been developed by researchers. These methods include "Aided Linear Integer Programming (ALIP)" [START_REF] Bhotto | Load disaggregation based on aided linear integer programming[END_REF] which was created to be more efficient than standard linear programming; and evolutionary optimization algorithms [START_REF] Egarter | Evolving Non-Intrusive Load Monitoring[END_REF], which are supposed to be more accurate than other optimization methods. Several of these methods have been tested and validated by the research community.

Probabilistic Statics:

Probability theory is a useful method for solving problems in energy systems, such as energy planning. Most researchers focus on studying "Hidden Markov Model (HMM)" based models. In [START_REF] Kim | Unsupervised disaggregation of low frequency power measurements[END_REF], the authors proposed a probabilistic framework that uses low-frequency data to solve the energy decomposition problem, inspired by the success of HMM methods in identifying network documents. Based on the work in [START_REF] Kim | Unsupervised disaggregation of low frequency power measurements[END_REF], the authors in [START_REF] Zeifman | Disaggregation of home energy display data using probabilistic approach[END_REF] used a probabilistic approach, a modified Viterbi algorithm, to disassemble the device. The Bayesian method is also a commonly used method. Reference [START_REF] Srinivasarengan | A framework for non intrusive load monitoring using bayesian inference[END_REF] uses an unsupervised Bayesian approach to perform load decomposition. However, the proposed method cannot identify unknown loads with high accuracy.

Machine learning:

This part includes all traditional classification and regression algorithms (not deep learning) which means that a handcrafted feature extraction process has been performed using domain expert knowledge. Compared to deep learning methods, these solutions are easier to implement, have lower computational complexity, and in some cases provide encouraging results. In this approach, we can find supervised, unsupervised, and semi-supervised techniques. For supervised methods, Reference [START_REF] Nardello | A low-cost smart sensor for non intrusive load monitoring applications[END_REF] proposes a supervised load decomposition algorithm based on event detection, which performs data analysis locally and demonstrates a promising application. With supervised methods, training is a difficult problem because adequately labeled data is often not available to identify device features.

To address the training problem in supervised learning, Reference [START_REF] Barsim | Toward a semi-supervised non-intrusive load monitoring system for event-based energy disaggregation[END_REF] proposes a self-learning method, also known as "semi-supervised learning (SSL)", which has been proven in practice. The ultimate goal of the NILM system is to identify and decompose the burden of unsupervised learning. However, in business applications, especially for the reliability and stability of product development, fully unsupervised learning is not easy to fully implement in the early days. Here we give some common learning methods as References in the NILM application.

deep learning:

As a branch and extension of machine learning, deep learning is a hot topic in both research and industrial fields. Readers can refer to [START_REF] Lecun | Deep learning[END_REF] for some popular deep learning architectures such as auto-encoders, "Convolutional Neural Networks (CNN)", and "RNN". In the literature, we can find many deep learning-based approaches that were proposed to solve the NILM problem however only a few works addressed the portability of the trained model and the privacypreserving issue. In this section, we focus on some research works that have been introduced in this context. In [START_REF] Yang | Semisupervised Multilabel Deep Learning Based Nonintrusive Load Monitoring in Smart Grids[END_REF], authors proposed a semi-supervised multi-label

Probabilistic Statistics Hidden Markov Models [110]

Bayesian methods [START_REF] Zeifman | Disaggregation of home energy display data using probabilistic approach[END_REF][START_REF] Srinivasarengan | A framework for non intrusive load monitoring using bayesian inference[END_REF] Machine learning

Supervised methods [113]

Semi-supervised methods [START_REF] Barsim | Toward a semi-supervised non-intrusive load monitoring system for event-based energy disaggregation[END_REF] Unsupervised methods

Deep learning

Auto-encoders CNN [START_REF] Yang | Semisupervised Multilabel Deep Learning Based Nonintrusive Load Monitoring in Smart Grids[END_REF] RNN Semisupervised multilabel deep learning [START_REF] Yang | Semisupervised Multilabel Deep Learning Based Nonintrusive Load Monitoring in Smart Grids[END_REF] FedNILM [START_REF] Yang | Semisupervised Multilabel Deep Learning Based Nonintrusive Load Monitoring in Smart Grids[END_REF] Appliance transfer learning (ATL) [START_REF] D'incecco | Transfer Learning for Non-Intrusive Load Monitoring[END_REF] cross-domain transfer learning (CTL) [START_REF] D'incecco | Transfer Learning for Non-Intrusive Load Monitoring[END_REF] Figure 2.9: Load identification Literature Tree deep learning framework based on a temporal convolutional network (SSML-TCN).

The proposed end-to-end trainable framework can automatically learn the load characteristics of a single device, and can also monitor multiple devices simultaneously using low sampling rate measurements. In [START_REF] Yang | Semisupervised Multilabel Deep Learning Based Nonintrusive Load Monitoring in Smart Grids[END_REF], FedNILM is proposed based on "Federated Learning (FL)". The FL paradigm was introduced for real-world NILM applications. Assisted by the FL paradigm and with realistic considerations, Fed-NILM is expected to deliver scalable NILM assistance with state-of-the-art precision across large-scale households while retaining consumption details privacy for edge consumers. In [START_REF] D'incecco | Transfer Learning for Non-Intrusive Load Monitoring[END_REF], two transfer learning techniques were proposed, "Appliance Transfer Learning (ATL)" and "Cross-domain Transfer Learning (CTL)". For ATL, their results demonstrate that the latent features comprehended by a 'complex' appliance such as a washing machine, can be transferred to a 'simple' appliance such as a kettle.

Conclusion

To sum up, the current chapter offers a comprehensive summary of the latest trends in residential energy demand analysis. It concentrates on various aspects, including public 2.6. Conclusion datasets on residential energy demand, identifying abnormal energy consumption, detecting events in Non-Intrusive Load Monitoring (NILM) applications, and the integration of deep learning methods in NILM.

The third section focuses on datasets related to public residential energy demand and specifically emphasizes the existence of comprehensive datasets that offer intricate information pertaining to electricity usage in residential buildings.The central topic of Section 2.3 is the detection of abnormal energy usage in residential structures. The section delves into the study of techniques for identifying anomalies and outliers in energy consumption. The literature review within this section encompasses both supervised and unsupervised approaches for detecting anomalous energy consumption.

Section 2.4 of the document alters the focus of discussion towards event detection as it relates to Non-Intrusive Load Monitoring (NILM) applications. This section introduces the concept of event-based NILM, which entails the identification of discrete events that are linked to energy consumption. The related research on this topic is explored, with particular attention given to the varied methodologies and approaches utilized. In Section 2.5, an investigation into the implementation of deep learning practices in NILM is conducted. The three fundamental stages of NILM systems utilizing deep learning are elucidated: data extraction, event recognition, and load identification. This part of the text offers valuable knowledge on the utilization of deep learning models to accurately disentangle and determine individual loads within a domestic energy consumption profile.

The chapter presents an all-encompassing account of the current state of research in the domain of analyzing energy consumption in households. It emphasizes the accessibility of public datasets, multiple methods for detecting anomalous energy usage and events in nonintrusive load monitoring (NILM), and the implementation of deep learning techniques to identify energy loads. The knowledge imparted in this chapter acts as a groundwork for future exploration and innovation in the realm of residential energy management and eco-friendly behaviors.

Anomaly detection method for online electricity consumption

Chapter 3

Anomaly detection method for online electricity consumption

Introduction

This chapter outlines a thorough approach to detecting anomalies in online electricity consumption. Unusual electricity consumption patterns may indicate a range of issues, including equipment malfunction, energy theft, or shifts in user behavior. It is imperative to recognize and pinpoint these anomalies in order to maintain effective energy management and prevent potential hazards. In Section 3.2, our anomaly detection method's workflow is introduced. As depicted in Figure 3.1, The process is comprised of several important steps, which include data collection, data preprocessing, and anomaly detection. The successful identification and analysis of anomalies in electricity consumption rely heavily on each of these steps. The process of data collection is examined in Section3.2.1. The cornerstone of any anomaly detection system is precise and dependable data collection. In this section, we will examine the techniques used to collect the requisite data on electricity consumption and emphasize the significance of top-notch data for precise anomaly detection. The primary subject of Section 3.2.2 is the preparation of data. Raw data has a tendency to contain issues such as inconsistencies, missing values, or noise that can have a negative impact on the efficiency of anomaly detection algorithms. To improve the quality and appropriateness of the data for the following anomaly detection steps, we examine a variety of methods to preprocess the data. These techniques include data cleaning, normalization, and feature extraction. Our anomaly detection approach is detailed in Section 3.2. This section comprises of a thorough explanation of the algorithms and techniques we employ to identify anomalies in the preprocessed electricity consumption data. Our approach is based on using state-of-the-art anomaly detection algorithms that utilize either statistical analysis, machine learning, or a combination of both. We also provide a comprehensive overview of the strengths and limitations of these techniques and offer insights into their effectiveness in detecting anomalies. In Section 3.3, the outcome and discussion of our method for detecting anomalies are presented. To determine the efficacy of the approach suggested, we utilize real-life data on electricity consumption. Following this, we conduct an evaluation of the anomalies that were detected, discussing their relevance and potential causes.

Anomaly detection workflow

The goal of this chapter is to make a contribution to the area of anomaly detection in residential electricity consumption [START_REF] Kaddour | Electricity consumption data analysis using various outlier detection methods[END_REF]. We aim to achieve this by providing a comprehensive methodology that can effectively identify and analyze anomalies in online electricity consumption data. To accomplish this, we will utilize three unsupervised machine learning methods: isolation forest, one-class SVM, and K-Means. Timely detection and resolution of these anomalies can lead to improved operational efficiency, optimized resource allocation, and reliable and secure delivery of electricity services through energy management systems. We implemented this workflow by combining the KNIME analysis platform [START_REF] Berthold | KNIME-the Konstanz information miner: version 2.0 and beyond[END_REF] and the Scikit Learn library [START_REF] Pedregosa | Scikit-learn: Machine learning in Python[END_REF].

Anomaly detection workflow

In this section, we present the proposed method for detecting anomalies in power consumption using three unsupervised machine learning methods: isolation forest, one-class SVM, and K-Means. The proposed solution consists of the following four phases, as shown in Figure 3.1:

• Data collection • Data pre-processing • Abnormal detection • Evaluation
We implemented this workflow by combining the KNIME analysis platform [START_REF] Berthold | KNIME-the Konstanz information miner: version 2.0 and beyond[END_REF] and the Scikit Learn library [START_REF] Pedregosa | Scikit-learn: Machine learning in Python[END_REF].

Data Collection

To detect abnormal power consumption behavior, additional input variables related to power consumption must be added. These characteristics must be collected from multiple data sources. The data is collected by the sensors composing a wireless sensor network (WSN) deployed in the area of interest [START_REF] Kaddour | Routing based on genetic algorithms for largescale wireless sensor networks[END_REF]. We can define two data types:

• Building data

• Environmental data

In most previous works, researchers provide a private dataset to train their models. There is a lack of publicly available labeled electricity usage records for training/learning anomaly detection algorithms. Fortunately, there are open source datasets of energy usage metering and environmental data with specific objectives ranging from energy breakdown, NILM, and device discovery to energy savings in various buildings.

SMART* (Smart-Star) was the best candidate for our research which is as defined before an open dataset released in 2017. To fully comprehend the dataset, visual representation is essential. Among the key features, energy consumption stands out. Every building has its unique energy utilization habits, based on various factors such as occupancy fluctuations, environmental conditions, and building architecture. As a result, data may vary significantly from building to building, as depicted in Figure 3.2. The figure illustrates the divergent power consumption behavior of two furnaces in different buildings. While the first part of the graph displays clear periodicity in each furnace's data, the relationship between the two structures becomes more obscure towards the end. Figure 3.3 further highlights this point, showcasing the power consumption patterns of a furnace in house A over two years. The figure reveals that seasonal and monthly cycles are visible and that there is a degree of similarity between the two years. The significance of this lies in the ability for a well-constructed model to accurately identify outliers. However, the complex, unclear relationship between the consumption of various structures makes modeling a challenging task. Each building will have its own distinct model created for it.

Data Preprocessing

Once data has been gathered, it must be meticulously tidied and prepped for use in anomaly detection models. Only pertinent features like those relating to power consumption can be utilized. This stage also involves outlining a comprehensive system of functions germane to our energy consumption problem. Climate change and variable occupancy have a significant impact on energy consumption, with high consumption observed in response to extreme temperatures (hot or cold) and building occupancy. The occupancy rate can be expressed by the day of the week because weekends have a significant impact on consumption values. The essence of electrical measurement is time-series. This data type is an ordered data set sampled at equal time intervals. The sampling rate for the SMART* dataset is 1 sample/hour. One of the main problems with dealing with time-series readings from each device is random noise and sudden changes that can disrupt the modeling process. To reduce noise, we apply a backward-moving average window of M , as shown in equation (3.1).

[n] = 1 M + 1 0 k=-M x[n + k] (3.1)

Anomaly detection

Online data request, also known as streaming data, is continuously generated data that flows in and out like a stream for an infinite time [START_REF] Ding | An anomaly detection approach based on isolation forest algorithm for streaming data using sliding window[END_REF][START_REF] Teixeira | Data stream anomaly detection through principal subspace tracking[END_REF]. It is also an increasing Ndimensional vector sequence, the general form of online data can be defined as expressed in Equation (3.2).

x = {x(1), x(2), x(3) . . . x(t), x(t + 1)} | (3.2)
where:

x(t) ∈ R N : t ≥ 1 (3.3)
with the following forms:

X 1 = {x(1), x(2), . . . , x(M )} X 2 = {x(M + 1), x(M + 2), . . . , x(M )} X i = {x((i -1) * M + 1), x((i -1) * M + 2), . . . , x(i * M )} (3.4)
where M denotes the size of the window or the number of instances per block. We note that the moving window step size is fixed as M . The main focus of online data anomaly detection is to investigate whether there are anomalous instances based on the trained anomaly detection model. The general anomaly detection scheme proposed in this work for streaming data is shown in Figure 3.4. As previously mentioned, we use three methods to train models to detect anomalies, which we define as peak or valley power demands or faulty devices. Technically, as shown in Figure 3.4, after preprocessing the data using the KNIME module and applying a moving average to the performance of each device, some variables for each method, such as the K-Means method, are predefined.

Anomaly detection workflow

Primarily, the first arrived preprocessed data will be used in the training phase, which consists of feeding them to the sliding windows with a predefined window size M where each instance X (power usage) is associated with temperature and weekday index. A considerable number of windows are used to train the initial models. One of the main challenges in this context is how to define the parameters that must be predefined before the process such as sliding window size and step, the number of windows that can be used in the training phase, and the learning models parameters. In our case, these parameters are chosen by prior knowledge and experiments.

After the training phase, every point in the sliding window is treated by the anomaly detection model to infer whether it is an anomaly or not based on its anomalous score. After the instances in one sliding window are completed, the statistical results are acquired. First, the preprocessed data arriving first is used in the training phase, consisting of feeding it to a sliding window with a predefined window size M , per instance X (energy consumption) versus temperature and weekday index. A large number of windows are used to train the initial model. One of the main challenges, in this case, is to define parameters that need to be pre-defined before the process, such as B. The size and step size of the sliding window, the number of windows that can be used in the training phase, and the parameters of the learned model. In our case, these parameters were chosen based on prior knowledge and experiments.

After the training phase, each point in the sliding window is processed by the anomaly detection model to infer whether it is an anomaly based on its anomaly score. After the sliding window instance completes, statistical results are collected. Since we are using an unsupervised learning approach, the goal of the training step is to produce an outlier detector P that can distinguish between normal and abnormal instances Y using unlabeled data X. Start with the isolation forest approach, which consists of several isolation trees, iTrees. We construct iTrees based on Xi's bootstrap sampling. An ensemble detection model P consisting of L iTrees, namely P = P 1 , P 2 , ..., P L , is constructed from the data in the first sliding window by splitting the sample into two subsamples according to selected instance values. Here the attributes are selected randomly and the split values of the selected attributes are also randomly selected between the minimum and maximum values of these selected samples. This process is performed recursively for each subsample until all instances are isolated. Calculate the average depth of the instance in the forest, which consists of several iTrees, as the outliers of the instance. The lower the score of an instance, the more likely it is an anomaly.

The second detector is trained using a one-class SVM, as shown in Figure 3.5. SVM can construct a nonlinear decision boundary by projecting data into a higher-dimensional space through a nonlinear function Φ. This means that instances that cannot be separated by a straight line in their original space I are lifted into the feature space F where there can be a straight hyperplane separating data points of one class from those of another. The projection I of this hyperplane onto the input space will have the form of a non-linear curve. This method is known as the kernel trick. Furthermore, OC-SVM separates all data points X from the origin (in feature space F ) and maximizes the distance from this hyperplane to the origin. This causes the binary function to capture the region in the input space where the probability density of the data resides. Therefore, the function returns (+1) in a small area (capturing training data points) and (-1) elsewhere.

Finally, we used K-Means, a clustering method. In the training phase, the K-Means 1. The distance that separates it from its assigned cluster's centroid is calculated;

2. The points are sorted descending using their distance from their centroids;

3. The first N points are considered outliers where:

N = [outlier f raction ratio * instances number ] (3.5)
We note that the outlier fraction ratio is defined before starting the clustering process.

Results and Discussion

In this section, we present the performance of each of the anomaly detection methods and compare them in different contexts and on different equipments in a building to illustrate the robustness of each one.

When provided with labeled data, various evaluation methods such as "Receiver Operating Characteristics (ROC)", precision-recall curves, and obfuscation are used at this stage. However, since the SMART* dataset is not labeled without defining ground-truth data on power anomalies, we had to run the proposed solution multiple times with different parameters and different training stages and empirically analyze The results to select the most suitable parameters for each method shown in Table 3.1. As shown in Figure 3.6, Isolation Forest and One-Level SVM show some promising results, compared to K-Means, which is always on. In the oven test, we can observe the similarity between outliers detected by Isolation Forest and One-Class SVM. In contrast, Table 3.2 shows the number of anomalies detected by each method (iForest, OC-SVM, and K-Means). The studies conducted as part of the detection of anomalies in energy consumption in residential study areas did not use known benchmarks, mainly due to the lack of labeled datasets, and thus could not be compared with other solutions. However, most of the solutions proposed above aim to detect anomalous energies in datasets with the highest accuracy. Such good results can be achieved using supervised learning, but in terms of practicality, it is almost impossible to transfer this solution to other buildings, nor can it withstand large changes in the consumption of target apartment buildings. Furthermore, using unsupervised learning requires meaningful features that can affect energy consumption behavior, such as B. Detailed power consumption, temperature, weekends, and holidays for each device.

Conclusion

In this chapter, we have presented a contribution that addresses anomaly detection, especially faulty equipment or unusual consumption behavior in residential building energy consumption data. The abnormal situation of equipment consumption should be detected and analyzed to determine whether it is caused by equipment failure or human factors.

Although not discussed in this chapter, it is possible to detect anomalous consumption behavior using the same anomaly detection methods described in this chapter. Furthermore, the problem is complicated by the fact that when modeling consumption behavior over time, device-supervised approaches are not good options because we have to retrain the model for each change in terms of device, occupancy, and climate change.

Event Detection for Non-intrusive Load Monitoring using Tukey's Fences

Chapter 4

Event Detection for Non-intrusive Load Monitoring using Tukey's Fences

Introduction

Energy saving has become one of the major concerns across the globe. Domestic energy consumption accounts for about 33% of the total energy consumption in the world, and up to 20% of energy saving has been achieved by increasing awareness of energy use through feedback on electricity consumption from "HEA" [START_REF] Armel | Is disaggregation the holy grail of energy efficiency? the case of electricity[END_REF][START_REF] Shaikh | A review on optimized control systems for building energy and comfort management of smart sustainable buildings[END_REF]. Hence, it is essential to monitor home energy consumption judiciously. The conventional method of equipping HEAs with sensors to acquire measurements is difficult in terms of installation and maintenance. This method is known as "ILM". On the other hand, NILM has emerged as a promising approach to provide a detailed report of HEA consumption. The identification of appliance consumption is performed by applying analysis to the main power input load signals (current and voltage). NILM was originally proposed by Hart [START_REF] Hart | Nonintrusive appliance load monitoring[END_REF] and required only one meter connected to the main electrical panel of the house. Statistics and usage information are provided to the different smart grid entities such as power suppliers, distributors, and end-users (consumers). Consumers react based on this information and reduce their energy consumption; the "HEMS" can use this information to monitor energy consumption in the home. Also, in smart grids, power producers can benefit from that information to develop better predictive models. The growing interest in the field has prompted researchers to try and implement different approaches and Algorithms for solving energy decomposition problems involving neural networks, big data, soft computing, and statistical methods. Probabilistic methods gain popularity in energy modeling using "Hidden Markov Models (HMMs)" [START_REF] Kolter | REDD : A Public Data Set for Energy Disaggregation Research[END_REF][START_REF] Parson | Non-intrusive load monitoring using prior models of general appliance types[END_REF][START_REF] Wen | Activity recognition with weighted frequent patterns mining in smart environments[END_REF][START_REF] Zhong | Signal aggregate constraints in additive factorial HMMs, with application to energy disaggregation[END_REF], HMMs are probabilistic models which are unsupervised models. However, in the most important applications, they are trained in a supervised way [START_REF] Tamposis | Extending hidden markov models to allow conditioning on previous observations[END_REF],Solutions based on supervised methods are the most popular ones [START_REF] Bonfigli | Unsupervised algorithms for non-intrusive load monitoring: An up-to-date overview[END_REF], while a few studies have proposed solutions using unsupervised [START_REF] Liu | Non-Intrusive Load Monitoring Based on Unsupervised Optimization Enhanced Neural Network Deep Learning[END_REF], reinforcement [START_REF] Zaouali | LSTM-Based Reinforcement Q Learning Model for Non Intrusive Load Monitoring[END_REF], and transfer learning approaches [START_REF] Dincecco | Transfer learning for non-intrusive load monitoring[END_REF]. Supervised techniques rely on classification algorithms using a sufficient amount of labeled data for training. Moreover, non-supervised methods address the lack of labeled data which is difficult to obtain. Given the sampling frequency, NILM-based approaches can be classified into two categories [START_REF] Faustine | A Survey on Non-Intrusive Load Monitoring Methodies and Techniques for Energy Disaggregation Problem[END_REF]: "LSF" approaches (1 KHz or less) and HSF" Chapter 4. Event Detection for Non-intrusive Load Monitoring using Tukey's Fences approaches (kHz to MHz).

Datasets with low sampling frequency are more frequent [START_REF] Henriet | A generative model for non-Intrusive load monitoring in commercial buildings[END_REF] compared to those with high frequency, making the former readily accessible and widespread. This field has another dichotomy: event-based vs. non-event-based NILM depending on whether they rely on detecting and classifying transition signals or not [START_REF] Jorde | Event Detection for Energy Consumption Monitoring[END_REF][START_REF] Baranski | Genetic algorithm for pattern detection in NIALM systems[END_REF].

The pipeline of the event-based approach includes the following steps: event detection, feature extraction, Load identification, and energy consumption estimation. Since event detection is the first step, it goes without saying its importance to the NILM pipeline. For the event-based approach, the input functions used varied from work to work. Most studies [START_REF] Sadeghianpourhamami | Comprehensive feature selection for appliance classification in NILM[END_REF] used active and reactive power as input for event detection, while some others use other inputs such as voltage distortion [START_REF] Nait Meziane | High accuracy event detection for Non-Intrusive Load Monitoring[END_REF] or current signal [START_REF] Anderson | Event detection for non intrusive load monitoring[END_REF]. Event detectors can be expressed as anomaly detection in detected signals, which facilitates the analysis and modeling of physical phenomena. Several NILM-based event detection methods have been proposed in the literature, most of which can be divided into supervised [START_REF] Li | Power decomposition based on SVM regression[END_REF] and unsupervised methods [START_REF] Nait Meziane | High accuracy event detection for Non-Intrusive Load Monitoring[END_REF][START_REF] Meziane | A New Measurement System for High Frequency NILM with Controlled Aggregation Scenarios[END_REF]. NILM solutions that are event-based are more accurate than non-event-based ones. This is because steady state NILM classifiers often miss low HEA power usage and short ON state duration. As a result, event-based NILM solutions can provide better results.

A novel unsupervised NILM event detection mechanism, the "Tukey's Fences-based Event Detector (TFED)", is the focus of this research work. This method leverages an "FFT" sliding window in combination with Tukey's fences outlier detection strategy to dynamically calibrate the threshold for different load variations. Additionally, it identifies load signatures that are representative based on the NILM and other related applications, including device failure detection and end-user protection, using the event detection outcomes.

In this chapter, we present a contribution on event detection for NILM using Tukey's Fences [START_REF] Kaddour | Event detection for non-intrusive load monitoring using tukey's fences[END_REF].

Preliminaries

Many algorithms were introduced in the context of real-time event detection for NILM [START_REF] Baets | Event Detection in NILM using Cepstrum smoothing[END_REF]. In the following we define a few known aspects that we employed in our research and techniques that are commonly used for real-time event detection .

Chi Squared Goodness Of Fit χ 2 GOF

In order to identify load changes, a novel technique called the χ 2 GOF test was developed by [START_REF] Jin | A time-frequency approach for event detection in non-intrusive load monitoring[END_REF]. This method operates under the assumption that two consecutive timeframes of power readings share the same statistical distribution. By applying a χ 2 statistics and rejecting the null hypothesis, events can be detected. To achieve this, a short windowed time Fourier transform is used to calculate the average power and the first-order harmonic of the instantaneous power signal, derived from the voltage and current signals. The event detector utilizes the goodness-of-fit χ 2 test to identify appliance events and the dominant peaks of the first harmonic of the spectrogram to estimate the change point of the transient.

Fisher Discriminant Analysis (KDFA)" where they define an event as an active session that deviates from one steady-state section to another. Furthermore, it is known that event sessions vary in terms of duration; hence, a critical task for the NILM detector is to detect the start and end duration accurately. In [START_REF] Nait Meziane | High accuracy event detection for Non-Intrusive Load Monitoring[END_REF][START_REF] Meziane | A New Measurement System for High Frequency NILM with Controlled Aggregation Scenarios[END_REF], the researchers developed a "HAND", an unsupervised event-based algorithm. This solution outperformed the KFDA approach and achieved a detection probability of 96.7% on simulated data. The HAND algorithm is based on the envelope function of the current signal and the standard deviation, which makes it fast and efficient however the simulation was evaluated using a modeled signal where they can change the noise parameter which is not the case when working with real readings data. The GOF approach was adopted by The authors of [START_REF] Yang | Comparative Study of Event Detection Methods for Non-intrusive Appliance Load Monitoring[END_REF][START_REF] Baets | On the bayesian optimization and robustness of event detection methods in NILM[END_REF] to test whether two consecutive time-frames share a typical distribution by deriving a decision function from the log-probability distribution ratio before and after a potential change in the mean value. In [START_REF] Anderson | Event detection for non intrusive load monitoring[END_REF][START_REF] Zhu | A novel CUSUM-based approach for event detection in smart metering[END_REF], the authors apply a CUSUM algorithm for detecting the beginning and end of a HEA transient active power signal.Z. Zhu et al. [START_REF] Basu | Time series distancebased methods for non-intrusive load monitoring in residential buildings[END_REF] achieved a detection probability of 90 % by applying their approach to actual data, including 200 events of eight different HEAs turned on and off. L. Yan et al. [START_REF] Yan | Adaptive event detection for representative load signature extraction[END_REF] proposed a dynamic time-window-based method for event detection, which dynamically adjusts the size of time windows and other parameters to deal with diverse load variations. It further extracts representative load signatures based on event detection results for NILM and other applications. However, a low sampling rate can lead to minor changes in traces lost. Some proposed solutions, such as the one proposed by K. Leslie et al. [START_REF] Norford | Non-intrusive electrical load monitoring in commercial buildings based on steady-state and transient load-detection algorithms[END_REF] tried to correlate known appliances' transient signals with aggregated consumption signals to find the corresponding appliances. These solutions are also known as matched filters. This idea was further developed in [START_REF] Baets | Event Detection in NILM using Cepstrum smoothing[END_REF] by applying Cepstrum analysis to the power signal. However, small appliances with low fluctuations can badly affect the matched filter's performance.

Tukey's fences for event detection

To tackle Non-Intrusive Load Monitoring (NILM), leveraging the concept of an "event", denoting changes in the present signal, is one possible solution. The four-stage event detection methodology, portrayed in Figure 4.2, involves collecting measurements, detecting events, classifying them, and estimating energy usage. By measuring the primary power input in the building, the system can detect changes in energy consumption (event detection) when an appliance changes its state. These transition signals are then classified (classification) to estimate the energy consumption of each appliance (energy usage estimation). Outlined below is the suggested "TFED" algorithm. Before delving into this, it is crucial to establish the ground truth for data to evaluate the algorithm's performance when testing it. This ground truth is a compilation of timestamps that denote the occurrence of events.

To identify events in a power signal, the TFED event detection algorithm is employed. Its core functionality is a five-step process illustrated in Figure 4.3. Each step will be discussed in detail below.

Current signal windowing

In order to simplify the detection algorithm while retaining critical information about the changes in power measurements, the BLUED dataset's sampling rate is reduced from 12 kHz to 6 kHz. The input current signal is then subjected to a sliding window w(t) with a window size defined by Equation 4.1 and a step size of 128 samples. Divided into 47 blocks of 128 samples each, creating windows of 6016 samples, as demonstrated in Equation . 4.2.

W (t) = (I 1 , I 2 , • • • , I 6016 ) (4.1) I =       I 1 I 2 • • • I 128 I 129 I 130 • • • I 256 . . . . . . . . . . . . I 5889 I 5890 • • • I 6016       (4.2)

Fast Fourier Transform

The following step involves subjecting each block of the windowed current signal to a forward Fast Fourier Transformation (FFT). This mathematical operation converts the signal into spectral components or frequencies. It is important to note that the number of

F = FFT (I) =       f 1,1 f 1,2 • • • f 1,67 f 2,1 f 2,2 • • • f 2,67 . . . . . . . . . . . . f 128,1 f 128,2 • • • f 128,67       (4.3)
Each column of the matrix represents a defined frequency. The optimal frequency column that exhibited the largest mean difference between the first and second halves was chosen. The resulting time series comprised 128 samples from the 67 blocks illustrated in Equation (4.5), with (S) denoting the index of the chosen column.

X i = F i,S for i ∈ [1; 128] (4.6)

Outlier detection

Initially, we subject each frequency bin to a moving forward standard deviation, employing a window consisting of four samples. This process yields the following equation, referenced as (4.7).

σ(t) = 1 4 t+3 i=t (x i -µ) 2 (4.7)
To ensure accurate results, identifying and addressing outliers in the input is necessary. This can be achieved through the "interquartile range (IQR)" approach, using Tukey's Fences method for outlier detection. The first and third quartiles (Q 1 , Q 3 ) are calculated for the input, and any observations outside the range R (as shown in equation (4.8) are considered outliers and dealt with accordingly.

f (σ(t)) =    0, if σ(t) ∈ R 1, otherwise R = [Q 1 -k(Q 3 -Q 1 ) , Q 3 + k(Q 3 -Q 1 )] (4.8)
With the value of K, set at 0.5,R represents the lower and upper ends of a boxplot's whisker. Any observations that exceed this range are flagged as outliers, turning the window into an event window. Alternatively, if all observations fall within the expected range, the window is flagged as non-event. It's worth noting that missing data is excluded from the calculation of outliers and will not be reported as an outlier.

Experimental Results

As far as our understanding goes, there is no available literature that assesses the efficacy of event detectors in the context of NILM applications. Despite this, the most effective event detector is determined by the degree of disaggregation it yields. To clarify, if we compare the actual energy consumed by an appliance (E k ) and the estimated energy for the same appliance (I k ), we can ascertain the ideal event detection algorithm. In this scenario, the algorithm that minimizes the difference between the actual and estimated values as expressed in equation (4.9) is the superior choice.

min(

N k=1 |E k -I k |) (4.9)
The challenge of reducing the distance is compounded by the fact that the detection of direct impact events has a significant impact on the performance of the NILM classifier. A deficient event detector can seriously hinder the effectiveness of the NILM classifier's overall operation. As such, it is advisable to separate the performance of the event detection stage from that of the classification stage to ensure optimal performance. During BLUED dataset tests, our TFED event detector was evaluated based on TP, FN, FP, Precision, Recall, and F-measure.

• TP : are the true-positives (correctly predicted events),

• FP : are the false-positives (predicted events that were not • FN : are the false-negatives (events not detected), The experiments were conducted multiple times using various parameters, including step size, K constant, and window size, as detailed in Table 4.1. Impressively, TFED yielded exceptional results in Precision, Recall, and F-measure analyses, achieving a 99% event detection rate, as demonstrated in Table 4.2. Furthermore, it outperformed supervised learning approaches utilizing Cepstrum analysis and χ 2 GOF statistic in terms of "F-measure" (Table 4.3). However, supervised approaches showed superior processing times, a correlation to active power processing with low frequency (60 Hz). We acknowledge that while decreasing the current window's step size could generate even better results, it would come at a considerable cost to execution time.

Conclusion

The proposed method of detecting events employs Tukey's Fences numerical outliers' detection method, utilizing the current signal. Our approach is unsupervised and requires no training phase, making it easy to integrate directly. We tested our method on the BLUED dataset and achieved good results across multiple metrics like TP, FN, FP, Precision, and Recall. Remarkably, our unsupervised approach outperforms supervised learning methods like Cepstrum analysis and χ 2 GOF statistic in terms of F-measure. Following event detection, distinct representative signatures are culled, which enhance NILM's identification precision whilst also engendering more plausible load data.

Chapter 5. Deep Clustering Based Non Intrusive Load Monitoring

In this chapter, we present our contribution that consists to create a portable and transferable seq2point-based learning model, where the ideal NILM will train models in multiple homes and appliances, and then apply them to all other unseen homes and appliances to make predictions [START_REF] Kaddour | Toward unsupervised nonintrusive load monitoring using convolutional deep embedded clustering[END_REF]. For example, our aim is for NILM to be trained locally in UK homes and used in the US. We also believe that building residents should be responsible for tagging their data without intrusion from outside agencies. In this context, we propose the DEC NILM which is based on the "DEC" approach. Deep clustering (DEC) has recently emerged as a promising unsupervised learning solution based on the combination of Auto-Encoders and K-Means method. Our solution was developed using Deep-Nilmtk [START_REF] Faustine | UNet-NILM: A Deep Neural Network for Multi-Tasks Appliances State Detection and Power Estimation in NILM[END_REF] and tested on the Ukdale dataset [START_REF] Kelly | The UK-DALE dataset, domestic appliance-level electricity demand and whole-house demand from five UK homes[END_REF].

Deep Embedded Clustering based Non-Intrusive Load Monitoring (DEC-NILM)

Recent NILM prototypes based on DNN are not feasible without having access to a large amount of labeled training data on the client's side. which can be difficult almost impossible and expensive to acquire. Anyhow, it also introduces serious concerns for user privacy and data security. To solve these problems, we propose a sequence-to-point (Seq2point) solution based on an unsupervised deep learning approach to the NILM problem and design DEC-NILM in this section. Our proposed methodology is event-based, it consists of two steps as depicted in 5.1. The first step is the event detection using the TFED detector, and the second step is the load identification using the DEC algorithm. We briefly discuss the TFED detector, DEC algorithm [START_REF] Xie | Unsupervised deep embedding for clustering analysis[END_REF] and UK-Dale dataset in the following sections.

Tukey's Fences based event detector(TFED)

TFED is an event detector based on the "FFT" transform and the Tukey Fences outlier detection algorithm. In this step, the current signal is windowed and decomposed. Any changes in the current patterns are detected, and then the event window is defined fto be delivered to the load identifier.

Data Preparation

A crucial step before training a DNN is data preparation, a set of techniques for arranging data into an appropriate format. In this step, we find three main processes: data parsing, preprocessing, and data loading for deep learning training. Data preparation was conducted with the use of a different custom Dataset class. These classes have been implemented to cover single and multi-building experiment categories and can be found in the datasource module under the NILMTK toolkit library which has been adopted by the DEEP-NILMTK library. Parsing data step is accomplished using The NILMTK package hence the data must be compatible with the NILMTK format. This format is inspired by the REDD dataset structure [START_REF] Kolter | REDD : A Public Data Set for Energy Disaggregation Research[END_REF]. To load datasets accurately, two classes are implemented, which can be found in the datasource module; datasource factory; and

Data preprocessing

Data preprocessing is achieved by the following steps, as depicted in table5.2. First, readings are downsampled to 8 Hz, time-series are time aligned. Next, missing values are replaced using two methods of filling missing values that are currently supported; zero replacement and linear interpolation. Event window extraction using TFED event detector output. Normalization of the data is then applied. Data normalization (data scaling) is important because neural networks are easier to train when dealing with small values. This is due to the gradient descent optimization algorithm [START_REF] Sutskever | Sequence to sequence learning with neural networks[END_REF]. This step is accomplished using the Z-score normalization.

Z-score normalization refers to the process of normalizing all values in the dataset so that the mean of all values is 0 and the standard deviation is 1, Z-score normalization is given by equation 5.1.

Z =

x -µ σ (5.1) 5.2. Deep Embedded Clustering based Non-Intrusive Load Monitoring (DEC-NILM) inferred, in contract with sequence-to-sequence architecture where the outcome is represented as a sequence or a vector. In our model implementation, we adopted the DEC algorithm which consists of two phases, parameter initialization with a deep autoencoder which has a sequence-to-sequence network as a model composed of two components: an encoder and a decoder [START_REF] Sutskever | Sequence to sequence learning with neural networks[END_REF]. The encoder f θ is a recurrent neural network (RNN) that takes an input event window sequence (x 1 , ..., x T ), where T is the length of the input window, and encodes the information into a fixed-length vector (z 1 , ..., z K ). Since the dimensionality of Z is generally much smaller than X, the encoder formula can be represented by the equation (5.2).

z i = f θ (x i ) ∈ Z (5.2)
z i the embeded representation of x i also known as the code or the latent layer is expected to summarize the entire input sequence well. The decoder is also an RNN that is initialized with a single context vector (z 1 , ..., z K ) as its input and produces an output sequence (y 1 , ..., y T ) vector by vector, DNNs use subsequences obtained through sliding window techniques. The average duration of the appliance ON/OFF event is used to determine the length of the window in which input and output sequences are selected for NILM modeling.

The elements of the model are characterised by :

• Encoder: The encoder network consists of an input layer and three fully connected layers (dense).

• Code(latent layer): The code layer consists of one fully connected dense layer with 10 units and linear activation function.

• Decoder: The decoder network consists of three fully connected layers (dense) and an output layer.

The specific configuration of the auto-encoder net is as follows:

• Input : sequence length is 121 determined by the event window duration,

• Dense : This parameter can take the following values:

-Fully connected layer with 500 units, and ReLU activation function, -Fully connected layer with 2000 units, and ReLU activation function, -Fully connected layer with 10 units, and linear activation function, -Fully connected layer with 2000 units, and ReLU activation function,

• Output : sequence length is 121 determined by the event window duration.

After initiating encoder f θ and defining initial clusters centroids {µ j ∈ Z} k j=1 using K-Means method, the second phase is parameter optimization (clustering using KL divergence). This phase consists of two steps. These steps are repeated until the convergence criterion is satisfied.

a) Sort Assignment

Calculate a soft assignment q ij between the code vectors and the cluster centroids, Student's t-distribution is utilized as a kernel to estimate the similarity between the code vector and centroid as represented in equation (5.3).

q ij = (1 + ||z i -µ j || 2 /α) -α+1 2 j ′ (1 + ||z i -µ j ′ || 2 /α) -α+1 ′ 2 (5.3)
where :

• q ij : Probability of assigning sample i to cluster j,

• α : Student's t-distribution's degrees of freedom.

α is set to 1 (α = 0) since we are using an unsupervised approach where it is not possible to apply a cross validation thus we get the following equation (5.4).

q ij = (1 + ||z i -µ j || 2 ) -1 j ′ (1 + ||z i -µ j ′ || 2 ) -1 ′
(5.4)

b) KL Divergence minimization

It allows toUpdate the deep mapping f θ and refine the cluster centroids by learning from current high assurance assignments using an auxiliary target distribution. Particularly, the model is trained by comparing the soft assignment to the target distribution. The goal is defined as a KL divergence loss between the soft assignments q i and the auxiliary distribution p i as expressed in equation (5.5).

L = KL(P ||Q) = i j P ij log P ij Q ij .
(5.5) p i is obtained using the second power of q i and then normalizing by frequency per cluster according to equation (5.5) .6) where soft cluster frequencies f j = i q ij . Finally To find the cluster assignment, the process stops if less than 10 -3 of the points change cluster assignment between two consecutive iterations.

p ij = q 2 ij /f j j ′ q 2 ij ′ /f ′ j ′ . ( 5

Experimental Setup

In this section, we present the various experiments carried out to illustrate the performance of the proposed model. Basically, this metric finds the best match between cluster assignment and ground truth assignment. The best mapping can be efficiently computed by the Hungarian algorithm.

Experimental Results

The evaluation of deep clustering approaches can be a difficult task. In this study, we assess the performance of the DEC-NILM method quantitatively with precision, recall, F-score metrics, and the aforementioned clustering accuracy. All experiments were conducted using data from the UK-DALE dataset. We selected house 3 with 5 power meters and fine disaggregation after careful consideration. This house provides the advantage of all appliances being identifiable in individual data meters, which allows for the simple creation of ground truth for evaluation purposes. Although data collection from certain meters was sometimes interrupted. We concluded that the month of July 2013 had the best data quality, with minimal instances of missing data in 8 of the 20 meters. 5.3 shows the total energy consumption, maximum power, and average power consumption for four different appliances: a kettle, an electric space heater, a laptop computer, and a projector. The kettle consumes the least amount of energy overall, with a total energy consumption of 3800 kWatts. However, it has the highest maximum power consumption, at 4000 Watts, which is expected as it is designed to quickly boil water. The average power consumption of the kettle is 5.5 Watts, which is relatively low since it is typically used for short periods of time. The electric space heater, on the other 5.5. Conclusion hand, consumes the most energy overall, with a total consumption of 3100 kWatts. It also has the highest maximum power consumption, at 3700 Watts, which is necessary for heating a large space. The average power consumption of the electric space heater is 45.78 Watts, which is much higher than the other appliances due to its high power output. The laptop computer has a total energy consumption of 10500 kWatts, which is relatively moderate compared to the other appliances. It has a maximum power consumption of 3800 Watts, which is typically only reached during high-demand tasks such as gaming or video rendering. The average power consumption of the laptop computer is 15.35 Watts, which is relatively low due to its efficient design and low-power components. The projector consumes a total of 8900 kWatts of energy, which is similar to the laptop computer. It has a maximum power consumption of 2256 Watts, which is reached during intense light output, such as when projecting a bright image. The average power consumption of the projector is 13.03 Watts, which is lower than the electric space heater but higher than the kettle or laptop computer.

Overall, this figure demonstrates that different appliances have varying energy requirements depending on their intended use and design. It's important to consider the energy consumption and efficiency of appliances when making purchasing decisions to minimize energy waste and reduce environmental impact. Table 5.3 shows the evaluation metrics for the DEC-NILM event classification solution on house 3 in UK-DALE. The solution was evaluated on four different devices: kettle, electric space heater, laptop computer, and projector. The evaluation metrics include true events, true positives (TP), true negatives (TN), false positives (FP), false negatives (FN), precision, recall, and F1-score. The results show that the solution achieved good performance for all devices, with F1-scores ranging from 0.71 to 0.83. The kettle and projector devices had the highest F1-scores, indicating that the solution was particularly effective at detecting events for these devices. The laptop computer had the lowest F1-score, but still achieved a reasonably good performance.The DEC-NILM event classification solution effectively detects energy-related events on house 3 in UK-DALE, with good performance across all devices. The solution achieved a high recall score, indicating that it was able to detect most of the actual events. However, the precision score was lower, suggesting that the solution also generated some false positive predictions. This could be due to the inherent difficulty of accurately detecting events in real-world scenarios, as there may be other factors that influence energy consumption besides the device itself. Despite the good performance, there is still room for improvement in the DEC-NILM solution. For example, the solution could potentially benefit from additional features or more sophisticated algorithms for event detection. Additionally, the solution was only evaluated on a single house, so it is unclear whether the performance would generalize to other houses or datasets. Overall, the results suggest that the dec-NILM load classification solution is a promising approach for detecting energy-related events in household settings, but further research is needed to fully assess its potential and improve its performance.

Conclusion

Through electrical load monitoring, it is now possible to capture detailed usage patterns of electronic devices and the energy consumption of households. By analyzing this data, people can learn about their consumption behavior, leading to small but significant changes that can reduce both electricity costs and environmental impact. However, the challenges of analyzing aggregated electricity usage data without prior interaction with individual electrical devices make this a difficult task. This area of study, known as non-intrusive load monitoring, has been extensively researched for many years. Contained within this Work is an analysis process for data gathered by smart meters that are currently in use or have been installed globally. Utilizing deep embedded clustering, a novel approach is proposed for detecting changes in power consumption. The method involves reducing the power signal to a latent vector and utilizing soft assignment in the clustering phase. Thus avoiding collecting labeled data and preserving residents' privacy. The system has been tested using data gathered from standard households by multiple UK-based smart meters. The findings indicate that the method can accurately detect appliance usage, even in challenging scenarios where multiple appliances are utilized simultaneously. Furthermore, the use of deep-embedded clustering resolves issues where traditional clustering methods fail to classify events appropriately.

In upcoming projects, we aim to expand our analysis with the inclusion of more appliances. This will be made possible through the utilization of deep-embedded clustering techniques, which will allow us to effectively minimize noise and enhance the processing of power readings.

Conclusion Conclusion

The contribution of modern buildings to the electric grid's load is substantial. In order to improve energy efficiency and effectively participate in programs that manage demand, consumers require immediate access to information regarding their energy consumption, ideally at the level of individual appliances. There has been a recent increase in interest regarding appliance-level energy monitoring, which allows consumers to view detailed information about their energy consumption. The NILM method employs machine learning techniques and single-point sensing to disaggregate energy data and estimate energy consumption for specific appliances. This provides consumers with a cost-effective solution for appliance-level energy monitoring.

In this thesis, we first proposed a novel approach to detecting anomalies in power consumption data. This approach utilizes three unsupervised machine learning techniques: isolation forest, one-class SVM, and K-Means. The focus of this method is on detecting anomalies in residential building energy consumption, specifically in identifying faulty equipment or unusual consumption behavior. It is important to analyze and identify the source of abnormal consumption to determine if it is caused by equipment failure or human factors. While this document does not discuss it, the same anomaly detection methods can be used to detect anomalous consumption behavior. However, the complexity of the problem is compounded by the need to model consumption behavior over time, which makes device-supervised approaches impractical since they require retraining for each change in device, occupancy, and climate.

Our next step involved the introduction of a technique for identifying occurrences that uses Tukey's Fences numerical outliers' detection method, utilizing the ongoing signal. Our method is not supervised, and it does not require any training stage, which makes it simple to incorporate directly. We put our approach to the test using the BLUED dataset and recorded satisfactory outcomes over various metrics such as TP, FN, FP, Precision, and Recall. Astonishingly, our method, which is not supervised, outperforms supervised learning techniques like Cepstrum analysis and χ 2 GOF statistic in F-measure terms. Once events are detected, specific representative signatures are selected, which not only boosts the precision of NILM's identification but also generates more realistic load data.

thirdly, we developed a new method for identifying fluctuations in power consumption. This technique involves transforming the power signal and using a soft assignment approach during the clustering phase, eliminating the need for labeled data and ensuring the privacy of residents. We tested this system using data from several UK-based smart meters installed in standard households. The results demonstrate that our method can accurately identify when appliances are being used, even in complex scenarios when multiple appliances are running at the same time. Additionally, our deep-embedded clustering approach resolves issues that traditional clustering methods struggle with when categorizing events. this thesis has made significant contributions to the field of appliance-level energy monitoring and anomaly detection in power consumption data. The proposed approaches have demonstrated their effectiveness in identifying anomalies, occurrences, and fluctuations in residential building energy consumption. By utilizing unsupervised machine learning techniques, such as isolation forest, one-class SVM, K-Means, and Tukey's Fences, the methods presented in this thesis offer cost-effective and practical solutions for consumers to gain insights into their energy usage at the level of individual appliances.

The outcomes of the experiments conducted on various datasets, including the BLUED dataset and UK-based smart meters, have shown promising results in terms of performance metrics such as precision, recall, and F-measure. The superiority of the unsupervised approaches over traditional supervised techniques highlights their potential in real-world applications, where adaptability to changes in devices, occupancy, and climate is crucial.

The implications of this research extend beyond energy monitoring alone. By accurately detecting anomalies and identifying the source of abnormal consumption, these methods can contribute to improving overall energy efficiency, reducing energy waste, and pinpointing faulty equipment that may need maintenance or replacement. Furthermore, the privacy-preserving nature of the proposed approaches ensures that the residents' personal information remains secure while benefiting from appliance-level insights.

As future work, further exploration can be done to enhance the techniques' performance by incorporating additional features or exploring alternative machine learning algorithms. Additionally, integrating these methods into smart home systems or energy management platforms can provide consumers with real-time feedback and actionable insights, empowering them to make informed decisions about their energy consumption.

In conclusion, the research presented in this thesis has laid a solid foundation for advancing the field of appliance-level energy monitoring and anomaly detection. The novel approaches proposed here contribute to a more sustainable and efficient energy ecosystem, allowing consumers to actively participate in demand management programs and make meaningful changes in their energy consumption behavior.

1. 1

 1 Soft sensing illustration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Soft sensor development methodology [1] . . . . . . . . . . . . . . . . . . . 1.3 External factors that impact energy management systems . . . . . . . . . . 1.4 Smart grid domains [2] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 Objectives of demand-side management [3] . . . . . . . . . . . . . . . . . . 1.6 Domains of home energy monitoring systems [4] . . . . . . . . . . . . . . . 1.7 Power demand forecasting method [5] . . . . . . . . . . . . . . . . . . . . . 1.8 Net Energy consumption by sector in Paraguay [6] . . . . . . . . . . . . . . 1.9 Daily pattern of a typical consumption vs anomalous consumption . . . . . 1.10 NILM Illustration [7] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.11 NILM model illustration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.12 NILM Architecture illustration . . . . . . . . . . . . . . . . . . . . . . . . . 1.13 Event detection in a real household [8] . . . . . . . . . . . . . . . . . . . . 1.14 The confusion matrix (Event detector vs load identifier) . . . . . . . . . . . 1.15 The relationship between artificial intelligence, machine learning and deep learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.16 Isolation Forest illustration [9] . . . . . . . . . . . . . . . . . . . . . . . . . 1.17 One-Class SVM illustration [10] . . . . . . . . . . . . . . . . . . . . . . . .

2. 1

 1 Anomaly detection taxonomy . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Anomalous energy detection taxonomy . . . . . . . . . . . . . . . . . . . . 2.3 Anomaly detection using machine learning taxonomy . . . . . . . . . . . . 2.4 Predicted values vs actual values [13] . . . . . . . . . . . . . . . . . . . . . 2.5 Daily pattern of a typical household and anomaly consumption [14] . . . . 2.6 Anomaly detection using machine learning taxonomy . . . . . . . . . . . . 2.7 Event-based NILM scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8 NILM architecture illustration . . . . . . . . . . . . . . . . . . . . . . . . . 2.9 Load identification Literature Tree . . . . . . . . . . . . . . . . . . . . . . 3.1 General workflow of anomaly detection online electricity consumption data 3.2 Furnace (House A) vs Furnace (House B) . . . . . . . . . . . . . . . . . . 3.3 Furnace 2014 vs. Furnace 2015, House A . . . . . . . . . . . . . . . . . . . 3.4 An illustration of a sliding window . . . . . . . . . . . . . . . . . . . . . . 3.5 Anomaly evaluation model architecture . . . . . . . . . . . . . . . . . . . . 3.6 Results of detection methods . . . . . . . . . . . . . . . . . . . . . . . . . .

  .1.

Figure 1 . 1 :

 11 Figure 1.1: Soft sensing illustration

Figure 1 . 4 :

 14 Figure 1.4: Smart grid domains [2]

2 .

 2 Load management methods: Load management techniques are the activities carried out to adapt and manage the load rather than the supply of energy on a network in order to achieve a balance between the supply of electricity and the electrical load. The cost of electricity and load patterns are closely linked. Variations in load patterns can reduce electricity costs, which is one of the main objectives of DSM. Variations in load patterns are differentiated into six types, as shown in 1.5.

Figure 1 . 5 :

 15 Figure1.5: Objectives of demand-side management[START_REF] Ain | User Comfort Enhancement in Home Energy Management Systems using Fuzzy Logic[END_REF]

Figure 1 . 6 :

 16 Figure 1.6: Domains of home energy monitoring systems[4]

Figure 1 . 7 :

 17 Figure 1.7: Power demand forecasting method[5]

Figure 1 . 8 :

 18 Figure 1.8: Net Energy consumption by sector in Paraguay [6]

Figure 1 . 9 :

 19 Figure 1.9: Daily pattern of a typical consumption vs anomalous consumption

Figure 1 .Figure 1 . 11 :

 1111 Figure 1.10: NILM Illustration [7]

1. 5 .

 5 Energy consumption profiling identify the load devices.

Figure 1 . 13 :

 113 Figure1.13: Event detection in a real household[START_REF] Athanasiadis | A scalable real-time non-intrusive load monitoring system for the estimation of household appliance power consumption[END_REF]

1. 5 .

 5 Figure 1.14: The confusion matrix (Event detector vs load identifier)

Figure 1 .

 1 Figure 1.15: The relationship between artificial intelligence, machine learning and deep learning

Figure 1 .

 1 Figure 1.16: Isolation Forest illustration [9]

Figure 1 . 19 :

 119 Figure 1.19: The structure of deep embedded clustering (DEC)[START_REF] Kaddour | Toward unsupervised nonintrusive load monitoring using convolutional deep embedded clustering[END_REF]

Figure 2 . 1 :

 21 Figure 2.1: Anomaly detection taxonomy

Figure 2 . 3 :

 23 Figure 2.3: Anomaly detection using machine learning taxonomy

Figure 2 . 4 :

 24 Figure 2.4: Predicted values vs actual values[START_REF] Munir | FuseAD: Unsupervised Anomaly Detection in Streaming Sensors Data by Fusing Statistical and Deep Learning Models[END_REF]

Figure 2 . 5 :

 25 Figure 2.5: Daily pattern of a typical household and anomaly consumption[START_REF] Kaddour | Event detection for non-intrusive load monitoring using tukey's fences[END_REF]

Figure 2 . 6 :

 26 Figure 2.6: Anomaly detection using machine learning taxonomy

Figure 2 . 7 :

 27 Figure 2.7: Event-based NILM scheme

Figure 2 . 8 :

 28 Figure 2.8: NILM architecture illustration

Chapter 2 .

 2 State of Art: Public Datasets and Energy Monitoring Techniques

Chapter 2 .

 2 State of Art: Public Datasets and Energy Monitoring Techniques Load Identification (LI)

Figure 3 . 1 :

 31 Figure 3.1: General workflow of anomaly detection online electricity consumption data

Figure 3 . 2 :Figure 3 . 3 :

 3233 Figure 3.2: Furnace (House A) vs Furnace (House B)

Figure 3 . 4 :

 34 Figure 3.4: An illustration of a sliding window

Figure 3 .

 3 Figure 3.5 illustrates the architecture to enable anomaly detection using three techniques (OC-SVM, iForest, and K-Means). After multiple tests with different appliances from the SMART* dataset, such as those in house A (oven, dishwasher, hotplate, refrigerator, and microwave).As shown in Figure3.6, Isolation Forest and One-Level SVM show some promising results, compared to K-Means, which is always on. In the oven test, we can observe the similarity between outliers detected by Isolation Forest and One-Class SVM. In contrast,

3. 3 .

 3 Figure 3.5: Anomaly evaluation model architecture

Figure 3 . 6 :

 36 Figure 3.6: Results of detection methods

Figure 4 . 2 :

 42 Figure 4.2: Event-based NILM

Figure 4 . 3 :

 43 Figure 4.3: Tukey's fences-based event detection

Figure 4 . 4 :

 44 Figure 4.4: Illustration of a current signal window decomposition

Figure 4 . 5 :

 45 Figure 4.5: An illustration of discriminatif selection

Figure 4 . 6 :

 46 Figure 4.6: Principle underpinning Tukey's Fences[START_REF] Jones | Probability, Statistics and Other Frightening Stuff, ch. Tails of the unexpected (2): Outing the outliers[END_REF]

4. 6

 6 . Conclusion • P recision = T P T P +F P • Recall = T P T P +F N • F -measure = 2×P recision×Recall P recision+Recall

5. 2 .Figure 5 . 1 :

 251 Figure 5.1: DEC-NILM model illustration

Chapter 5 .

 5 Deep Clustering Based Non Intrusive Load Monitoring• m ranges over all possible one-to-one mappings between clusters and labels.

Figure 5 . 3 :

 53 Figure 5.3: Illustration of building 3 appliances power usage during 2013

Figure

  Figure5.3 shows the total energy consumption, maximum power, and average power consumption for four different appliances: a kettle, an electric space heater, a laptop computer, and a projector. The kettle consumes the least amount of energy overall, with a total energy consumption of 3800 kWatts. However, it has the highest maximum power consumption, at 4000 Watts, which is expected as it is designed to quickly boil water. The average power consumption of the kettle is 5.5 Watts, which is relatively low since it is typically used for short periods of time. The electric space heater, on the other

  group of algorithms inspired by the structure and function of the brain that can be used for both classification and regression problems. Neural networks consist of layers of interconnected nodes, and the weights between the nodes are learned during the training process. Examples include Multilayer Perceptrons (MLPs).

1.7. Machine learning • Artificial Neural Networks (ANN): a

Table 2 .

 2 1: Summary of publicly available residential energy datasets with high sampling rate.

	Dataset	Country	Sampling rate (Hz)	Duration	HEAs Events
	BLUED [57]	USA	12 kHz (power)	N/A	50	2335 + 2482
	REDD [58]	USA	0.5-1 (building) / 15 kHz (power)	3-19 days	20	N/A
	EMBED [59]	USA	1-2 kHz (power)	14-27 days	N/A	N/A
	PLAID [60]	USA	30 kHz	2013-2014	11	N/A
	ADRES [61]	Austria	1 Hz	2 weeks	N/A	N/A
	UK-DALE [17]	UK	1/6 Hz (building) / 16 kHz (power) N/A	N/A	N/A
	DRED [62]	Netherlands 1 Hz	6 months	N/A	N/A
	ECODS [63]	Europe	1 Hz	8 months	4	N/A
	ENERTALK [64] South Korea 15 Hz	29-122 days N/A	N/A

Table 2 .

 2 dataset provided by Department for Environment Food and Rural Affairs (Defra), the Department of Energy and Climate Change (DECC), and the Energy Saving Trust. It contains electricity consumption of 26 homes during one year and 225 homes during one month, across England. Appliances consumption data are also included. each hose holds owned 41 appliances on average. 2: Summary of publicly available residential energy datasets with low sampling rate.

	9. the ECO [63] Dataset contains smart meter data (at 1 Hz) from 6 households in
	Switzerland collected over a period of 8 months. It further contains plug data of
	6 to 10 plugs per household (also measured at 1 Hz) and information about the
	occupancy of people in the house (indicated through a tablet PC that was located
	next to the entrance door).
	Dataset	Country Granularity	Duration	Measurement	No. of	Access
					Type	Houses Level
	AMPds [68]	Canada	Minute	2 years	Electricity, Water, Gas	1	Public
	Smart* [65]	USA	Minute	2 years	Electricity, Weather, HEMS 400+	Public
	Pecan Street [66] USA	(1-900) Second Up to 1 year Electricity	25	Restricted
	REFIT [67]	UK	8 seconds	2 years	Electricity	20	Public
	HES [72]	UK	1 second	1 year	Electricity, Solar PV	5	Public
	ECO [63]	Ireland	Minute	1 year	Electricity	20	Public
	NIOM [65]	USA	Minute	3 weeks	Electricity, Occupancy	1	Public
	CoSSMic [70]	Germany Minute	3 years	Electricity	11	Public
	SustData [71]	Portugal	2-10 Hz	1144 days	Electricity, Eco-feedback	50	Public

dataset provides measurements for 50 residential units in Portugal over 1144 days. The dataset has a sampling rate between 2 and 10 Hz and includes sub-metered demand data, eco-feedback information from building occupants, and aggregate energy demand.

2.3. Anomalous energy consumption detection in residential buildings

8. The HES

[START_REF] Zimmermann | Household Electricity Survey: A study of domestic electrical product usage[END_REF]

Table 2 .

 2 is the power reading of appliance i at time t, N is the number of appliances, and e(t) is the variable representing contribution from appliances that are accounted for and Chapter 2. State of Art: Public Datasets and Energy Monitoring Techniques 3: Summary of event detection methods characteristics

	Approach	Sampling Frequency Unsupervised Dataset	Data Nature
	TFED [14]	High(6khz)	✓	BLUED	CURRENT
	GOF [96]	Low(3s)	✓	REDD	ACTIVE POWER
	KFDA [89]	High(12khz)	✓	BLUED	CURRENT
	KNN [100]	Low(0.13)	✗	PRIVATE	ACTIVE POWER
	HAND [94, 95]	High(12khz)	✓	MODELED SIGNAL CURRENT
	χ 2 GOF [103]	Low(60hz)	✓	BLUED	ACTIVE POWER
	CUSUM [99]	High(10Khz)	✓	PRIVATE	ACTIVE POWER
	GLR+LLD-MAX+AWB [93] Low(20hz)	✓	BLUED	ACTIVE POWER
	WAMMA [101]	Low(20-50hz)	✓	LIFTED, BLUED	ACTIVE POWER
	GLR [104]	Low(25hz)	✓	ASHRAE	ACTIVE POWER

measurement noise. typically, the noise variable follows a Gaussian with a mean of 0 and a variance of σt, i.e., e(t) ∼ N (0, σ 2 (t)).. 2.1

Table 3 .

 3

	1: Initial parameters
	Method	Parameter Value
	Isolation Forest Contamination	0.1
	One-Class SVM nu	0.1
	K-Mean	Outlier Fraction 0.1

Table 3 .

 3 2: Number of anomalies

	Appliance	Number of anomalies
		Isolation Forest One-Class SVM K-Means
	FurnaceHRV	176	132	262
	ElectricRange	176	114

Table 4 .

 4 1: Environment parameters

	Parameter	Value
	Moving window size 6016 Samples
	Step size	128 Samples
	K	0.5

Table 4 .

 4

			2: Experimental results
	R	TP FN FP Precision Recall	F-measure
	901 859 12 5	99,44%	98,67% 99%

Table 4 .

 4

	3: Comparison with other supervised approaches
	Algorithm used F-measure
	TFEV	99%
	Cepstrum analysis [102]	98%
	χ 2 GOF statistic [102]	98%

Table 5 .

 5 3: Results for the DEC-NILM event classification solution on house 3 in the UK-DALE dataset

	Appliance	True Events TP TN FP FN Precision Recall f1-score
	Kettle	97	90	155	30	7	0.75	0.93	0.83
	Electric space heater	67	50	195	23	17	0.68	0.75	0.71
	Laptop computer	31	20	225	5	11	0.80	0.65	0.71
	Projector	95	85	160	27	10	0.76	0.89	0.82
				AVERAGE:	0.75	0.80	0.77

Acknowledgements

First and foremost, I would like to thank ALLAH ALMIGHTY for giving me the strength, courage, willpower and patience to complete this thesis.

I would like to express my deepest gratitude to my thesis supervisor, Mr LEHSAINI Mohamed, for his scientific spirit, his pedagogy, his availability, his patience, his advice and his ideas which enabled me to complete this thesis.

Many thanks to my co-director Mr BOUCHACHIA Abdelhamid, Professor at Bournemouth University, for his support and help during during my stay at Bournemouth University.

My most sincere thanks go to Mr BENAMAMMAR Badr for doing me the honour of taking an interest in this work and for chairing the jury. I would also like to express my deepest gratitude to Mr BENDAOUD Fayssal, Mr MALIKI Fouad and Mrs AMRAOUI Asma who honoured me by agreeing to be the examiners of this thesis.

Chapter 3. Anomaly detection method for online electricity consumption method first randomly selects the first set of centroids as the first point of each cluster and then tries to iteratively optimize the centroid locations. The stopping criterion of the algorithm can be met by a stagnation of the solution, where the same centroid value occurs in each iteration, or because a defined number of iterations has been reached. After the training step, we assign each instance X i to its cluster using the model created by K-Means. Each cluster is defined in the model by its centroid. Furthermore, before starting K-means clustering, we use Elbow's method [START_REF] Tibshirani | Estimating the number of clusters in a data set via the gap statistic[END_REF] to determine the optimal number of clusters, i.e. K = 10, to define data points as outliers:

Cepstrum analysis

In 1963, Bogert et al. [START_REF] Bogert | The quefrency analysis of time series for echoes : cepstrum, pseudoautocovariance, cross-cepstrum and saphe cracking[END_REF] pioneered Cepstrum analysis, which involves analyzing the power spectrum of the logarithm of a signal's power spectrum. Originally developed to study seismic signals and their echoes following earthquakes, this technique has since become a versatile tool in many fields. For example, it has found use in passive sonars [START_REF] Kiran | Application of cepstrum in passive sonar[END_REF], fish detection, and speech recognition [START_REF] Pearce | The aurora experimental framework for the performance evaluation of speech recognition systems under noisy conditions[END_REF]. By reducing multipath effects and interference noise, Cepstrum analysis can improve the performance of various algorithms. In particular, Cepstrum coefficients have proven effective in increasing the robustness of speech recognition applications [START_REF] Joshi | Matlab based feature extraction using mel frequency cepstrum coefficients for automatic speech recognition[END_REF]. Recently, Cepstrum coefficients have even been used as discriminative features for appliance recognition in a NILM setting [START_REF] Kong | Home appliance load disaggregation using cepstrum-smoothing-based method[END_REF].

Related Work

About three decades ago, Hart [START_REF] Hart | Nonintrusive appliance load monitoring[END_REF] proposed a method for decomposing electrical loads by examining only the presence of device-specific step-wise changes in the total power consumption. Furthermore, several event detection techniques have been proposed. These techniques can be categorized based on the type of learning, sampling frequency and the data nature. In [START_REF] Luo | Monitoring HVAC equipment electrical loads from a centralized location -Methods and field test results[END_REF], researchers proposed the use of the Generalized Likelihood Ratio (GLR) method to compute a decision statistic based on the natural logarithm of the probability distribution ratio before and after a possible change in the mean. Their method requires offline training of four parameters, including the length of the moving window, the variance of the performance data, and the detection statistic threshold. This approach was adopted and enhanced by many works. In [START_REF] Lu | A Hybrid Event Detection Approach for Non-Intrusive Load Monitoring[END_REF], researchers proposed a hybrid solution that includes an algorithm based on moving average variation with a time limit and two auxiliary algorithms based on derivative analysis and filtering analysis to detect false events, using features of active power with a low sampling rate with fixed parameters. The strategy used in this approach may affect the accuracy of detecting increased time events with fast transition states. Using the BLUED dataset [START_REF] Anderson | BLUED: a fully labeled public dataset for Event-Based Non-Intrusive load monitoring research[END_REF], the authors in [START_REF] Wild | A new unsupervised event detector for nonintrusive load monitoring[END_REF] presented an unsupervised solution based on a sliding-window "Kernel

Discriminative Filtering

The purpose of this stage is to identify the frequency that exhibits the most conspicuous change point between the initial and latter halves of the window.

Once F is acquired, the ∆P distance is calculated for every frequency column by computing the difference between the left-side frequency values' mean (µ L ) and the rightside frequency values' mean (µ R ), as defined in equation (4.4).

µ is the arithmetic mean while N is the size of the given set and X i are the set values.

Deep Clustering Based Non Intrusive Load Monitoring

Chapter 5

Deep Clustering Based Non Intrusive Load Monitoring

Introduction

The rising demand for energy consumption in the residential sector has led to the emergence of various technologies such as smart grids, home energy monitoring systems and "NILM". NILM techniques equally referred to as load disaggregation, are the methods of estimating power demand of each appliance using aggregated power readings recorded by a single electric meter monitoring. Although the NILM problem was introduced by Hart [START_REF] Hart | Nonintrusive appliance load monitoring[END_REF] nearly three decades ago, it is not fully solved, with traditional solutions relying on manual device signatures encountering bottlenecks [START_REF] Beckel | The ECO Data Set and the Performance of Non-Intrusive Load Monitoring Algorithms[END_REF].

Recently, many research works have shown that methods based on "Deep Neural Network (DNN)" can significantly improve the performance of NILM various deep learning schemes have been proposed for NILM, such as denoising auto-encoders [START_REF] Kelly | Neural NILM: Deep Neural Networks Applied to Energy Disaggregation[END_REF], recurrent neural networks [START_REF] Bejarano | Deep Latent Generative Models for Energy Disaggregation[END_REF], and GANs [START_REF] Ahmed | Generative Adversarial Networks and Transfer Learning for Non-Intrusive Load Monitoring in Smart Grids[END_REF], the Seq2Point model [START_REF] Zhang | Sequence-to-Point Learning with Neural Networks for Non-Intrusive Load Monitoring[END_REF] has shown good results which is the current state-of-the-art model for energy disaggregation. Deep learning-based approaches have shown good results and potential. However, in reality, training models remotely for each household poses major challenges, including the availability of training data, where the ground truth active power data for each appliance is expensive to obtain, latency and the large amount of data transmission, as well as residents' energy consumption data privacy. The focus on data security and user privacy has become a global issue in recent years, where Appropriate regulations have been implemented to protect data security and protection in the EU , USA [START_REF] Team | EU General Data Protection Regulation (GDPR), third edition: An Implementation and Compliance Guide[END_REF], and China [START_REF] Inkster | China's cyber power[END_REF], solutions such as unsupervised, semi-supervised, federated, and transfer learning have been founded to overcome such situations. To address such problems, two mandatory framework tools for conducting deep learning-based experiments are an efficient data loader that handles all preliminary steps efficiently, and a computational framework for fast model development. NILMTK [START_REF] Batra | NILMTK: An open source toolkit for non-intrusive load monitoring[END_REF] is the best-known and most efficient toolkit for loading and using publicly available NILM datasets. The tool is based on Python [START_REF] Van Rossum | Python reference manual[END_REF] and well-known data science libraries [START_REF] Mckinney | Data Structures for Statistical Computing in Python[END_REF][START_REF] Harris | Array programming with NumPy[END_REF]. Most NILM research works used NILMTK combined with machine learning libraries such as sci-kit learn [START_REF] Pedregosa | Scikit-learn: Machine learning in Python[END_REF], Tensorflow [START_REF] Abadi | TensorFlow: Large-scale machine learning on heterogeneous systems[END_REF], Keras [START_REF] Chollet | Keras[END_REF] where:

• x: Original value,

• µ: Mean of data,

• σ: Standard deviation of data,

• Z :is the standardised value. According to the sequence-to-point learning network architecture, a fixed-length event window of the active power consumption signal is taken as input and a single point is 5.3. Experimental Setup

Training and inference

UK-DALE Dataset

Several open-source datasets are available for this purpose of energy disaggregation. These data were collected from residential buildings in different countries. UK-DALE [START_REF] Kelly | The UK-DALE dataset, domestic appliance-level electricity demand and whole-house demand from five UK homes[END_REF] is an open-access dataset from the United Kingdom that records power readings at the appliance level, sampled at 16 kHz for the whole house and 1/6 Hz for individual appliances. This dataset includes aggregated 16 kHz current and voltage readings and 6-second submeter performance data for individual appliances from 3 UK households, and 1-second aggregate and 6-second sub-meter performance data for 2 other households. An update to this dataset was released in August 2015, extending the available data for homes between 1 and 2.5 years old. An updated dataset is used for this experiment.

Settings for training neural networks

In the literature, we find diverse developed toolkits to facilitate the implementation of new NILM solutions. In our work we used Deep-NILM toolkit [START_REF] Hafsa | Deep-nilmtk[END_REF] which is an open-source package specially designed for deep models to solve NILM. It implements a generic NILM pipeline independent of deep learning backends. In the current version, the toolkit considers two of the most popular deep learning pipelines (seq2point,seq2seq). The training and testing phases are fully compatible with NILMtk. We implemented the DEC solution from [START_REF] Guo | Dec-keras[END_REF] which is a Keras implementation for Deep Embedding Clustering. The experimental parameters used are listed in Table 5.2.

Table 5.2: Hyper-parameters for training

Input window size (samples) 121

Number of maximum epochs 50

Batch size 1000

Minimum early-stopping epochs 5

Patience of early-stopping (in epochs) 5

Evaluation Metrics

We use the same metrics used in the DEC paper, standard unsupervised evaluation metrics and protocols for evaluations and comparing with other algorithms [START_REF] Yang | Image clustering using local discriminant models and global integration[END_REF]. For all algorithms, we set the number of clusters to the number of true classes and evaluate performance using unsupervised "Clustering ACcuracy (ACC)" as expressed in equation (5.7).

where :

• l i is the ground-truth label,

• c i is the cluster assignment, and

Résumé

Ces dernières années, il y a eu un intérêt croissant pour les techniques de capteur logiciel pour la surveillance des systèmes complexes dans les milieux académiques et industriels. On notera en particulier l'analyse de la consommation résidentielle d'électricité, qui a retenu l'attention de plusieurs chercheurs. Néanmoins, l'application des techniques de surveillance de charge non intrusive (NILM) aux bâtiments résidentiels est compliquée par les caractéristiques uniques des données collectées sur ces sites. De plus, les ensembles de données accessibles au public pour les études NILM des structures résidentielles sont rares et font partie de la vie privée des occupants de ces structures. Dans le cadre de cette thèse, nous avons abordé ces problèmes en proposant trois solutions : une nouvelle approche d'apprentissage automatique non supervisée pour détecter la consommation d'énergie anormale dans les habitats, un algorithme de détection d'événements qui implique la clôture de Tukey et une solution NILM basée sur l'approche de regroupement profond intégré (DEC).

Mots clés: capteur logiciel,systéme complex, NILM, bâtiments résidentiels, DEC, les ensembles de données accessibles au public, consommation d'énergie anormale, détection d'événements .

Abstract

Recently, there has been growing interest in soft sensing techniques for monitoring complex systems in both academic and industrial sectors. Of particular note is the analysis of residential electricity consumption, which has attracted the attention of several researchers. However, the application of non-intrusive load monitoring (NILM) techniques to residential buildings is complicated by the unique characteristics of the data collected at these sites. In addition, publicly available datasets for NILM studies of residential structures are scarce and part of the privacy of the occupants of these structures. In this thesis, we addressed these problems by proposing three solutions: a novel unsupervised machine learning approach to detect abnormal energy consumption in homes, an event detection algorithm that involves the Tukey closure, and a NILM solution based on the integrated deep clustering (DEC) approach.

Key Words :soft sensing, complex systems, NILM, Residential buildings, DEC, Publicly available datasets, Anomalous energy usage, Event detection.