# Daily Activity Model for Ambient Assisted Living

Guoqing Yin, Dietmar Bruckner

► To cite this version:

Guoqing Yin, Dietmar Bruckner. Daily Activity Model for Ambient Assisted Living. 2nd Doctoral Conference on Computing, Electrical and Industrial Systems (DoCEIS), Feb 2011, Costa de Caparica, Portugal. pp.197-204, 10.1007/978-3-642-19170-1_22. hal-01566592

HAL Id: hal-01566592

https://inria.hal.science/hal-01566592

Submitted on 21 Jul 2017

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Daily Activity Model for Ambient Assisted Living

GuoQing Yin, Dietmar Bruckner

Institute of Computer Technology, Vienna University of Technology,
Gußhausstraße 27-29,
A-1040 Vienna, Austria
{Yin, Bruckner}@ict.tuwien.ac.at

**Abstract.** We propose a novel way for ambient assisted living: a system that with motion detector to observe the daily activities of the elderly, build the daily activity model of the user. In case of unusual activities the system send alarm signal to caregiver. The problems with this approach to build such a model: firstly, the activities of the user are random and dynamic distributed, that means the related data is dynamically and with huge count. Secondly, the difficulty and computational burden to get character parameters of hidden Markov model with many “states”. To deal with the first problem we take advantage of an easy filter algorithm and translate the huge dynamical data to state” data. Secondly according the limited output of distinct observation symbols per state, we reduced the work to research the observation symbol probability distribution. Furthermore the forward algorithm used to calculate the probability of observed sequence according the build model.

**Keywords:** Ambient assisted living, forward algorithm, hidden Markov model.

## 1 Introduction

The aging problem is very important for society [1]. Ambient assisted living is one of the ways to solve the problem. There are many ideas for ambient assisted living, such as: robotic and computer for elderly, video surveillance, wearing sensors for elderly. In paper [2] a conversational robot is developed in order to increase the enjoyment of the elderly in their daily living. An intelligent, dynamically facility introduced in paper [3], which helps the elderly user to browse the internet. In paper [4] a video surveillance system is proposed. It aimed to fall detection of the elderly. A ring sensor will be introduced in paper [5], it is a 24 hour tele-nursing system.

In this paper a novel way for ambient assisted living will be introduced: a system with motion detector which installed in the living environment of the elderly. The system observes the activities of the user and builds the daily activities model of the user. According the model in case of unusual activities happened the system will send alarm signal to caregiver.

Hidden Markov model will be used to build the activities model. There are many papers about hidden Markov model: paper [6] explained the basic definition of Markov chain and the hidden Markov model, furthermore the applications of HMM. The EM Algorithm and parameter estimation for hidden Markov model described in paper [7]. In the paper [8] the author reviews the hidden Markov model and shows its application in speech recognition. A nonstationary hidden Markov model
explored in paper [9], here the dynamic transition probability parameter $A(\tau) = \{a_{ij}(\tau)\}$ is a function of time duration $\tau$. To analyze the motion detector data and learn the behavior of the user the papers [10] and [11] adopt the hidden Markov model. The authors in paper [10] take advantage of semantic symbols and build probability model in building automation systems.

## 2 Contribution to Sustainability and Technological Innovation

Modern technology makes Ambient Assisted Living (AAL) possible. For example in paper [4] a video surveillance system is proposed, in paper [5] a ring sensor is introduced, and similarly another type of wear sensor “alarm button on the wrist” be used to help elderly in emergency. But because of privacy issues, visual tracking is not attractive and because of the elderly have their own psychological and physiological problems, such as memory disorder (forget to wear sensor some day or forget where the sensor is), action obstacles (cannot operate an alarm device in time or in extreme situation – unconsciousness – even cannot press an alarm button on the wrist). Non-intrusive sensing is a better way to deal with these problems, such as paper [12] which a PAS (Personal Assistant System) presented. In project ATTEND (AdapTive scenario recogniTion for Emergency and Need Detection) we avoid to use camera and microphone, without sensor to be wear on the body of the user, and nothing should be activated by the user. Just non-intrusive sensors such as motion detector or door contactor are used. Different from the paper [12] which introduced a real-time system our idea is that according the relative stable life style of elderly, we gather the activity data of user a longer time interval. Through data analyze and unsupervised learning to build the activity model of the elderly. In case of unusual situation happened the system can send alarm to care giver. This paper presents how we analyze the data from motion detector, with hidden Markov model and forward algorithm to build activity model of the user and to analyze the result.

## 3 Translate Raw Dynamic Data to State Data

The used motion detector installed in the living room and it works with such principle: if the motion detector detects activities of the elderly, it will send sensor value “1” to controller, others it will keep silence with value “0”. Because of the activities of the elderly are random and dynamically distributed, for example a user got up yesterday about 7 o’clock and moved around in the living room about 2 hours but today the user gets up about 7:30 and he has activities about 1 hour but discontinuous. In such situation the data sent from motion detector is random and dynamically distributed. In top of figure 1 there is an example with gathered real data about the activities of the user for one day. There are totally 2852 data points (sensor value “1” means activity and “0” means without activity by the user). It is difficult to treat all these data points as “state” to build an activities model of the user. What we interested is the activities in a time interval, for example in 15 or 30 minutes. So we can translate the raw data to state date with predefined time interval.
The advantage of such translating are: firstly, reduced the data count; secondly, make the model building don't fall into complex details.

