A Hybrid Adaptive Rule based System for Smart Home Energy Prediction Jithish J and Sriram Sankaran Amrita Center for Cybersecurity Systems & Networks Amrita School of Engineering, Amritapuri Amrita Vishwa Vidyapeetham Amrita University India jithishj@gmail.com ABSTRACT costs along with the reduction in greenhouse gas emissions The increase in energy prices combined with the environ- [23]. In cities, buildings account for a significant share of mental impact of energy production has made energy effi- the total energy consumption [17], emphasizing the need for ciency a key component towards the development of smart smarter building energy management policies. homes. An efficient energy management strategy for smart homes results in minimized electricity consumption leading The growing human needs for comfort, convenience and to cost savings. Towards this goal, we investigate the im- reliability are expected to shift traditional building designs pact of environmental factors on home energy consumption. towards the development of smart dwelling environments re- Home energy demand is observed to be affected by environ- ferred commonly as ‘smart homes’. The smart home of the mental factors such as temperature, wind speed and humid- future is expected to minimize energy consumption by in- ity which are inherently uncertain. Analyzing the impact of telligent control of heating, lighting, air-conditioning and these factors on electricity consumption is challenging due household appliances [1]. Smart homes are projected to in- to the unpredictability of weather conditions and non-linear tegrate sustainable and energy conscious policies in addition relationship between environmental factors and electricity to traditional design concepts such as comfort, safety and demand. For demand estimation based on these time vary- cost-effectiveness [7]. ing factors, a hybrid intelligent system is developed that integrates the adaptability of neural networks and reason- The problem of demand prediction as a function of en- ing of fuzzy systems to predict daily electricity demand. A vironmental factors is challenging due to the transitional na- smart home dataset is utilized to build an unsupervised ar- ture of environmental parameters like temperature, humid- tificial neural network known as the Self-Organizing Map ity and wind speed. The relationship between constituent (SOM). We further develop a fuzzy rule based system from variables in this problem are not fully understood and there- the SOM to predict home energy demand. Evaluation of fore cannot be described by a precise mathematical model. the system shows a strong correlation between home energy Traditional statistical modeling approaches are generally not demand and environmental factors and that the system pre- suited for such problems involving varying environmental dicts home energy consumption with higher accuracy. conditions. Keywords The biologically inspired computational paradigm of ar- Artificial Neural Network , Fuzzy Logic, Adaptability, Ar- tificial neural network (ANN) has various advantages over tifical Intelligence, Self-Organizing Map, Machine Learning, traditional methods for solving problems involving time vary- Demand Prediction. ing conditions [9]. ANNs are attractive due their properties such as the ability to model nonlinear phenomena, toler- ance to noisy or incomplete data, robustness to deal with 1. INTRODUCTION dynamic real world situations and adaptability to changing The rise in energy demand proportional to increased urban- conditions. The fundamental characteristic of an ANN is its ization has emphasized the need for comprehensive measures ability to learn and behave based on the states of its inputs. to promote sustainability and improve energy efficiency. In- An ANN trained to operate in a specific surrounding can corporating the principles of sustainability and energy effi- be retrained based on changing environmental states. ANN ciency in building design is expected to cut down operational adapts to the changes in the environment by adjusting the synaptic weights of the constituent neurons. Fuzzy logic [14] is a soft computing approach that im- itates human reasoning to arrive at solutions for computa- tionally hard problems. This technique has been used to solve problems in diverse domains such as automatic con- Copyright c 2017 for the individual papers by the papers’ authors. Copy- trol, modeling, forecasting and classification. Fuzzy systems ing permitted for private and academic purposes. This volume is published and copyrighted by its editors. are limited in the aspect that they cannot adapt to situ- ations where the input conditions change. ANNs appear the models developed for such problems are not adaptable to be an appealing technique to facilitate adaptability to to changing operating conditions. This has led to growing fuzzy systems. While fuzzy systems approximate human interest in ANN based techniques for demand estimation. reasoning based on the inputs, ANNs can be used to pro- ANN-based methods do not require the exact model of the vide features such as error tolerance and adaptation. The relevant physical process as neural networks are able to learn confluence of the two methodologies can be used to develop and model the non-linear relationship between demand and hybrid adaptive intelligent systems capable of solving real environmental factors based on historical samples. Various world problems more efficiently. neural network techniques have been used to incorporate the non-linearity between underlying factors in demand estima- In this work, we utilize a smart home data set to analyze tion. the impact of environmental factors on home energy con- sumption for developing efficient energy management poli- H.S. Hippert et al. [11] examined a list of works that cies for smart homes. Home energy demand is observed to use ANNs for short-term load forecasting. S.V. Verdu et al. be significantly affected by environmental factors. Under- [21] classified the customers of an electrical utility in a given standing energy consumption patterns is vital for resource geographical area using self-organizing maps. Based on their optimization. We use a class of artificial neural networks approach, they identified customers by the behavior patterns (ANN) called the Self-Organizing Maps (SOM) [15] to an- in their electricity usage. O. A. Carpinteiro et al. [3] suc- alyze the energy consumption patterns and their relation- cessfully applied a neural network architecture composed of ship with environmental factors. The input space of SOM two self-organizing maps to solve the problem short-term consists of a set of environmental factors (temperature, hu- load forecasting. M. Sperandio et al. [20] developed Markov midity and wind speed) along with the home electricity de- models for short term load forecasting using self-organizing mand. The SOM implements an orderly transformation of maps. M. Farhadi et al. [6] utilized a combination of ANN the multidimensional input space to a lower dimensional grid and fuzzy system for daily load forecasting. so that it can be visualized to detect energy consumption patterns. The SOM is then utilized to extract relationships Traditionally, SOM based approaches for electricity de- between electricity use and environmental factors. Further, mand forecasting, customer classification and load profiling we develop a adaptable rule-based demand estimation sys- were developed for applications corresponding to larger ge- tem from the SOM using fuzzy logic to predict the daily ographic regions such as cities or countries [19]. Our ap- home electricity demand. In our proposed model, the neu- proach differs from the existing works in that we utilize our ral network architecture supports the fuzzy system by inte- hybrid approach involving fuzzy logic and SOM for the de- grating learning capabilities and adaptability features to the velopment of efficient energy management policies for smart electricity demand estimation system. homes. This paper proposes a hybrid technique based on Self-Organizing Maps combining the potential of fuzzy logic 2. RELATED WORK and neural networks. We develop a rule based system from SOM and analyze the dependence of external factors on en- Various approaches have been proposed in the past for solv- ergy consumption. The proposed system estimates the daily ing the problem of demand estimation, the majority of which electricity demand taking into account the impact of envi- belong to the class of time-series analysis. The time-series ronment variables on home energy usage. The SOM devel- analysis techniques predominantly consist of approaches based oped in our method projects hidden structures in the mul- on statistical modeling[18] and artificial neural networks (ANN). tidimensional input data set on a 2-D map which is utilized Statistical modeling techniques [8] include exponential smooth- for data analysis. We leverage SOM to reveal the extent of ing, linear regression analysis, autoregressive methods like the impact of environmental factors on daily home energy ARMA and ARIMA models, chaos time series models and demand. Kalman filtering-based methods. N. A. A. Jalil et al. [13] used exponential smoothing 3. BACKGROUND techniques for load forecasting from time series data. They compared several such smoothing techniques to identify the 3.1 Self-Organizing Map most effective solution for demand estimation. J.Hinman et The self-organizing map is a machine learning technique al. [10] used regression analysis for short-term load estima- based on artificial neural networks (ANN). SOM uses unsu- tion for a electric utility. S.-J. Huang et al. [12] improved pervised learning to cluster higher dimensional data inputs on the existing ARMA model by incorporating non-gaussian to a 2-D map based on similarity while preserving the topo- processes to increase the accuracy of demand prediction. J. logical relations of the data. As illustrated in Figure 1, the Contreras et al. [4] successfully used ARIMA model to esti- SOM is composed of two layers, a 1-D input layer, and a 2-D mate future electricity prices of customers. Their approach output layer.Each input layer node is connected to neurons involved using time series analysis to arrive at accurate price in the output layer via ‘weights’ which is updated during the forecasts. H.Mori et al. [16] successfully demonstrated the training process. The weight update rule for a SOM unit mi validity of chaos times analysis for short-term load forecast- is computed as ing. M. Falvo et.al [5] estimated short term loads based on mi (t + 1) = mi (t) + hc (t)[x(t) − mi (t)] (1) a time series model using Kalman filtering techniques. where t= the current time step, x(t)= the input vector and Statistical methods may fall short of performance due to hc (t) is the neighbourhood function computed as the improper modeling of the non-linear factors like environ- 2 mental variables affecting the energy demand. In addition, hc (t) = l(t)e(−|rk −ri | ) (2) Figure 1: A SOM having two inputs and 16 neurons. where |rk − ri | = the distance between units i and k at the output layer and l(t) is the learning rate computed as l(t) = l0 e−t/λ (3) where l0 = initial value of learning rate, λ = the time con- stant. The two commonly used approaches for SOM represen- Figure 2: Model development Flowchart tation are the unified distance matrix (U-Matrix) and the component planes. The U-matrix representation describes the Euclidean distance between neurons to identify clus- ing to each input variable. With the SOM trained, we iden- ters. Component planes display the values of input variables tify clusters in the component plane corresponding to the (components) in each output SOM weight vector as separate electricity demand. To identify clusters effectively, we use maps, enabling them to be used for discovering dependencies a clustering evaluation algorithm along with K-means clus- in the input data. In this work,we use component planes for tering to cluster the ‘electricity demand’ component plane. SOM representation. Once the clusters are identified, the process of rule extrac- tion is initiated. We calculate the cluster averages for indi- vidual component planes based on clusters identified from 3.2 Fuzzy Logic the ‘electricity demand’ component plane. We define rela- Fuzzy logic is a multi-valued logical system that recognizes tionships between input variables by comparing the cluster all possible values between Boolean logic evaluations of TRUE averages and building fuzzy rules. The set of developed fuzzy (logic 1) or FALSE (logic 0). It models human-like reason- rules is used to construct the rule based system. ing in decision making by offering a computational frame- work for addressing imprecise linguistic notions such as ‘very small’, ‘small’, ‘large’ etc. A fuzzy rule is a conditional state- 4.1 Smart Home Data set ment of the form We utilize the data sets provided by the University of Mas- sachusetts, Amherst [2] for system development. The data is collected from two homes instrumented with sensors to IF x is P THEN y is Q record weather and electricity usage information. In our case, we use the data collected during the months of May, where x and y are linguistic variables; P and Q are lin- June and July. guistic values defined on a fuzzy set. Fuzzy rule-based sys- tems deal with imprecision or ambiguity in knowledge repre- 4.2 SOM Training sentation by defining fuzzy sets and fuzzy numbers expressed We use the SOM toolbox package [22] in MATLAB com- in linguistic terms (e.g. ‘small’, ‘very small’, ‘medium’ etc.). putational environment for developing the SOM. We train Fuzzy rule-based systems utilize a set of linguistic IF-THEN the SOM with hourly measurements of home energy demand constructions called fuzzy rules to model non-linear relation- (kWh) and environmental factors such as temperature (◦ C), ships between inputs. wind speed (m/s) and relative humidity (%) from a home recorded during the month of May. 4. MODEL DEVELOPMENT The flowchart of model development is described in Figure 4.3 SOM Analysis 2. Towards developing the rule-based system, we train the Figure 3 illustrates the SOM component planes for all the SOM with a prior measurements of input variables. The input variables. We use the batch training algorithm for training process generates 4 component planes correspond- SOM development. A SOM with 36 neurons in a 6 X 6 hexagonal arrangement was constructed. In the SOM, 720 hourly measurements of data for one month were projected onto the 6 X 6 grid. In Figure 3, the lighter shades in the component plane (blue, cyan, yellow) correspond to inputs of lesser magnitude compared to darker shades (red, orange). Figure 4: Clustered Energy component plane Figure 5: Cluster averages of component planes In this manner, using the SOM, we explore inherent re- lationships between energy demand and environmental fac- Figure 3: Component planes of input data. tors. For the purpose of rule extraction, we cluster the component plane corresponding to energy demand using K- means clustering algorithm. The optimal ‘K’ value for clus- It is observed that towards the lower left corner of the tering the energy component plane was calculated using the energy component plane, which corresponds to higher en- Davies-Bouldin (DB) clustering evaluation algorithm (opti- ergy demand there is high temperature, high humidity and mal K=4). The clustered energy component plane is given medium wind speed in the respective component planes near in Figure 4. For fuzzy rule development, we use individual the same region. Similarly, towards the top left corner, cluster averages for representing each cluster. Cluster av- where energy demands are lower, we observe low tempera- erage is calculated as the arithmetic mean of SOM cluster ture, medium humidity and low wind speed in the respective values. Cluster averages of component planes are expressed component planes near the same region. as bar graphs in Figure 5. 4.4 Rule Based System Development Table 1: Linguistic Variable Assignment To model and predict the energy demand, we map the 4 clusters described in ‘’electricity demand’ component plane Daily Relative Wind Tempe- (Figure 4) into the input component planes for temperature, Energy No. Humidity Speed rature Demand humidity and wind speed (Figure 3). Cluster averages of the (%) (m/s) (◦ C) component planes are calculated and expressed in the four (kWh) classes of linguistic terms ‘Highest’, ‘High’, ‘Low’, ‘Lowest’ 59.23 .1610 19.25 59.975 1 depending on the decreasing order of their values (Table 1). (Highest) (Low) (Highest) (Highest) We develop the rules to model and predict energy demand 54.27 .1475 18.22 38.466 2 by building relationships between cluster averages (Table 1) (Lowest) (Lowest) (High) (High) through fuzzy IF-THEN rules. The fuzzy rules are devel- 55.67 .1614 15.40 36.14 3 oped with the help of membership functions of the input (Low) (High) (Lowest) (Low) variables (Figure 6). We further use the extracted fuzzy 58.24 .1950 16.43 30.474 4 rules to construct a rule-based system for the prediction of (High) ( Highest) (Low) (Lowest) energy demand. The rule-based system is described in Table 2. Table 2: Rule Based System Rule Based System Rule 1:IF Humidity is near 59.23(Highest) AND Wind speed is near .161(Low) AND Temperature is near 19.25(Highest) THEN Energy demand is 59.975(Highest) Rule 2:IF Humidity is near 54.27(Lowest) AND Wind speed is near .1475 (Lowest) AND Temperature is near 18.22(High) THEN Energy demand is 38.466(High) Rule 3:IF Humidity is near 55.67(Low) AND Wind speed is near .1614(High) AND Temperature is near 15.40(Lowest) THEN Energy demand is 36.14( Low) Rule 4:IF Humidity is near 58.24(High) AND Wind speed is near .1950(Highest) AND Temperature is near 16.43(Low) THEN Energy demand is 30.474(Lowest) 4.5 System Validation For validating the developed system, we utilized a data set consisting of electricity demand and environmental variables of the home, recorded during the months of June and July. Based on the fuzzy rules developed from the SOM, the pro- posed system predicted the electricity demand classes with an accuracy of 78.68%. The results of validation are given in Table III. We further developed and evaluated the proposed system for a second home. For the second case, the trained SOM generated four clusters, which was used to develop the corresponding fuzzy rules. The fuzzy rules were similar ex- cept for the difference in numerical values for the linguistic variables. The rule based system for the second home esti- mated demand classes with an accuracy of 73.77%. Table 3: System Validation Home A Home B Days of data used for 61 Days 61 Days Figure 6: Membership functions of input variables System Validation Days of correct 48 Days 45 Days Predictions Accuracy 78.68 % 73.77 % 4.6 Applications [7] R. Harper. Inside the smart home. Springer Science & Systems for accurate electricity demand estimation are es- Business Media, 2006. sential for the operation of a smart home. Significant re- [8] A. C. Harvey. Forecasting, structural time series duction in home energy usage could be achieved with the models and the Kalman filter. Cambridge university knowledge of energy consumption patterns. Such knowl- press, 1990. edge could motivate consumers to promote activities leading [9] S. Haykin and N. Network. A comprehensive to cost savings and efficiency improvements. Smart homes foundation. Neural Networks, 2(2004), 2004. can utilize demand estimation systems to make better de- [10] J. Hinman and E. Hickey. Modeling and forecasting cisions regarding the purchase, generation, and storage of short-term electricity load using regression analysis. energy. The system could be utilized to estimate peak load Journal of IInstitute for Regulatory Policy Studies, conditions, reduce the occurrence of electrical overload or 2009. cut-down electricity costs by regulating home electricity con- [11] H. S. Hippert, C. E. Pedreira, and R. C. Souza. sumption under real-time electricity pricing (RTP) schemes. Neural networks for short-term load forecasting: A Under a RTP scheme, customers monitor prices and adjust review and evaluation. IEEE Transactions on power power consumption accordingly to reduce energy costs. systems, 16(1):44–55, 2001. [12] S.-J. Huang and K.-R. Shih. Short-term load 5. CONCLUSION forecasting via arma model identification including Towards the goal of energy efficient smart homes, we pre- non-gaussian process considerations. IEEE sented a hybrid approach combining fuzzy logic and SOM to Transactions on Power Systems, 18(2):673–679, 2003. develop a rule-based system for home energy demand pre- [13] N. A. A. Jalil, M. H. Ahmad, and N. Mohamed. diction. The SOM developed is a topology preserving trans- Electricity load demand forecasting using exponential formation from a 4 dimensional input space to 2 dimensions. smoothing methods. World Applied Sciences Journal, We used the SOM to analyze and develop a fuzzy rule based 22(11):1540–1543, 2013. system for daily energy demand estimation. The system es- [14] G. Klir and B. Yuan. Fuzzy sets and fuzzy logic, timated the daily energy consumption for two homes with volume 4. Prentice hall New Jersey, 1995. an accuracy of 78.68% and 73.77% respectively. The results [15] T. Kohonen. The self-organizing map. Proceedings of verified the effectiveness of the proposed approach in discov- the IEEE, 78(9):1464–1480, 1990. ering the impact of environmental factors on home energy [16] H. Mori and S. Urano. Short-term load forecasting demand. As part of future work, we propose to develop with chaos time series analysis. In Intelligent Systems policies to optimize home energy consumption by integrat- Applications to Power Systems, 1996. Proceedings, ing alternative energy sources. ISAP’96., International Conference on, pages 133–137. IEEE, 1996. 6. REFERENCES [17] L. Pérez-Lombard, J. Ortiz, and C. Pout. A review on [1] A. Anvari-Moghaddam, H. Monsef, and buildings energy consumption information. Energy and A. Rahimi-Kian. Optimal smart home energy buildings, 40(3):394–398, 2008. management considering energy saving and a [18] S. Sankaran. Predictive modeling based power comfortable lifestyle. IEEE Transactions on Smart estimation for embedded multicore systems. In Proceedings of the ACM International Conference on Grid, 6(1):324–332, 2015. Computing Frontiers, pages 370–375. ACM, 2016. [2] S. Barker, A. Mishra, D. Irwin, E. Cecchet, P. Shenoy, [19] A. Sivasena Reddy and M. Janga Reddy. Identification and J. Albrecht. Smart*: An open data set and tools of homogenous regions in rain-fed watershed using for enabling research in sustainable homes. SustKDD, kohonen neural networks. ISH Journal of Hydraulic August, 111:112, 2012. Engineering, 19(1):55–66, 2013. [3] O. A. Carpinteiro and A. P. A. Da Silva. A [20] M. Sperandio, D. P. Bernardon, and V. J. Garcia. hierarchical self-organizing map model in short-term Building forecasting markov models with load forecasting. Journal of Intelligent and Robotic self-organizing maps. In Universities Power Systems, 31(1-3):105–113, 2001. Engineering Conference (UPEC), 2010 45th [4] J. Contreras, R. Espinola, F. J. Nogales, and A. J. International, pages 1–5. IEEE, 2010. Conejo. Arima models to predict next-day electricity [21] S. V. Verdu, M. O. Garcı́a, F. J. G. Franco, prices. IEEE transactions on power systems, N. Encinas, A. G. Marin, A. Molina, and E. Lazaro. 18(3):1014–1020, 2003. Characterization and identification of electrical [5] M. Falvo, M. Gastaldi, A. Nardecchia, and customers through the use of self-organizing maps and A. Prudenzi. Kalman filter for short-term load daily load parameters. In Power Systems Conference forecasting: an hourly predictor of municipal load. In and Exposition, 2004. IEEE PES, pages 899–906. Proceedings of IASTED International Conference on IEEE, 2004. ASM 2007, pages 364–369, 2007. [22] J. Vesanto, J. Himberg, E. Alhoniemi, [6] M. Farhadi and M. Farshad. A fuzzy inference J. Parhankangas, et al. Self-organizing map in matlab: self-organizing-map based model for short term load the som toolbox. In Proceedings of the Matlab DSP forecasting. In Electrical Power Distribution Networks conference, volume 99, pages 16–17, 1999. (EPDC), 2012 Proceedings of 17th Conference on, [23] T. Weng and Y. Agarwal. From buildings to smart pages 1–9. IEEE, 2012. building sensing and actuation to improve energy efficiency. IEEE Design & Test, 29(4):36–44, 2012.