2009 First Asian Conference on Intelligent Information and Database Systems
CCBR: Chaining Case Based Reasoning in Context-Aware Smart Home Tam Van Nguyen, Student Member, IEEE
Yi Chang Woo and Deokjai Choi
Department of Computer Engineering Chonnam National University 300 Yongbong-dong, Bukgu, Gwangju, 500-757, Korea Email:
[email protected]
Department of Computer Engineering Chonnam National University 300 Yongbong-dong, Bukgu, Gwangju, 500-757, Korea Email:
[email protected],
[email protected]
Abstract— In ubiquitous computing environments like smart home, context awareness is a very important component which aims at providing automatic services. This paper proposes chaining case based reasoning (CCBR) as the reasoning method which solves the vagueness of traditional case based reasoning (CBR) approach “In the certain case with more than one solution, we don’t know which solution or activity will be chosen to satisfy user’s needs in smart home’s context”. The context’s contents in smart home are described in this paper. Also, we introduce the framework of context awareness based on CCBR, and discuss the case representation, case adaptation, and similarity computation in detail. Our proposed CCBR integrated into the virtual smart home environment acquires knowledge about user actions that are recorded to determine their preferences and then simultaneously activates the devices with predefined settings.
the method combining the CBR and ontology to provide semantic meanings in reasoning [8]. Basically, those works base on the basic assumption of CBR, “similar problems have similar solutions”. In this assumption, one context case has only one solution to the corresponding activity. However, this assumption is ineffective in some cases when selecting the appropriate actions for the certain context if that context consists of many corresponding activities. In addition, CBR approach still confront the problems as lacking of cases, managing abundant cases in the contextaware applications which are highly scalable, open and computing capability limited. Under the observation, the cases in CBR have relationships to others, therefore, the eventual action not only retrieve from the most relevant case but also from the previous sequent cases. The remainder of this paper is organized as follows: Section II shows CCBR approach with the case management including the case index and case matching, the reasoning steps in CCBR from getting the raw data to inferring the eventual activity; Section III proposed the context aware system for smart home based on CCBR; Section IV proves that CCBR can solve the problems by analyzing action scenarios; Section V sums up and draws a conclusion.
Keywords- ubiquitous computing; context aware; smart home; case based reasoning
I.
INTRODUCTION
Along with the development of the network, portable and convenient computing devices have received more and more attention which conducts the emerging of Pervasive Computing, the concept proposed in 1991 by Mark Weiser [1]. Smart home, a specific example of ubiquitous computing, is an intelligent home capable of sensing the home’s occupants and their current state, and providing appropriate services to them [2]. The main target of smart home is to predict the requirements of users and actively provide the proper services by computing users’ situation with their context information. Therefore, context-awareness is one of the most important components in pervasive computing. In related works, Case-based Reasoning (CBR) is an approach method to be used in context-aware applications. CBR is such a problem solving technique that reuses previous cases and experiences to find a solution for current problems. There have been some other works [3, 4, 5, 6] using CBR in a wide variety of applications to reflect the effectiveness of this method. In ubiquitous computing and smart home, Tinghuai Ma et al. show the implementation based on CBR for Smart Home [7]. Yun Bai et al. proposed 978-0-7695-3580-7/09 $25.00 © 2009 IEEE DOI 10.1109/ACIIDS.2009.20
II.
CCBR: CHAINING CASE-BASED REASONING
In the context of CCBR, four important issues need to be addressed: the definition, case representation, case organization and case matching. A. Context In ubiquitous computing, the basic notion is context. Context might be considered as a collection of information which characterizes the interaction between a user and the application. Time, location, temperature, lighting, sound and activity are examples of contextual information or context. There exist various definitions of context. Shilit et al [9] define context as where you are, whom you are with, and what resources are nearby. They define context elements such as the Computing context, User context, and Physical context. Chen et al [10] define context as the set of environmental states and settings that either determines an application’s behavior or in which an application event
459 453
Authorized licensed use limited to: CHONNAM NATIONAL UNIVERSITY. Downloaded on February 4, 2010 at 12:10 from IEEE Xplore. Restrictions apply.
occurs and is interesting to the user. Chen et al. added the time context to the Shilt et al. definitions. Likewise, in our approach, the context information is converted to the high level context from raw data, and then can be simplified into a collection of numeric parameters. According to the above analysis, there may be different TV programs at different time and different devices in different rooms. Occupants’ habits are also different. So, the context in smart home can be classified into four dimensions: (1) time, (2) environment, (3) person and (4) activity. Beside four dimensions, to ensure the correct usage of “context information”, we divide context information into two types as follows: Independent context: the context information has no relationship to other contexts. Dependent context: the context information has more than one relationship to other contexts.
(a)
B. Definition of CCBR In CBR, the primary knowledge source is not generalized rules but a memory of stored cases recording specific prior episodes. Chaining case-based reasoning (CCBR) takes a very different view. CCBR reasoning is often modeled as a process that draws conclusions by chaining together generalized cases. The CCBR approach is based on two essential things of the world. The first thing is that the world is regular: similar problems have similar solutions. Consequently, solutions for similar prior problems are a useful starting point for new problem-solving. The second one is that the sequences of problems an agent encounters tend to reoccur. Consequently, future problems are likely to be similar to current problems. When two natural things meet, it is worthwhile to remember and reuse current reasoning: chaining case-based reasoning is an effective reasoning strategy. Traditional way to compute the similarity in CBR is called k-nearest neighbors. This method required that all the characters of a case are computable. For simplicity, we assume that the analysis is considered for a system whose behavior is modeled by rules of the form: If Chain of context Case THEN TAKE Action Figure 1 shows the tenet of CBR (1a) and CCBR (1b) problem-solving generates a new solution and then simultaneously activates the devices with predefined settings in smart home.
(b)
Figure 1. How CBR (a) and CCBR (b) problem-solving generates a new solution
Initially, the most distinguishing thing in CCBR is the relationship among cases. We use database to store the case, therefore, the database consists of five tables: case table, person table, case relationship table, environment table and activity table. The case table is the main table and can be expressed as follows: case = (caseID, personID, habited, environment information, time) relationship = (relationship ID, previous case, current case, solution ID, distance) appliance = (appliance ID, device, status) person =(id, name, status) activity = (solutionID, description, application actions string) caseID, personID, relationshipID, solutionID, applianceID are primary keys of case table, person table, relationship table, solution table, appliance table respectively. By joining the main table and the related tables, a final table that contains all attributes of those tables can be TABLE I.
CASE REPRESENTATION IN FRAME FORM
Type
Attribute
Value
Case
Person
C. Case management 1) The description of the case Smart Home infrastructure is constructed by many sensor motes collecting much context information like the temperature, humidity and illumination. There are many attributes of context data including people’ appearance, time, environment information as listed above. Table I illustrates the case representation in frame format. In our work, N/A is a new type of value which causes any attribute with value N/A is ignored when processing the reasoning. The case in this paper consists of time, person, environment, between the cases may have the relationships, each relationship has its own solution. 2) Context case index
Time Environment
ID Name Status Date Time Location Temperature Humidity Light
0001/0002/… Lee/Kim/All/N/A… In/Out Day at work/Day off Day/Night Bedroom/Living room Hot/Cool/Cold/N/A Strong/Weak Strong/Weak/Off
Solution (activity)
Action
ID Name [Air conditioner] [Light] [Curtain] [TV] [Humidifier]
0001/0002/… Sleeping/Wake-up Heating/Cooling/Off Strong/Weak/Off On/Off Sports/News/Movies/Off Strong/Weak/Off
454 460
Authorized licensed use limited to: CHONNAM NATIONAL UNIVERSITY. Downloaded on February 4, 2010 at 12:10 from IEEE Xplore. Restrictions apply.
task “doing the right thing in the right time”, the context aware system needs to know who is the person to be served and the time as well. Therefore, people and time elements play major roles in our searching mechanism. Smart home environment differs from others such as office or classroom in which the similarity function varies from classes like officers, managers in office or students, professors in classroom. In smart home, if we use similarity function for all cases, the best matching cases don’t always fit the current people at home. As mentioned in the previous sub section, the priority of each element decides the order of browsing when the context aware system executes the case matching algorithm. The elements as order in our approach are people, date, time, environment respectively and this order ensures that the smart home will do the right thing in the right time to the right people. The outline of the algorithm is given in Figure 3. The algorithm is inspired by the librarian works. Every time the new book request comes, the librarian easily traces the required book by browsing as the order of the category, year, author, language respectively. In CCBR, the best match sometimes is not a single case, but a combination of cases. In order to find the most matching cases, we browse every single attribute of the current context and find the appropriate group id fitting that attribute. For instance, current time is 7 a.m. and all of the cases with time value ‘7 a.m.’ will be retrieved. However, the storage of all possible values is impossible. To overcome this, we broaden the range of attribute to get the nearest cases in case there is no attribute value matching the current value. For example, 7 a.m. belongs to morning group in the ‘time’ attribute.
Figure 2. Index organization of context case with sample data
obtained. However, the case management is organized as the index structure for easily accessing. The caseID is made by combining the id of each attribute id. For example, the case (Lee, at work, morning, bright, high, high) has ID 010101010101. Figure 2 depicts the sample data of 4 databse tables: cases, relationship, activity, appliance status. The priority of each attribute in every single table is very important. This reflects the order of browsing when the context aware system executes the case matching algorithm in the later step. D. Case matching algorithm In traditional case based reasoning approach, simply, the best match is the first nearest neighbor of the current case. If high precision is required, the best match is a combination of the solutions, which represents a similarity tradeoff between the current case and previous cases. The majority choice is usually used for Boolean variables whereas linear combinations are chose for continuous variables. Instead of calculating the similarity function for all cases in the database, we search attribute-by-attribute to figure out the closest matching cases. Under our observation, to fulfill the
III.
SMART HOME CONTEXT-AWARE SYSTEM BASED ON CCBR
This section proposed the context-aware system based on CCBR. The system consists of four components as follows: pre-processing, context monitoring, context converter, context matching module and adaptation module. The infrastructure of the system is shown in Figure 4. A. Pre processing step, handling missing values The pre-processing of context data aims to facilitate later processes by recognizing the relevant context attributes, handling missing attributes and cleaning the data by, e.g., removing outliers. We define the range of the possible value, for example, the temperature never reaches under 0 degree Celsius or the minimum value of the air conditioner in the tropical region.
Pseudo-code Case Matching() { for each element of context information { if(find the group id matching element id) then extract the sub-data belong to that group continue the next element; else { if(find the parent group id satisfies element id) then extract the sub-data belong to that group continue the next element; else treat as N/A element id; } } return group of matching contexts; }
B. Context monitoring In our opinion, timing in context monitoring is eventdriven: systems only get their context information when some event occurs. This is usually the case when context information is discrete. An example of this is a context change caused by a person walking into a different room, or a mobile phone moving into a different cell. A non-discrete example is of a running program that has the available
Figure 3. Case matching algorithm
455 461
Authorized licensed use limited to: CHONNAM NATIONAL UNIVERSITY. Downloaded on February 4, 2010 at 12:10 from IEEE Xplore. Restrictions apply.
Raw contexts are informative data to be extracted from sensors or computing devices. Normal contexts are defined as normalized data having common data structure required by services. Higher-level contexts are generated from lowlevel contexts using the capabilities of context fusion. These higher level contexts are defined by requirements of services for providing intelligence. For example GPS-signals could be mapped into abstract locations such as at home, at work, in the living room, in the bedroom etc. D. Retrieving the solution In retrieving the solution, we consider some cases as follows: If the best suitable case can be found as applying the algorithm mentioned above, we continue to find the involving relationships to those best cases to retrieve the corresponding activity. If the best suitable case cannot be found or there is no relationship between the current case and the best case, we will find the best similar pair of case with the closest distance to the distance of the current case and the best case. The activity will be retrieved afterwards. Otherwise, the activity will be memorized as the action of the users. The algorithm and the operation of the solution retrieval method are illustrated in Figure 5 and Figure 6, respectively. In addition, the retrieval solution can be adopted through adaptation module as introduced in the later part.
Figure 4. Context-aware system based on CCBR
system memory as its context. In addition, context retrieval consists of periodic timing. At certain scheduled points in time the context information is retrieved or received. Thus, this is suitable for continuous context information. Context monitoring step attempts to detect changes in the user's and application's context and to respond to the changes. Similarity can then be calculated by measuring the correlation between two different context variables with respect to their ratings for an item. To do this, we used Pearson’s correlation coefficient, which measures the degree of linear components of relationship between two variables, also commonly used to measure similarity between context X and Y as follows:
E. Adaptation module Researching methods for model monitoring as well as researching how to use reinforcement learning methods to adapt the behavior of the systems/applications is a main task of context awareness. The context aware system is not standalone; instead, the reasoning process is just improved if getting the feedback from users. The static cases become meaningless unless they are updated regularly. The adaptation means developing a solution to find a best match set from the existent cases. One way to improve the case is to ask the user, and we admit that this will be sometimes needed. So, one extreme is to always ask the user and the other extreme is to never ask the user. We would like to emphasize that in reinforcement learning user feedback need not be explicitly asked for (i.e. the user needs not to press yes or no), but a more subtle approach to get the user feedback can be used: e.g., if the user is not satisfied with the choice made by the application, (s)he is more likely to return to the previous application view or to switch to a completely new one. One outstanding advantage in Smart Home is that the users can send their feedback to the system through Smart Home User Interface. Smart Home User Interface provides services manager view for control Context Aware System. As we access Smart Home UI on Web, we can catch it and manage service access control policy without condition if it is possible to access Internet. Smart Home UI has the following main functions: user management, information management of objects and home, service management for context, role management for user role as well as context
where are the standard score, sample mean, and sample standard deviation of the context data and finally this equation returns the relevance of two context values. C.
Convert raw data into high level context The raw data is called low-level context and the higher level contexts are combinations of lower level data sources. Pseudo-code Activity Retrieval() { if (find the most matching case in case database) then { if(relationship between current case and most matching case exists) then { return corresponding activity; } } compute the distance between current case and most matching case; find the most similar pair of case; return corresponding activity;
} Figure 5. Solution retrieval algorithm
456 462
Authorized licensed use limited to: CHONNAM NATIONAL UNIVERSITY. Downloaded on February 4, 2010 at 12:10 from IEEE Xplore. Restrictions apply.
earlier. After that, Mr. Lee goes to bed; the system calls the action “Sleep”, turned off everything so that the home occupants go to sleep for the next day work.” This scenario seems to be very simple but it is practically more complicated in the real situation. There are situations that the system needs to consider in order not to fail in "do the right thing", for example: The decision involving the TV and curtains depends on many elements in the situation. In the next sub-section, we will show how to model this smarthome domain based upon our proposed context model. B.
Implementations and Achievements To probe the feasibility of the suggested CCBR, we implemented in Windows OS, VS.NET 2005 development environment. Empirically, .NET Framework has ADO.NET mechanism to access the database and DataSets, a component in ADO.NET, is the reason why we choose .NET for our implementation [11]. DataSets are powerful data structures with the capability of allowing the programmer to treat them as in-memory databases. In the attribute-byattribute browsing step in matching algorithm, it is required to query on the current retrieved data. We can solve it by loading the data into an array but this work is cumbersome. Instead, we solve the problem in querying Database as an InMemory Database by using DataSets and ADO.NET. After reading the whole database into a DataSet, we just do all your queries in memory through the DataTable Select call. Then, as a result, the most matching case retrieved through matching process reveals the corresponding activity. The snapshot of source code in C# illustrates this technique shown in Figure 7. From the above scenario, we can identify the cases and the relationships among them. In the realization of context aware system based on CCBR in smart home, database is used to store cases. Case is organized into related tables with the structure mentioned in Section II. The operation starts from case retrieving, to case reusing and to case storage. The original data is generated by sensors. After sensor data is structured, similarity can be calculated. The best match set is retrieved from case database. The context reasoning component finds the relationship between the current context and other previous contexts. The series of the contexts prior to the event “Mr. Lee sits on the sofa” decides the corresponding actions. The reasoning component using CCBR is integrated toin to Interactive Smart Home Simulator, our lab’s current project which aims to simulate the smart home environment [12]. To solve the issue related to Smart Home UI, we also built the user interface in virtual smart home in order that home habitants are able to modify the solution. Smart home system uses one of the candidate solutions to set the TV channel, AC temperature and light brightness. If users adjust TV channel, AC temperature and light brightness, the case will adopt the input values as users’ revising, thus, case adaptation is achieved. The screenshot of achievement acquired with interactive smart home simulator is shown in Table II.
Figure 6. Activity retrieval process
role, and virtual service request for checking policy operating on middleware. IV.
SCENARIO AND IMPLEMENTATIONS
A. Application scenario “For instance, Mr. Lee and Mrs. Lee, living in smart home. Mr. Lee comes home at 8 p.m. after work. When he sits on the sofa, , the smart home system automatically invokes the action “Entertainment”, which consists of turning on the TV and switch the air conditioner to the appropriate mode corresponding to the current weather. Sometimes, Mr. Lee comes home late and goes to his studying room to continue his work. During his work, he goes out and sits on the sofa to brainstorm. Instead of calling the action “Entertainment” at 7 p.m., the system just call “Normal” which just turn on the air conditioner. When Mr. Lee goes to bed, the smart home calls the action” Rest”, which opens the curtain and turn on the air conditioner. However, Mrs. Lee usually goes back home and goes to bed // The following source code illustrates the memory query on a particular database table public DataSet MemoryQuery(DataSet dsInput, string strTableName, string strFilter, string strSortCriteria){ // construct an empty result database to return DataSet dsResult = new DataSet(); // Filter and sort all the rows we are interested in by calling a Select on the database DataRow[] rows = dsInput.Tables[strTableName].Select(strFilter, strSortCriteria); // clone the existing table structure and clear it out and import the data rows resulting from the query into the result dataset DataTable copyTable = dsInput.Tables[strTableName].Clone(); copyTable.Rows.Clear(); // add the table result dsResult.Tables.Add(copyTable); foreach (DataRow dr in rows) { dsResult.Tables[0].ImportRow(dr); } return dsResult; }
Figure 7. A snapshot of C# source code processing in-memory database
457 463
Authorized licensed use limited to: CHONNAM NATIONAL UNIVERSITY. Downloaded on February 4, 2010 at 12:10 from IEEE Xplore. Restrictions apply.
V.
[2]
Sei J., "Research Activities on Smart Environment”, The Institute of electronics engineers of Korea Journal, pp. 1359-1371, December 2001. [3] L. D. Xu, “Case based reasoning for AIDS Initial Assessment,” in Proc.of the 1993. IEEE Int. Conf. Systems science and systems engineering. [4] W.C. Chen, “A framework of features selection for the case based reasoning,” in Proc. of IEEE Int. Conf. Systems, Man, and Cybernetics,2000. [5] W.J. Yin and M. Liu, “A genetic learning approach with case based memory for job-shop scheduling problems,” in Proc. of the first Int.Conf. Machine learning and cybemetics, Beijing, 2002, pp. 1683– 1687. [6] D. Grosser, H. A. Sahraoui and P. Valtchev, “An analogy-based approach for predicting design stability of Java classes” in Proc. of 9 Int. Software Metrics Symposium (METRICS’03), Sydney Australia, 2003, pp. 252–262. [7] Tinghuai Ma, Yong-Deak Kim, Qiang Ma, Meili Tang, Weican Zhou, "Context-Aware Implementation based on CBR for Smart Home ", WiMob 2005, Canada [8] Yun Bai, Juan Yang, Yuhui Qiu, “OntoCBR: Ontology-based CBR in Context-aware Applications”, MUE 2008, Korea [9] Schilit, B., Adams, N., and Want, R., “Context aware computing applications”, Mobilie Computing Systems and Applications, pp. 8590, 1994. [10] Chen, H.: An Intelligent Broker Architecture for Pervasive ContextAware Systems. PhD Thesis, (2004) [11] Atul Adya, José A. Blakeley, Sergey Melnik, S. Muralidhar, and the ADO.NET Team, Anatomy of the ADO.NET Entity Framework, SIGMOD’07, June 11–14, 2007, Beijing, China. [12] Tam Van Nguyen and Deokjai Choi, “Development of a Context Aware Virtual Smart Home Simulator”, in Proc. of ICUT’08, December 18-20, 2008, Ho Chi Minh City, Vietnam
CONCLUSION
In this paper, we have introduced CCBR method, a simple but reliable approach to solve the limitation problem of the traditional CBR method. We also analyze the advantages when using this approach for a smart home. In addition, we proposed the context-awareness framework based on CCBR and the implementation in a virtual smart home environment. However, our work bases on the improvement of the basic assumption in CBR. Thus, this work just strengthens the CBR approach and shows the effectiveness in some cases. Though the achievements are relatively promising, further experiments are required to confirm them. In the implementation part, our test-bed for smart home is only concept and virtual environment. But rapid development of hardware, software and the emerging ubiquitous paradigm make it possible to realize a transition from virtual space to real space. Hence, in future works, we plan to evaluate this approach and integrate this reasoning component to the real experiment room that we already built. Also, we plan to apply CCBR for uncertainty reasoning, an inevitable problem that we have to face in ubiquitous computing
th
ACKNOWLEDGMENT The authors would like to thank the BK21 Project of Korea and the anonymous reviewers for useful comments. REFERENCES [1]
M. Weiser, “the Computer for the 21st Century”, American Science, 1991, pp.3-9. TABLE II.
Situation
REASONING RESULTS WITH CCBR-INTEGRATED INTERACTIVE SMART HOME SIMULATOR
Mr. Lee goes home and sits on the sofa
Mr. Lee works first and then sits on the sofa TV: OFF
Reasoning result
TV ON
AC IN LIVINGROOM : ON
AC IN LIVING ROOM: ON
CURTAIN IN STUDYING ROOM: ON AC IN STUDYING ROOM: ON
Situation
Mr. Lee goes to bed
Mr. Lee goes to bed after Mrs. Lee
Reasoning result
AC IN BEDROOM: ON
AC IN BEDROOM: ON
CURTAIN IN BEDROOM: OPEN
CURTAIN IN BEDROOM: CLOSE
458 464
Authorized licensed use limited to: CHONNAM NATIONAL UNIVERSITY. Downloaded on February 4, 2010 at 12:10 from IEEE Xplore. Restrictions apply.