SPEED: An Inhabitant Activity Prediction Algorithm for ...

2 downloads 0 Views 353KB Size Report
MART home is a branch of ubiquitous computing in which the information-perceiving and information-processing units remain invisible in the surroundings to ...
1

SPEED: An Inhabitant Activity Prediction Algorithm for Smart Homes Muhammad Raisul Alam, Student Member, IEEE, M. B. I. Reaz, Member, IEEE and M. A. Mohd Ali, Member, IEEE  Abstract— This paper proposes an algorithm, called Sequence Prediction via Enhanced Episode Discovery (SPEED), to predict inhabitant activity in smart homes. SPEED is a variant of the sequence prediction algorithm. It works with the episodes of smart home events that have been extracted based on the ONOFF states of home appliances. An episode is a set of sequential user activities that periodically occur in smart homes. The extracted episodes are processed and arranged in a finite-order Markov model. A method based on prediction by a partial matching (PPM) algorithm is applied to predict the next activity from the previous history. The result shows that SPEED achieves 88.3% prediction accuracy, which is better than LeZi Update, Active LeZi, IPAM, and C4.5. Index Terms—Markov Model, Prediction by partial matching (PPM), Activity prediction, Smart home, Prediction algorithm

I. INTRODUCTION

S

MART home is a branch of ubiquitous computing in which the information-perceiving and information-processing units remain invisible in the surroundings to create a pervasive environment. In the future, most of the common services, e.g., communication, medical, energy, utility, entertainment, and security, will be integrated into homes. People spend a significant amount of time in their houses, and this has drawn researchers to promote integration of all possible services with traditional homes. However, the process requires effective algorithms to predict user activity. These algorithms create an interactive intelligent environment to assist the inhabitant in daily life. This is the accepted version of the published paper. The full citation of this paper is given below: Alam, M.R., Reaz, M.B.I., Mohd Ali, M.A., "SPEED: An Inhabitant Activity Prediction Algorithm for Smart Homes," IEEE Transactions on Systems, Man and Cybernetics, Part A: Systems and Humans, vol.42, no.4, pp.985-990, July 2012, doi: 10.1109/TSMCA.2011.2173568. Muhammad Raisul Alam is with the Institute of Microengineering and Nanoelectronic, Universiti Kebangsaan Malaysia, 43600 UKM Bangi, Selangor, Malaysia (phone: +603-89216316; fax: +603-89216146; e-mail: [email protected]). M. B. I. Reaz is with Department of Electrical, Electronic, and Systems Engineering, Faculty of Engineering and Built Environment, Universiti Kebangsaan Malaysia, 43600 UKM, Bangi, Selangor, Malaysia (e-mail: [email protected]). M. A. Mohd Ali is with Department of Electrical, Electronic, and Systems Engineering, Faculty of Engineering and Built Environment, Universiti Kebangsaan Malaysia, 43600 UKM, Bangi, Selangor, Malaysia (e-mail: [email protected]).

