# Modeling and Reasoning of Contexts in Smart Spaces Based on Stochastic Analysis of Sensor Data +
## 5 Experimental Validation
We obtained \(11\) testing sensor datasets and generated \(11\) context schedules \(\mathbf{C_{S}}\) using our reasoning process. We then evaluated the \(11\)\(\mathbf{C_{S}}\) and proved that they could be discovered in \(\mathbf{C_{G}}\). For a more accurate evaluation, we proposed the following conditions and proved that they all were met in order:  
**Condition 1**. : \(|\mathbf{C_{S}}|\geq 2\)_, where \(|\mathbf{C_{S}}|\) stands for the number of elements \((\)that is contexts\()\) in the set \(\mathbf{C_{S}}\)._  
Condition 1 allows us to filter out cases of single contexts in which there is no transition of contexts; thus, the reasoning approach fails to find another context. In this case, a daily living scenario starts and ends in the same context without any transitions. This is considering the fact that the reasoning approach does not work properly. In our experiment, there was no testing sensor dataset that could not pass this condition. However, this does not guarantee that \(\mathbf{C_{S}}\) is feasible, even though it consists of more than two contexts, and thus passes this condition. This condition is not enough to catch exceptionally occurring contexts, which may be accidentally sensed by sensor errors. For this reason, \(\mathbf{C_{S}}\) needs to satisfy the next condition:  
**Condition 2**. : \(\mathbf{P_{CS}}(\mathbf{C_{S}})\geq\mathbf{OPT}\)_, where \(\mathbf{P_{CS}}(\mathbf{C_{S}})\) stands for the occurrence probability of a given context schedule \(\mathbf{C_{S}}\), and \(\mathbf{OPT}\) is threshold of the occurrence probabilities._  
Condition 2 restricts to accept only the most likely occurring context schedules \(\mathbf{C_{S}}\). This proceeds with context graph \(\mathbf{C_{G}}\), which was made in the preparation step. Recall that \(\mathbf{C_{G}}\) is built in a directed graph, which describes all transitions between contexts. This means that \(\mathbf{C_{G}}\) can reveal various context paths, each of which is considered a \(\mathbf{C_{S}}\). Each \(\mathbf{C_{s}}\) is evaluated by its probability of occurrence, denoted by \(\mathbf{P_{CS}}(\mathbf{C_{S}})\). Note that the low probability of occurrence of an event means that it rarely or never occurs. Thus, we can infer that a \(\mathbf{C_{S}}\) with a low probability rarely occurs and, hence, it should rarely be reasoned. The _Fidelity_ and the _Feasibility_ of \(\mathbf{C_{S}}\) is measured based on the probability. For this goal, statistic models were defined as follows: First, we calculated the join probability  
Figure 5: In our experiment, there were 19 sensors (indexed by Q#) deployed in the Gator Tech Smart house (GTSH). These sensors were attached to 18 objects (indexed by Q#). distribution of \(C_{S}\) based on use of the Bayesian network (BN) and conditional probability table for contexts. BN-based probability \(P_{BN}\) of \(C_{S}\) is computed by Equation (9):  
\[P_{BN}(C_{S})=\prod\
olimits_{C_{i}C_{j}\in C_{S}}P(C_{i},C_{j}) \tag{14}\]  
In Equation (9), \(P(C_{i},C_{j})\) calculates the conditional probability of two distinct contexts, \(C_{i}\) followed by \(C_{j}\). \(P_{BN}(C_{S})\) presents the probability for occurrence of a given \(C_{S}\); however, it is not enough to measure the _Fidelity_ and the _Feasibility_. Even if a \(C_{S}\) has a high occurrence probability but it rarely occurs, it could be considered as an exception or an error, and thus should have a low _Fidelity_. To resolve this, _Odds_ for \(C_{S}\) is calculated by Equation (10). \(P(C_{S})\) stands for the probability of a \(C_{S}\), and denotes how often the \(C_{S}\) occurs. In this experiment, it can be computed by the frequency of occurrence of a \(C_{S}\) over 11, the number of total training (or testing) cases. \[O_{BN}(C_{S})=\frac{1-P(C_{S})}{P(C_{S})} \tag{15}\]  
The \(P_{BN}(C_{S})\) and the \(O_{BN}(C_{S})\) are used for computing occurrence probability, \(P_{CS}(C_{S})\). \(P_{CS}(C_{S})\) is used for determining _OPT_. _OPT_ is obtained by calculating an arithmetic average of \(P_{CS}(C_{S})\) for all given \(C_{S}\).