• Vol 10, No 7 (2019)
  • Electrical, Electronics, and Computer Engineering

Anomaly Detection for Home Activity based on Sequence Pattern

Soon-Chang Poh, Yi-Fei Tan, Soon-Nyean Cheong, Chee-Pun Ooi, Wooi-Haw Tan

Corresponding email: psoonchang@gmail.com

Cite this article as:
Poh, S., Tan, Y., Cheong, S., Ooi, C., Tan, W., 2019. Anomaly Detection for Home Activity based on Sequence Pattern. International Journal of Technology. Volume 10(7), pp. 1276-1285
Soon-Chang Poh Faculty of Engineering, Multimedia University, Persiaran Multimedia, 63000, Selangor, Malaysia
Yi-Fei Tan Faculty of Engineering, Multimedia University, Persiaran Multimedia, 63000, Selangor, Malaysia
Soon-Nyean Cheong Faculty of Engineering, Multimedia University, Persiaran Multimedia, 63000, Selangor, Malaysia
Chee-Pun Ooi Faculty of Engineering, Multimedia University, Persiaran Multimedia, 63000, Selangor, Malaysia
Wooi-Haw Tan Faculty of Engineering, Multimedia University, Persiaran Multimedia, 63000, Selangor, Malaysia
Email to Corresponding Author


In Malaysia, the elderly population continues to grow. At the same time, young adults are unable to take care of their elderly parents due to work commitments. This results in an increasing number of elderly people living in solitude. Therefore, it is crucial to monitor elderly people’s behavior, especially the pattern of their daily home activities. Abnormal behaviors in carrying out home activities may indicate health concerns in elderly people. Past studies have proposed the use of complex machine learning algorithms to detect anomalies in daily sequences of home activities. In this paper, a simple, alternative method for detecting anomalies in daily sequences of home activities is presented. The experiment results demonstrate that the model achieved a test accuracy of 90.79% on a public dataset.

Anomaly detection; Elderly; Home activities; Sequence pattern


According to the World Health Organization (2018), the population of elderly people (60 years old and over) in the Southeast Asia region will likely increase to around 12% in 2025. In Malaysia, the Department of Statistics recorded an increase in the old-age population (65 years and over) from 2 million to 2.1 million from 2017 to 2018 (Mahidin, 2018). Due to work commitments, young adults are unable to care for their elderly parents all the time. One solution to this problem is to hire caretakers to look after elderly people. However, this solution has several limitations. First, a caretaker service might not be affordable for some families due to its high price. Second, it is difficult to hire caregivers to take care of elderly people all day and night throughout the week. Amid the development of Internet of Things (IoT) technology and machine learning, an alternative solution arises, known as activity recognition. By installing sensors at home and applying machine learning algorithms to classify sensor data, the activities of a person at home can be tracked and recorded (Lara & Labrador, 2012; Bux, et al., 2016). Another type of activity recognition employs wearable sensors such as an accelerometer for activity recognition (Dwiyantoro et al., 2016; Zainuddin et al., 2017). In a retirement town, activity recognition can be used to monitor a large number of elderly residents with a few human experts.

Behavioral changes in carrying out home activities may be related to an elderly person’s health decline. For example, a sudden increase in sleeping duration during the daytime may imply that the person is not well. With activity recognition, the historical records of the elderly person’s home activities can be obtained. By conducting data analysis on these records using an anomaly detection method,  changes  in  behavior  can  be  detected. In  this paper, an  anomaly detection method to detect anomalies in patterns of the daily sequences of home activities is presented.  Figure 1 illustrates an example of a sequence of home activities, consisting of all the activities that occurred in a day from 0:00 to 23:59. Each daily sequence is a data instance in this paper.

Figure 1 An example of daily sequence of home activities

Forkan et al. (2015) proposed an anomaly detection based on the Hidden Markov Model (HMM) to identify anomalies in a sequence pattern of home activities. For HMM, the number of hidden states is an unknown parameter. The researchers trained several models with a varying number of states on a synthetic dataset generated based on public datasets. The results showed the method has an average accuracy of 90%.

Damla and Bouchachia (2017) presented an anomaly detection method using Recurrent Neural Network (RNN) to detect abnormal behavior for elderly people with dementia with a true positive rate of 91.43% and a false positive rate of 40.96%. In this work, daily activity sequences of a public dataset were used as normal data, whereas abnormal data were artificially generated by injecting some abnormal activity sequences into the normal data. The researchers trained the RNN model on a training set of activity sequences. For each activity sequence, the RNN outputted a confidence value that ranged from 0 to 1. The average of the training set confidence values was used as the threshold for anomaly detection. Given an activity sequence and a trained RNN model, if the confidence value outputted by the RNN is higher than the threshold, then the activity sequence is classified as normal and vice versa.