Providing intelligence to the home appliance is a critical problem in designing an intelligent system. The design architecture strongly depends on a system’s perception of the environment and its behavior based on observation. Smart homes, the next emerging research area in the field of artificial intelligence (AI), depend on effective usage of AI algorithms for reliable performance. A smart home should consciously observe the sequence of user behavior, learn the user activity pattern, and try to predict the next probable event. This paper proposes an algorithm called SPEED (Sequence Prediction via Enhanced Episode Discovery) for inhabitant activity prediction. SPEED discovers periodic episodes of inhabitant behavior, trains itself with learned episodes, and makes decisions based on the obtained knowledge. An episode is a pattern of sequential events that occur periodically in smart homes. The performance of a sequence prediction algorithm primarily depends on how an algorithm determines and distinguishes episodes. The algorithms that were previously proposed to provide home intelligence, primarily came from the fields of data compression [1], [2], Bayesian statistics [3], artificial neural networks [4], fuzzy logic [5], [6], neural fuzzy networks [7], machine learning [8], and Markov logic networks [9]. These algorithms were based on the manipulation of traditional data sequences and did not consider the pattern of the smart home events that depict the unique characteristics of smart home inhabitant activity. The proposed SPEED algorithm provides a new approach for episode extraction, utilizing the characteristics of human behavior in smart homes. Prediction accuracy is also influenced by decision-making methods and their efficiency. A method derived from the Prediction by Partial Matching (PPM) algorithm is used to select the most probable future activity [1], [2], [10]. The PPM algorithm estimates the weighted probability of every event using all the possible episodes based on the current window state. An alternative to PPM is using a combination of tree length and episode frequencies to measure the event cost. However, this procedure is not efficient because it considers only a single tree branch to calculate the probable activity. The advantage of PPM is that it uses every possible episode from different branches of the tree and measures the probability based on the weighted episode length. Short-length episodes have less influence on the probability measurement. The final

2 probability is biased by the longest episode. PPM also eliminates the zero-frequency problem [1]. It can predict a sequence that has not occurred previously. Our result shows that the proposed SPEED algorithm exhibits better prediction accuracy than LeZi Update, Active LeZi, IPAM, and C4.5. II. RELATED WORKS In this section, a brief discussion of related sequence prediction algorithms is presented. Bhattacharya et al. proposed the LeZi Update algorithm [2] to track user mobility using the concept of the LZ78 data compression algorithm [11]. LeZi Update constructs a decision tree using LZ78 dictionary contexts and predicts the possible user location based on a PPM-style algorithm. The LeZi Update constructs a k−1th-order Markov model, where k is the longest length of dictionary words. The algorithm has been effectively used to reduce paging cost in cellular networks. However, the LeZi Update algorithm suffers from a low convergence rate [1]. Gopalaratnam et al. improved the LeZi Update, creating the Active LeZi (ALZ) algorithm, by increasing the convergence rate [1]. Instead of parsing data directly from LZ78 dictionary words, it uses a variable-length window to reduce the data loss across phase boundaries. ALZ was tested using MavLab (a testbed of MavHome smart home) data, and the results showed that its convergence rate and prediction accuracy were better than the LeZi Update algorithm. However, its convergence rate was still low, and the prediction accuracy was only 47% [1]. Its time and space complexity was higher than that of the LeZi Update [1]. Davison et al. developed the incremental probabilistic action modeling (IPAM) algorithm to predict the next user command in a UNIX shell prompt [12]. IPAM stores the probabilities of each event in a table and updates the table according to the weighted probability regarding the immediate past command. It showed better prediction accuracy than the popular C4.5 [13] machine learning algorithm [12]. C4.5 generates a classifier expressed as a decision tree. It classifies the inputs and predicts the class of the inputs based on the attributes. A major disadvantage of C4.5 is that it takes a considerable amount of CPU time and additional memory for rule sets. IPAM is a better choice when one is looking for a simple and speedy algorithm with reasonable prediction accuracy. However, its prediction accuracy is not as high as the ALZ and LeZi Update algorithms, considering the storage requirement [1], [2], [12]. Its space complexity is n 2  , where n is the number of distinct events. Table I shows a comparison between the sequence prediction algorithms. From the prediction accuracy rates, it is intuitive that the Markov model yields better prediction accuracies than the other methods. From our experiment, we found that the algorithms that create a more dense Markov chain with a longer chain length provide higher prediction accuracy than the less dense and short-length Markov chain. This paper presents a data extraction method to construct a

