# Applying Knowledge Inference on Event-Conjunction for Automatic Control in Smart Building
## 4 Proposal and Experiment
### Inference Engine  
The inference engine combines the ontology and sensor observations to keep detection of events inside the building. Sensor or device nodes change their states according to user activities as well as their motion trajectories. The events that could be inferred by sensor observations have been classified into two types: deterministic and probabilistic. Therefore, a hybrid graphical model was chosen to implement the inference engine. Two different methods including probabilistic and deterministic were used. Those are Bayesian Network (BN) and Finite State Machine (FSM), shown in Figures 6 and 7, respectively. **Finite state machine (FSM)**. Finite state machines are suitable to describe the state logic of observations on deterministic sensor values. As described above, the elevator has been modeled as Zone entity in our ontology model. It works for transporting users in the vertical dimension of the building. In general, elevator moves with a constant  
Figure 5: (a) The triple value examples of our data store, using the turtle format of RDF metadata; (b) SPARQL query example of our proposal. Figure 6: The FSM model for presenting the state transition of elevator. Figure 7: An intuitive example shows the Bayesian network. moving speed (\(T_{moving}\)) and several deterministic states. Therefore, finite state machines are suitable to describe the state logic of observations on elevator's moving. As shown in Figure 6, a graph model of FSMs was used to implement the state transition of the elevator. The details of parameters description were listed in Table 2.  
In essence, the elevator changes its states according to passengers' activities and requests. Thus, the simultaneous state-mapping on users and elevator has been clarified as shown in Figure 8. According to the predefined state transition of both the elevator and users, the following event patterns could be elaborated: (1) while the elevator was moving for picking-up, the user remains to wait at the departure floor; (2) while the elevator was transporting, the user was riding on the cabin for heading to the destination floor; (3) while the elevator was boarding for picking-off, that means the user had arrived at the destination floor. **Byesian network (BN)**. On the other hand, a few of events with high-level semantics were inferred based on the conjunction of multiple correlated events. Graphical dependencies among these event and sensor data observations in both the spatial and temporal dimensions could be observed. A probabilistic graphical model has been proposed based on the conditional inference on two correlated events. For example, there are bidirectional effects on both the use of elevator and room-occupancy event (namely that when the user leaves the room, he/she would call the elevator to move to another floor; when the elevator comes to the floor for picking-off users, an event that user enters the room might happen). In this proposal, Bayesian network (BN) was utilized for modeling the probabilistic graph on these conditional events inside the building. As the probabilistic state transitions shown in Figure 7, let \(P_{e}|(s_{i},S)\) denotes the probability of estimated event based on the sensor observation of \(s_{i}\) on the overall observations of \(S\). The sensor observation \(s_{i}\) was denoted as the tuple values \(<\  
Markov Chain Monte Carlo (MCMC) Sampling Process  
One of the main challenges in this inference engine is the probabilistic modeling on \(\Delta t\). The graph needs to capture the probability based on the statistical analysis of time intervals. As shown in Equation (1), the Bayesian paradigm (so-called Bayes theorem) was deployed to express the relation between three terms: a prior knowledge, a likelihood (the knowledge coming from the observation), and a \"posterior\" (the updated knowledge). Meanwhile, it can be noticed that one of the main difficulties faced when dealing with a Bayesian inference problem comes from while the size of posterior samples is not enough to converge.