Hoque et al. (2015) used a sequential pattern mining algorithm called PrefixSpan and a statistical method for anomaly detection. First, they retrieved home activity sequences frequent in the dataset using PrefixSpan. Then, they modeled the duration and interval between activities with Gaussian distribution for anomaly detection.

On the other hand, Riboni et al. (2016) introduced a rule-based anomaly detection method to detect anomalies in the home activity of patients with mild cognitive impairments. They defined sequences of activity that are unique to dementia patients.

Zhao et al. (2014) introduced a method using 2 Markov chains to detect anomalies in an elderly person’s location sequences at home with a high detection ratio of 92.539%. For this method, a Markov chain was trained on normal data, while another was trained on abnormal data. Given an unseen location sequence, a ratio of probabilities calculated with these trained Markov chains is used to classify whether it is anomalous or not. 


This paper has presented a method for detecting anomaly in a person’s routine based on his/her usual daily home activities pattern. The experiment was carried out using a public dataset, and the results demonstrated that the method performs well in terms of precision, recall and accuracy. However, there are a few areas that can be investigated further in the future, including: (1) The size of the sliding window. Current sliding window size is set as 3 but the efficiency of the sliding window size could be further studied; and (2) Dependence on the training set size. Hopefully, the method can be enhanced further in the future to reduce the anomaly detection method’s reliance on the training set size.


This work was funded by a Telekom Malaysia Research & Development (TM R&D) Grant in 2018. The dataset was obtained from the website of CASAS, Washington State University.


Bux, A., Angelov, P., Habib, Z., 2016. Vision Based Human Activity Recognition: A Review. Advances in Computational Intelligence Systems, Volume 153, pp. 341371

Cook, D., 2010. Learning Setting-generalized Activity Models for Smart Spaces. IEEE Intelligence Systems, Volume 27(1), pp. 3238

Damla, A., Bouchachia, A., 2017. Activity Recognition and Abnormal Behavior Detection using Recurrent Neural Networks. Procedia Computer Science, Volume 110, pp. 8693

Dwiyantoro, A., Nugraha, I., Choi, D., 2016. A Simple Hierarchical Activity Recognition System using a Gravity Sensor and Accelerometer on a Smartphone. International Journal of Technology, Volume 7(5), pp. 831839

Forkan, A., Khalil, I., Tari, Z., Foufou, S., Bouras, A., 2015. A Context-aware Approach for Long-term Behavioural Change Detection and Abnormality Prediction in Ambient Assisted Living. Pattern Recognition, Volume 48(3), pp. 628641

Hoque, E., Dickerson, R., Preum, S., Hanson, M., Barth, A., Stankovic, J., 2015. Holmes: A Comprehensive Anomaly Detection System for Daily In-home Activities. In: 2015 International Conference on Distributed Computing in Sensor Systems, IEEE, Fortaleza, Brazil, pp. 4051

Lara, O., Labrador, M., 2012. A Survey on Human Activity Recognition using Wearable Sensors. IEEE Communications Surveys & Tutorials, Volume 15(3), pp. 11921209

Mahidin, M., 2018. Selected Demographic Indicators. Retrieved from Department of Statistics Malaysia. Available Online at: https://www.dosm.gov.my/v1/index.php?r=column/pdfPrev&id=RmsrQVZMVEh1SDR3Yng0cFRXNkxPdz09, Accessed on 12 December, 2018

Riboni, D., Bettini, C., Civitarese, G., Janjua, Z.H., Helaoui, R., 2016. SmartFABER: Recognizing Fine-grained Abnormal Behaviours for Early Detection of Mild Cognitive Impairment. Artificial Intelligence in Medicine, Volume 67, pp. 5774

World Health Organization, 2018. Health Situation and Trend Assessment. Retrieved from World Health Organization Regional Office for Southeast Asia. Available Online at http://www.searo.who.int/entity/health_situation_trends/data/chi/elderly-population/en/, Accessed on 12 December, 2018

Zainuddin, M., Sulaiman, M., Mustapha, N., Perumal, T., Mohamed, R., 2017. Recognizing Complex Human Activities using Hybrid Feature Selections based on an Accelerometer Sensor. International Journal of Technology, Volume 8(5), pp. 968978

Zhao, T., Ni, H., Zhou, X., Qiang, L., Zhang, D., Yu, Z., 2014. Detecting Abnormal Patterns of Daily Activities for the Elderly Living Alone. In: Health Information Science 2014, Lecture Notes in Computer Science, Volume 8423, Springer, Cham, pp. 95108