Markov model with high density and long Markov chains. Furthermore, these algorithms were basically developed for the sequence of text string processing. They failed to classify smart home event sequences that possess special patterns different from the text string. This paper solves the problem by applying the entity state classification method. SPEED considers the unique pattern of entities inside a home and can classify them into valid episodes. TABLE I COMPARISON BETWEEN THE SEQUENCE PREDICTION ALGORITHMS Name Methods Prediction Accuracy Active LeZi Markov model 47% [1] LeZi Update Markov model Max_Episode_Length Max_Episode_Length := length(episode) end window := window(end - Max_Episode_Length+1: end) add or update frequencies of all possible contexts within the episode where, maximum context length = Max_Episode_Length end forever forever Fig. 1. Pseudocode of the proposed SPEED algorithm.

Let us consider another sequence CbdcA in the window. The algorithm looks for the next event and finds D. It adds D to the window. Therefore, the window state is now CbdcAD. It searches for the opposite event of D in the window. The opposite event is d and it can be found at the third position of the window. Thus, the algorithm defines dcAD as an episode, increases Max_Episode_Length to 4 (if required), and truncates the window from CbdcAD to dcAD (because Max_Episode_Length=4 and the latest 4 events are dcAD). It extracts all the possible contexts from the episode (the episode is dcAD, and the possible contexts are d, c, A, D, dc, cA, AD, dcA, cAD, and dcAD) and updates the frequencies of existing and new sequences. Table III shows how the algorithm has generated all possible contexts from the event sequence. SPEED builds a k−1th-order Markov model, where k is the

4

TABLE III GENERATING ALL POSSIBLE CONTEXTS FROM THE EVENT SEQUENCE USING THE SPEED ALGORITHM Max_Episo Possible contexts from the Window de_Length episode in which Window after after maximum context length = after Max_Episode episode episode episode Max_Episode_Length (if current _Length extraction extraction episode found) event

Sequence

Current event

1 2 3 4 5

A B b D C

A AB ABb BbD BbDC

1 1 1 2 2

6 7 8 9

c a B C

BbDCc Cca CcaB CcaBC

10 11 12

b d c

13 14

1 1 2 2 2

A AB Bb BbD BbDC

2 2 2 2

Not found Not found Bb Not found Not Found Cc Not found Not found caBC

2 2 2 4

Cc Cca CcaB caBC

caBCb aBCbd aBCbdc

4 4 4

BCb Not found Cbdc

4 4 4

aBCb aBCbd Cbdc

A D

CbdcA CbdcAD

4 4

Not found dcAD

4 4

CbdcA dcAD

15 16 17 18

a B A d

dcADa cADaB cADaBA DaBAd

4 4 4 4

ADa Not found aBA DaBAd

4 4 4 5

cADa cADaB DaBA DaBAd

19 20

a b

DaBAda aBAdab

5 5

Ada BAdab

5 5

aBAda BAdab

maximum length of the episodes. The decision tree that is generated from the contexts of the episodes has a maximum of k levels and is populated with frequencies of repetition. From the frequencies, the probability distribution of all events can be calculated for making a decision. D. Making a Decision At this point, SPEED has already created a tree with the episodes of different lengths and the frequencies of occurrence. The next task is to predict the future event by utilizing the information stored in the tree. An algorithm from the PPM family is applied to decide the probable future incident from the current state of the decision tree. The significance of the algorithm is that it calculates the probability of an event by successively decreasing the length of an episode and it measures the weighted probability distribution according to the episode length. This procedure is similar to the ALZ algorithm. We have generated a tree, as shown in Fig. 2, by considering all possible contexts with the frequency of occurrence shown in Table III. Let us consider the previous ABbDCcaBCbdcADaBAdab sequence and assume that our current window state is Ada. We can use all of the suffixes (the possible phases are Ada, Ad, A, and null) to calculate the probability of the next event. Suppose we have to estimate the probability of the next symbol b. From Fig. 2, it can be noted

B, b, Bb

C, c, Cc

c, a, B, C, ca, aB, BC, caB, aBC, caBC B, C, b, BC, Cb, BCb C, b, d, c, Cb, bd, dc, Cbd, bdc, Cbdc