The approach is: according the time label of the data points separate these data in different time interval, then gather all the data in each time interval, if the sum of the activities bigger than predefined threshold value, so the time interval has state value “1” else has value “0”. The predefined threshold value ($T_{th}$, 0 < $T_{th}$ < 1) indicated the sensitivity of the translating and the predefined time interval ($T_{interval}$) decided the count of the translated state.

1) The gathered sensor value according $T_{interval}$

$$T = \{t_{I(1)}, t_{2(0)}, t_{3(1)}, t_{4(0)}, t_{5(1)}, t_{6(0)}... t_{n(v)}\} \quad (1)$$

Here $t_n$ is the time point that the motion detector send value to controller ($n >= 1$), $v$ is the sensor value itself, it has value “0” or “1”.

2) The activities duration between sensor value

$$\Delta T = (t_{n(0)} - t_{n-1(1)}) \quad (2)$$

3) The sum of the activities duration in $T_{interval}$

$$T_{sum} = \sum(\Delta T) \quad (3)$$

4) Deciding if the time interval gets value “1” or “0”.

$$\text{If } T_{sum} \ge T_{th} * T_{interval}, S_{ix} = 1; \text{If } T_{sum} < T_{th} * T_{interval}, S_{ix} = 0 \quad (4)$$

$S_{ix}$ is the state value that the interval should take. Here “ix” is the interval count (index).

In middle of figure1 is the translating result with above method. The interval begin with the dotted line and end of the dash-dot line (or between dash-dot lines) indicated in the interval has state value “1” (it means activity from the user), others has state value “0” (it means without activity from the user). Here the $T_{interval}$ is 30 minutes, so there are 48 states value in 24 hours. The data count reduced from 2852 data points to 48 states value. From the state value we know that the user has activities from 2 to 2:30, from 6 to 7:00, from 9:30 to 14, from 17:30 to 22:30 has activities, the other time of the day is still.

The bottom of the figure 1 is the histogram from raw data, it used to compare the translated state data with raw data.
<figure><img src="image_2.png" /><figcaption>Fig. 1. Raw data, translated state data and the histogram of raw data.</figcaption></figure>

## 3 Hidden Markov Model and Forward Algorithm

A hidden Markov model [8] can be characterized by following parameters.

1) The number of states $N$.

2) The number of output distinct observation symbols each state $M$.

3) The state transition probability distribution matrix $A = \{p_{ij}\}$.

$$p_{ij} = p\{Q_{t+1} = j | Q_t = i\}, 0 \le p_{ij} \le 1, \sum_{j=1}^{N} p_{ij} = 1, 1 \le i, j \le N \quad (5)$$

Here $Q_t$ is the current state at time t. For example if $N=2$, $p_{i1} = 0.4$, so $p_{i2} = 0.6$.

4) The state emission probability distribution matrix $B = \{b_{ik}\}$.

$$b_{ik} = p(O_t = k | Q_t = i), 1 \le i \le N, 1 \le k \le M \quad (6)$$

Here $O_t$ is the output symbol at time t.

5) The initial state distribution $\pi = \{\pi_i\}$.

$$\pi_i = p\{Q_o = i\} \quad (7)$$

According to the parameter $\lambda$ ($\pi$, $A$, $B$) with forward algorithm we can find out the probability of an observed sequence $Q^{(t)} = \{q_1, q_2, \dots, q_t\}$. Here each of the $q$ is observable state with time label.

6) Get the first transition probability $a_1$ for $t = 1$.

$$a_1(j) = \pi(j) * b_{jt} \quad (8)$$

Here $j$ is the observation count of each observation set and $\sum \pi(j) = 1$.
7) For $t >= 2$ get the transition probability $a, (j)$

<table><tr><td>a<sub>t</sub>(j) = b<sub>jt</sub> * &sum;<sub>i=1</sub><sup>n</sup> (a<sub>t-1</sub>(i) * p<sub>ij</sub>)</td><td>(9)</td></tr></table>

8) For $t <= T$ repeat (9). Here T is the length of the sequence.

# 4 Result and Discussion

The test data come from motion detector which observed the activities of the elderly for one week, so according (1) to (4) we get the state data N=336, if we predefined $T_{th} = 0.25$, $T_{interval} = 30$ minutes. Because each state has only 2 different output “0” and “1”, so M=2. At first the states with same states value and in same time interval will be merged together. Figure 2 shows the result.

<figure><img src="image_3.png" /><figcaption>Fig. 2. The merged states in 7 days.</figcaption></figure>

