# Modeling and Reasoning of Contexts in Smart Spaces Based on Stochastic Analysis of Sensor Data +
## 3 Design of Context Model
### Context Model
#### 3.1.2 Context  
Context is a meaningful state space, which is representative enough to describe what is happening in the space [13]. In a context model, it is important to determine which sensors are related, and which sensor status is required. Suppose that we are reasoning a context, \"making breakfast\", in a kitchen in which an electric stove, microwave, refrigerator, spoons, knives, ceiling light, and windows are placed. The sensors attached to the objects will change their status when the corresponding objects are used. Recall that any change in sensor status triggers the state space and generates a different one. In the kitchen, many state spaces may be generated; however, some of them will not be related to the context. For instance, the ceiling light and windows are not needed to make breakfast; thus, state spaces triggered by sensors attached to them are not meaningful for that context. It can be recognized that the context only begins, or is in progress, if state spaces are triggered by the sensors attached to cooking tools, such as an electric stove, microwave, refrigerator, spoons, and knives. To reason a context, however, a sufficient number of relevant sensors  
Figure 1: State spaces \(\hat{S}\) describes all states of a given daily living scenario in order. Note that each state space indicates the status of every individual sensor. Contexts \(\hat{C}\) are defined as meaningful and representative states out of \(\hat{S}\).  
are triggered. In the example, it is hard to reason the context if one touch sensor attached to a refrigerator is triggered since the refrigerator can be touched only for drinking water. The state space generated by this sensor event is not representative; hence, it will be ignored. As shown in Figure 1, brown-colored state spaces with enough information are considered contexts, while others remain normal state spaces. Thus, it is critical to locate all sensors that contribute to modeling and reasoning a context. Once a context is chosen, the state spaces after it belong to the context since the context lasts until a new context begins.  
Context has a fundamentally identical structure to state space \(\boldsymbol{S}\) since it is a selected \(\boldsymbol{S}\), which is a collection of sensor statuses, as follows:  
\[\boldsymbol{C}=\left\{\boldsymbol{s_{1}},\ \boldsymbol{s_{2}},\ldots, \boldsymbol{s_{i}},\ldots,\boldsymbol{s_{\omega}}\right\} \tag{3}\]  
Note that sensors that are not relevant to any context will be ignored. These sensors have a null state value, so they will not be considered in the reasoning process.  
As a multitude of contexts can be selected from a collection of state spaces \(\boldsymbol{\hat{S}}\), the collection of the contexts is noted by Equation (4):  
\[\hat{\boldsymbol{C}}=\left\{\boldsymbol{C}_{1},\boldsymbol{C}_{2},\ldots, \boldsymbol{C}_{\rho},\ldots,\boldsymbol{C}_{\eta}\right\} \tag{4}\]  
In Equation (4), the total number of contexts is \(\boldsymbol{\eta}\), and the present context is denoted by \(\boldsymbol{C}_{\rho}\). As contexts are selected from the collection of state spaces \(\boldsymbol{\hat{S}}\), the collection of contexts \(\boldsymbol{\hat{C}}\) is a subset of \(\boldsymbol{\hat{S}}\) (\(\hat{\boldsymbol{C}}\subseteq\boldsymbol{\hat{S}}\)), which infers that \(\boldsymbol{\eta}\leq\boldsymbol{\zeta}\). The status of these sensors in a given context is considered as a condition for being the context since it distinguishes itself from non-context state spaces or other contexts. In other words, when the sensors in a given state space have the same status for the corresponding sensors in a target context, it is said that the state space represents a context.