All possible contexts with frequency of occurrence

A(6), B(6), C(4), D(3), a(6), b(4), c(4), d(5), AD(2), Ad(3), BA(3), BC(2), Bb(1), Cc(1), Cb(2), Da(2), aB(3), ab(1), bd(1), ca(1), cA(1), dc(2), da(2), ADa(1), Ada(2), BAd(2), BCb(1), Cbd(1), DaB(1), aBA(2), aBC(1), bdc(1), cAD(1), caB(1), dab(1), dcA(1),Adab(1), BAda(1), BAdab(1), Cbdc(1), DaBA(1), aBAd(1), caBC(1), dcAD(1), DaBAd(1)

d, c, A, D, dc, cA, AD, dcA, cAD, dcAD A, D, a, AD, Da, ADa a, B, A, aB, BA, aBA D, a, B, A, d, Da, aB, BA, Ad, DaB, aBA, BAd, DaBA, aBAd, DaBAd A, d, a, Ad, da, Ada B, A, d, a, b, BA, Ad, da, ab, BAd, Ada, dab, BAda, Adab, BAdab

that b occurs once out of the 2 times of the appearance of context Ada. The other case produces 1 null outcome. As a result, the probability of encountering b in the context Ada is 1 in 2, and we now escape to the lower order with probability 1 in 2. The escape probability is multiplied by lower-order episodes to reduce their influence while calculating the probability. In the current order, we see that no b occurs after Ad, that is, the probability is 0, and the probability of a null outcome is 1 in 3. At this moment, the considered phase is reduced to A, and b never comes after A. Here, the probability is also 0 and the escape probability to a lower order is 1/6 because the total occurrence of A is 6 and after A, we have 1 null outcome. The next phase is null, and the probability of the occurrence of b after null is 4/38 because the sum of the occurrence of all the events is 38 and the total frequency of b is 4. As a consequence, the probability of seeing b as the next symbol is 1 1  0 1  0 1  4          0.503 2 2  3 3  6 6  38 

We can also calculate the probability of seeing c as the next event after Ada from the following term: 0 1  0 1  0 1  4          0.003 2 2  3 3  6 6  38 

The general equation of this PPM algorithm is as follows: (1) Pk ( )  pk ( )  ek ( ).Pk 1 ( )

5 where  is the symbol to predict, Pk ( ) is the final probability of symbol  , k is the length of the phase, p k ( ) is

re-forms an episode and there are no other episodes inside it. If we have n distinct events, SPEED constructs a tree of n branches. The length of the first branch is n, the second branch

the probability of seeing  symbol after the k length phase, 0

A(6)

a(6)

D(2)

d(3)

a(1)

a(2) b(1)

b(1) C(1)

B(6) B(3) A(2)

b(1)

b(4)

C(2)

A(3)

d(1)

b(1)

d(2)

c(1)

d(1)

C(4) c(1)

a(1)

c(4)

D(3)

d(5)

b(2)

a(1)

A(1)

a(2)

c(2)

a(2)

d(1)

B(1)

D(1)

B(1)

A(1)

b(1)

c(1)

C(1)

A(1)

D(1)

b(1)

d(1)

Fig. 2. The tree formed by SPEED after processing ABbDCcaBCbdcADaBAdab sequence

and ek ( ) is the escape probability of symbol  . Furthermore, p k ( )  ck (2) C c (3) ek  o C where C is the total occurrence of episodes of k−1 length,

