Unsupervised Anomaly Detection for Energy Consumption in Time Series using Clustering Approach

Jesmeen M. Z. H., J. Hossen, Azlan Bin Abd. Aziz


Recent years have seen significant growth in the adoption of smart home devices. It involves a Smart Home System for better visualisation and analysis with time series. However, there are a few challenges faced by the system developers, such as data quality or data anomaly issues. These anomalies can be due to technical or non-technical faults. It is essential to detect the non-technical fault as it might incur economic cost. In this study, the main objective is to overcome the challenge of training learning models in the case of an unlabelled dataset. Another important consideration is to train the model to be able to discriminate abnormal consumption from seasonal-based consumption. This paper proposes a system using unsupervised learning for Time-Series data in the smart home environment. Initially, the model collected data from the real-time scenario. Following seasonal-based features are generated from the time-domain, followed by feature reduction technique PCA to 2-dimension data. This data then passed through four known unsupervised learning models and was evaluated using the Excess Mass and Mass-Volume method. The results concluded that LOF tends to outperform in the case of detecting anomalies in electricity consumption. The proposed model was further evaluated by benchmark anomaly dataset, and it was also proved that the system could work with the different fields containing time-series data. The model will cluster data into anomalies and not. The developed anomaly detector will detect all anomalies as soon as possible, triggering real alarms in real-time for time-series data's energy consumption. It has the capability to adapt to changing values automatically.


Doi: 10.28991/esj-2021-01314

Full Text: PDF


Anomaly Detection; Energy Consumption; Unsupervised Learning; Time-series Data.


Madhuri, G. Sandhya, and M. Usha Rani. “Anomaly Detection Techniques.” SSRN Electronic Journal 7 (2018): 449–453. doi:10.2139/ssrn.3167172.

Oladipupo, Taiwo. “Types of Machine Learning Algorithms.” In New Advances in Machine Learning, 2010. doi:10.5772/9385.

Himeur, Yassine, Khalida Ghanem, Abdullah Alsalemi, Faycal Bensaali, and Abbes Amira. “Artificial Intelligence Based Anomaly Detection of Energy Consumption in Buildings: A Review, Current Trends and New Perspectives.” Applied Energy 287 (2021): 116601. doi:10.1016/j.apenergy.2021.116601.

Holman, Trevor. “Electricity Theft for Bitcoin Mining Imposes Loss of $25 Million in Malaysia.” Cryptonewsz, 2019. Available online: https://www.cryptonewsz.com/electricity-theft-for-bitcoin-mining-imposes-loss-of-25-million-in-malaysia/37197/ (accessed on February 2020).

Wang, Zhe, Thomas Parkinson, Peixian Li, Borong Lin, and Tianzhen Hong. “The Squeaky Wheel: Machine Learning for Anomaly Detection in Subjective Thermal Comfort Votes.” Building and Environment 151, no. January (2019): 219–27. doi:10.1016/j.buildenv.2019.01.050.

Frery, Jordan, Amaury Habrard, Marc Sebban, Olivier Caelen, and Liyun He-Guelton. “Efficient Top Rank Optimization with Gradient Boosting for Supervised Anomaly Detection.” Lecture Notes in Computer Science (Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), 2017. doi:10.1007/978-3-319-71249-9_2.

Pajouh, Hamed Haddad, Gholam Hossein Dastghaibyfard, and Sattar Hashemi. “Two-Tier Network Anomaly Detection Model: A Machine Learning Approach.” Journal of Intelligent Information Systems 48, no. 1 (2017): 61–74. doi:10.1007/s10844-015-0388-x.

Cauteruccio, Francesco, Giancarlo Fortino, Antonio Guerrieri, Antonio Liotta, Decebal Constantin Mocanu, Cristian Perra, Giorgio Terracina, and Maria Torres Vega. “Short-Long Term Anomaly Detection in Wireless Sensor Networks Based on Machine Learning and Multi-Parameterized Edit Distance.” Information Fusion 52 (2019): 13–30. doi:10.1016/j.inffus.2018.11.010.

Puig, Bernat Coma, and Josep Carmona. “Bridging the Gap between Energy Consumption and Distribution through Non-Technical Loss Detection.” Energies 12, no. 9 (2019). doi:10.3390/en12091748.

Moerchen, Fabian. “Algorithms for Time Series Knowledge Mining.” In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2006:668–73, 2006. doi:10.1145/1150402.1150485.

Saad, Akram, and N. Sisworahardjo. “Data Analytics-Based Anomaly Detection in Smart Distribution Network.” In International Conference on High Voltage Engineering and Power Systems, ICHVEPS 2017 - Proceeding, 2017-January:1–5, 2017. doi:10.1109/ICHVEPS.2017.8225855.

Yu, Yufeng, Yuelong Zhu, Shijin Li, and Dingsheng Wan. “Time Series Outlier Detection Based on Sliding Window Prediction.” Mathematical Problems in Engineering 2014 (2014). doi:10.1155/2014/879736.