Figure 2 shows the merging result with 336 states from 7 days. The first state and the last state on day 7 are the initial states, without states value. If the merged sequences have different value, so the sequences will be split. Different sequences will be merged again if they have same states value till to the last states. According (5) to (7) we get the parameters $\lambda = (A, B, \pi)$. These parameters present the build hidden Markov model. Here $b_{ik}$ has the value “0” or “1” in each related state. According the build hidden Markov model with (8) and (9) the probability of an observed sequence will be find out. Figure 3 shows the result. The observation sequence is chosen from the 7 days. It compares with the sequences in the model. It is clearly the biggest probability value (logarithm value, here is -3.892) happened when the chosen day compares with itself. The smallest value is -63.81, it indicated the biggest dissimilarity between the chosen sequence and the compared sequence in the model.
<figure><img src="image_4.png" /><figcaption>Fig. 3. The comparing result with a chosen sequence from the 7 days.</figcaption></figure>

Figure 4 demonstrates the chosen day is the 4th day in the model according its comparing value -3.892 in figure 3.

<figure><img src="image_5.png" /><figcaption>Fig. 4. The best match sequence in the build model.</figcaption></figure>

Figure 5 illustrate the comparing result when the observed sequence is a random sequence. In such situation there must be many states didn't match to the model. That means in some time intervals the states of observed sequence have different states value as the compared sequence in the model. The parameter $b_{jt}$ in (8) and (9) is “0” in such situation. In order to make the comparing completely (because it is perhaps after the mismatch states there are many states match again, the observed sequence and the compared sequence in the model have a high likelihood) set $b_{jt}$ to a constant $b_c$. In other words if the states matched $b_{jt}$ has value “1”; if the states mismatched set $b_{jt}$ to a constant. So we don't need search the $B$ matrix in (6). It must be emphasized that such simplification just used in the situation. Figure 5 displays the best match value is -57.82 and the worst match value is -84.78.
<figure><img src="image_6.png" /><figcaption>Fig. 5. The merged states in 7 days.</figcaption></figure>

Figure 6 shows the best match day is the 3^th^ day in the model according its comparing value -57.82 in figure 5.

<figure><img src="image_7.png" /><figcaption>Fig. 6. The merged states in 7 days.</figcaption></figure>

**5 Conclusion and Further Work**

In this paper we propose a novel way for ambient assisted living: with the data from motion detector to build the activities model of the elderly. At first an easy filter algorithm used to translate the raw data to state data, and then get the parameters of hidden Markov model. At last the forward algorithm used to get the probability of the observation sequence comparing to the build model. In order to find out which sequence in the build model match to the observed sequence. According the special
situation we reduced the work to search the B matrix in hidden Markov model but
instead of a special constant $b_c$.

In the future the merged states from different sequences in the build model will
be merged again with the consecutive states, in order to obtain a simpler but more
robust model.

References

1. M. Burgin.: Age of People and Aging Problem. In Proceedings of the 26th Annual International Conference of the IEEE EMBS, San Francisco, CA, USA, September 1-5, 2004.

2. Marcel Heerink, Ben Kroese, Bob Wielinga, and Vanessa Evers.: Enjoyment, Intention to Use And Actual Use of a Conversational Robot by Elderly People. in HRI'08, March 12-15, 2008, Amsterdam, Netherlands

3. Audrey Hunter, Heather Sayers, and Liam McDaid.: An Evolvable Computer Interface for Elderly Users. In Workshop "Supporting Human Memory with Interactive Systems", HCI Conference, September 4th, 2007, Lancaster, UK

4. Homa Foroughi, Baharak Shakeri Aski, and Hamidreza Pourreza.: Intelligent Video Surveillance for Monitoring Fall Detection of Elderly in Home Environments. In proceedings of 11th International Conference on Computer and Information Technology (ICCIT 2008) 25-27 December, 2008, Khulna, Bangladesh

5. Boo-Ho Yang, Sokwoo Rhee, and Haruhiko H. Asada.: A Twenty-Four Hour Tele-Nursing System Using a Ring Sensor. In proc. of 1998 Int. Conf. on Robotics and Automation, Leuven, Belgium, May 16-20, 1998

6. J. Bilmes (2002). "What HMMs Can do", UWEE Technical Report, Number UWEETR-2002-0003, January 2002.

7. J.A. Bilmes, "A Gentle Tutorial of the EM Algorithm and its application to Parameter Estimation for Gaussian Mixture and hidden Markov Models", international computer science institute, Berkeley CA, 94704, April 1998.

8. L.R. Rabiner, "A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition", proceedings of the IEEE, Vol. 77, NO. 2, FEBRUARY 1989.

9. Bongkee sin, Jin H. Kim.: Nonstationary hidden Markov model. In Signal Processing 46 (1995) 31-46.

10. D. Bruckner, B. Sallans, and G. Russ, "Probability Construction of Symbols in Building Automation Systems", in: Proceedings of 2006 IEEE International Conference of Industrial Informatics INDIN' 06, S. 6, Singapore, 2006.

11. D. Bruckner, B. Sallans, and R. Lang, "Behavior Learning via State Chains from Motion Detector Sensors", Bionetics, 2007, Hungary.

12. Jennifer C. Hou, Qixin Wang, Bedoor K. AlShebli, "PAS: A Wireless-Enabled, Sensor-Integrated Personal Assistant System for Independent and Assisted Living", HCMDSS'07, Boston MA. June, 2007.