c k is the total occurrence of the  event after exploring the current episode, and c 0 is the total number of null outcomes after exploring the current episode. From (1)–(3), we can calculate the probabilities of the remaining events, such as c, d, A, B, C, and D. The event with the maximum probability will be selected as the next probable event. IV. COMPLEXITY ANALYSIS SPEED consumes space and time for data processing. The following analysis discusses the worst-case conditions of the SPEED algorithm. Theorem 1. The number of nodes in the tree is n 2  . Proof: The worst possible case arises when the entire event sequence creates an episode and there are no other subepisodes inside it. In this case, the size of the window increases sequentially after the occurrence of each of the events. Suppose we have an Abcda sequence. The sequence starts with A and ends with a. Thus, the whole sequence is an episode, and there is no other episode in the sequence. Fig. 3 shows the tree formed by the sequence Abcda that consists of five distinct elements. If we have n numbers of window elements, then the size of the window increases from 1 to n. When SPEED gets the episode, it creates a tree of n(n+1)/2 nodes. Therefore, in this worst case, the space complexity is n 2  . Theorem 2. The time complexity of the algorithm is n 2  . Proof: The time complexity is similar to the space complexity. The worst case arises when the whole sequence

is n−1, the third branch is n−2, and the nth branch is 1 (Fig. 3). If the algorithm searches for the place of the last sequence state of the window, it needs to search all of the branches, update the frequencies of every node of each branch, and lastly, add a new branch consisting of only the last event. The maximum required time is 1+2+3+…+ (n−2) + (n−1) + n= n(n+1)/2. Therefore, the time complexity is n 2  . 0

A(1)

b(1)

c(1)

d(1)

b(1)

c(1)

d(1)

a(1)

c(1)

d(1)

a(1)

d(1)

a(1)

a(1)

a(1)

Fig. 3. A worst-case tree formed by the Abcda sequence.

V. PERFORMANCE EVALUATION We tested the algorithm with practical data found in smart homes. We used MavLab data for this purpose [14]. MavLab was the testbed of MavHome [15] at the University of Texas, Arlington. The sample comprised activities of six inhabitants at MavHome in April 2003. MavHome had approximately 50 different appliances with two different states: ON and OFF. All of these appliances generated approximately 700 sequential states during that month. We used these sequential event states to compare between all the algorithms presented here. We compared our algorithm with ALZ and IPAM. ALZ uses a decision tree, whereas IPAM predicts by statistical inference. According to the previous research output, ALZ is

6 better than LeZi Update [1]. Hence, if we can prove that the proposed algorithm is better than ALZ, then it would imply that it is also better than LeZi Update. The performance of IPAM is comparable with or sometimes even better than that of the C4.5 algorithm [12]. Therefore, a better algorithm than IPAM is also better than C4.5. The testing episodes influence the accuracy of the algorithm. We tested SPEED at different convergence states to determine the actual trends of prediction accuracy. Fig. 4 shows the performance of the algorithms when they were tested with MavHome data. The curves show that SPEED’s prediction accuracy is always higher than that of IPAM and ALZ (except for the unstable initial stage). It also indicates that SPEED’s convergence rate is faster than that of the other methods. Fig. 5 shows that SPEED consumes less storage than IPAM but more storage than ALZ. The timing requirement is similar to the storage requirement because the required time to add new nodes is proportional to the number of new nodes. Thus, SPEED demonstrated a higher convergence rate and a better prediction accuracy than C4.5, IPAM, LeZi Update, and ALZ. This result proves that the SPEED episode isolation criterion is a strong data classification method that can effectively cluster unique smart home data pattern.

episodes because effective episode classification results in better performance. The algorithm proposed here can successfully identify significant episodes of smart home inhabitant activities. The exclusive pattern isolation rule ultimately performed better than the other algorithms. This is because the amount of knowledge it contains is higher, its memory is better organized, and it uses multiorder knowledge to make decisions. SPEED is the first sequence prediction algorithm that is based on human activity patterns inside smart homes. Previously proposed algorithms are based on general sequence patterns and are not concerned about the psychological behavior of the people inside homes. The performance of SPEED implies that our episode evaluation criterion is more effective than other available approaches. ACKNOWLEDGMENT We would like to thank Dr. Daine J. Cook, Huie-Rogers Chair Professor in School of Electrical Engineering and Computer Science, Washington State University, for the MavLab user data. REFERENCES [1]