Zhang, Aoqian, Shaoxu Song, Jianmin Wang, and Philip S. Yu. “Time Series Data Cleaning: From Anomaly Detection to Anomaly Repairing.” Proceedings of the VLDB Endowment 10, no. 10 (2017): 1046–57. doi:10.14778/3115404.3115410.

Song, Shaoxu, Chunping Li, and Xiaoquan Zhang. “Turn Waste into Wealth: On Simultaneous Clustering and Cleaning over Dirty Data.” In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2015-August:1115–24. New York, NY, USA: Association for Computing Machinery, 2015. doi:10.1145/2783258.2783317.

He, Guoliang, Yong Duan, Rong Peng, Xiaoyuan Jing, Tieyun Qian, and Lingling Wang. “Early Classification on Multivariate Time Series.” Neurocomputing 149, no. PB (2015): 777–87. doi:10.1016/j.neucom.2014.07.056.

Ahmed, Mohiuddin, Abdun Naser Mahmood, and Jiankun Hu. “A Survey of Network Anomaly Detection Techniques.” Journal of Network and Computer Applications 60 (2016): 19–31. doi:10.1016/j.jnca.2015.11.016.

Wang, Xinlin, and Sung Hoon Ahn. “Real-Time Prediction and Anomaly Detection of Electrical Load in a Residential Community.” Applied Energy 259, no. 114145 (2020). doi:10.1016/j.apenergy.2019.114145.

Zhao, Shizhen, Wenfeng Li, and Jingjing Cao. “A User-Adaptive Algorithm for Activity Recognition Based on K-Means Clustering, Local Outlier Factor, and Multivariate Gaussian Distribution.” Sensors (Switzerland) 18, no. 6 (2018). doi:10.3390/s18061850.

Breuniq, Markus M., Hans Peter Kriegel, Raymond T. Ng, and Jörg Sander. “LOF: Identifying Density-Based Local Outliers.” In SIGMOD Record (ACM Special Interest Group on Management of Data), 29:93–104, 2000. doi:10.1145/335191.335388.

Rai, Arun Kumar, and Rajendra Kumar Dwivedi. “Fraud Detection in Credit Card Data Using Unsupervised Machine Learning Based Scheme.” In Proceedings of the International Conference on Electronics and Sustainable Communication Systems, ICESC 2020, 421–26, 2020. doi:10.1109/ICESC48915.2020.9155615.

Wold, Svante, Kim Esbensen, and Paul Geladi. “Principal Component Analysis.” Chemometrics and Intelligent Laboratory Systems 2, no. 1–3 (August 1987): 37–52. doi:10.1016/0169-7439(87)80084-9.

Oliveira, Jadson Jose Monteiro, and Robson Leonardo Ferreira Cordeiro. “Unsupervised Dimensionality Reduction for Very Large Datasets: Are We Going to the Right Direction?” Knowledge-Based Systems 196 (2020): 105777. doi:10.1016/j.knosys.2020.105777.

Schölkopf, Bernhard, John C. Platt, John Shawe-Taylor, Alex J. Smola, and Robert C. Williamson. “Estimating the Support of a High-Dimensional Distribution.” Neural Computation 13, no. 7 (2001): 1443–71. doi:10.1162/089976601750264965.

McKinnon, Conor, James Carroll, Alasdair McDonald, Sofia Koukoura, David Infield, and Conaill Soraghan. “Comparison of New Anomaly Detection Technique for Wind Turbine Condition Monitoring Using Gearbox SCADA Data.” Energies 13, no. 19 (2020). doi:10.3390/en13195152.

Liu, Fei Tony, Kai Ming Ting, and Zhi Hua Zhou. “Isolation Forest.” In Proceedings - IEEE International Conference on Data Mining, ICDM, 413–22. Data Mining, ICDM, (2008). doi:10.1109/ICDM.2008.17.

Reynolds, Douglas. Gaussian Mixture Models BT - Encyclopedia of Biometrics. Edited by S Z Li and A Jain. Boston, MA: Springer US, 2009. https://doi.org/10.1007/978-0-387-73003-5_196.

Goix, Nicolas. “How to Evaluate the Quality of Unsupervised Anomaly Detection Algorithms?,” (2016).

Lavin, Alexander, and Subutai Ahmad. “Evaluating Real-Time Anomaly Detection Algorithms - The Numenta Anomaly Benchmark.” Proceedings - 2015 IEEE 14th International Conference on Machine Learning and Applications, ICMLA 2015, 2016, 38–44. doi:10.1109/ICMLA.2015.141.

Full Text: PDF

DOI: 10.28991/esj-2021-01314


  • There are currently no refbacks.

Copyright (c) 2021 Jesmeen Mohd Zebaral Hoque, Dr. Md. Jakir Hossen, Dr. Azlan Bin Abd. Aziz