[2]

[3]

[4]

[5]

Fig. 4. Comparison between SPEED, ALZ, and IPAM, which shows that SPEED exhibits higher prediction accuracy than the other methods.

[6]

[7]

[8]

[9]

[10]

[11] Fig. 5. Comparison between SPEED, ALZ, and IPAM, which shows that SPEED consumes less storage than IPAM and more storage than ALZ.

[12]

VI. CONCLUSION

[13]

Sequence prediction algorithms differ in the classification of

[14]

K. Gopalratnam and D. J. Cook, “Online Sequential Prediction via Incremental Parsing: The Active LeZi Algorithm,” IEEE Intell. Syst, vol. 22, pp. 52-58, Jan. 2007. A. Bhattacharya and S. K. Das, “LeZi-Update: An InformationTheoretic Framework for Personal Mobility Tracking in PCS Networks,” Wireless Networks J., vol. 8, no. 2–3, pp. 121–135, MarMay. 2002, C.-L. Wu and L.-C. Fu, “Design and Realization of a Framework for Human–System Interaction in Smart Homes”, IEEE Trans. Syst., Man, Cybern. A, Syst., Humans, vol. 35, pp. 55–65, Jan. 2005. M. C. Mozer, “The neural network house: an environment that’s adapts to its inhabitants”, in Proc. of the AAAI Spring Symposium on Intelligent Environments, Menlo Park, CA: AAAI Press, 1998, pp. 110– 114. C. Anagnostopoulos and S. Hadjiefthymiades, “Advanced Inference in Situation-Aware Computing”, IEEE Trans. Syst., Man, Cybern. A, Syst., Humans, vol. 39, pp. 1108 - 1115, Sept. 2009. F. Doctor, H. Hagras, and V. Callaghan, “A fuzzy embedded agentbased approach for realizing ambient intelligence in intelligent inhabited environments”, IEEE Trans. Syst., Man, Cybern. A, Syst., Humans, vol. 35, pp. 55–65, Jan. 2005. C.-F. Juang and C.-M. Chang, “Human Body Posture Classification by a Neural Fuzzy Network and Home Care System Application”, IEEE Trans. Syst., Man, Cybern. A, Syst., Humans, vol. 37, pp. 984 – 994, Nov. 2007. P. Rashidi and D. J. Cook, “Keeping the Resident in the Loop: Adapting the Smart Home to the User”, IEEE Trans. Syst., Man, Cybern. A, Syst., Humans, vol. 39, pp. 949 - 959, Sept. 2009. C. Wu and H. Aghajan, “User-Centric Environment Discovery With Camera Networks in Smart Homes”, IEEE Trans. Syst., Man, Cybern. A, Syst., Humans, vol. 41, pp.375 - 383, Mar. 2011. J. G. Cleary and I. H. Witten, “Data compression using adaptive coding and partial string matching”, IEEE Trans. on Communications vol. 32, pp. 396-402, Apr. 1984. J. Ziv and A. Lempel, “Compression of Individual Sequences via Variable Rate Coding, ”IEEE Trans. Inf. Theory, vol. 24, pp. 530–536, Sep. 1978. B. D. Davison and H. Hirsh “Predicting sequences of user actions”, Proceedings of the AAAI/ICML Workshop on Predicting the Future: AI Approaches to Time Series Problems, 1998, pp. 5–12. J. R. Quinlan, C4.5: Programs for Machine Learning, San Francisco, CA: Morgan Kaufmann Publishers Inc., 1993. Smart Home Datasets, http://ailab.eecs.wsu.edu/casas/datasets.html.

7 [15] G.M. Youngblood, D.J. Cook, “Data Mining for Hierarchical Model Creation,” IEEE Trans. Syst., Man, Cybern. C, Appl. Rev., vol 37, pp.561 – 572, Jul. 2007.

Suggest Documents