# Novel Semantic-Based Probabilistic Context Aware Approach for Situations Enrichment and Adaptation
## 4 Proposed Approach
### Recommendation Process of Situation Rules
#### 4.2.2 Bayesian-Classifier Approach  
The main idea of the proposed approach is to use Bayesian classifier to evaluate rules according to current situation context after classifying them in groups using situation multidimensional model. The Bayesian approach is one of the most frequently used classification methods. It considers flexibly uncertain context through ontology model and enables us to adapt to the changing context. For instance, the _situation (home, weekday, morning, citizen)_ can be represented as a class. The situation context classification can be done on four dimensions. These dimensions are defined as follows:  
* **Location:** The user's location has the possible values (Home, University, Office and Outdoors). * **Day:** The days have the possible values (Weekday and Weekend). **Time:** The time has the possible values (Morning, Afternoon, Evening and Night.) and,
* **Role:** The user's role has the possible values (Citizen, Student, Worker and Driver). As it can be seen, _day_ and _time_ dimensions are applicable to all smart domains, whereas _role_ is suited to specific smart domains (e.g., _Home_, _University_, _Office and Car_). Since Cartesian product for the 4-dimensions, _location_\(\times\)_day_\(\times\)_time_\(\times\)_role_, equal to \(4\times 2\times 4\times 4=128\)_classes_ has been covered, all possible probability of classes can be calculated. This probability should not depend merely on the user's location (_home_, _university_, _office and outdoors_) of a tag, even if that location is large enough and the tag is associated with numerous locations. Additional dimensions which should also be considered are _day_ and _time_. The role dimension is introduced to determine the role of user. In this case, values of the _role_ denote greater importance in determining probability of a rule item for a certain class. Other key tags that need to be considered are the value of the \"Filed and sub-Field\" of each rule item, as it cannot only be used to identify relevant or irrelevant item rules but also to balance the aforementioned role values. For instance, if we considered the class \(C_{i}=(\textit{home}\), _weekend_, _evening_, _citizen_), then we can compute the probability of a rule item \(\overrightarrow{x}\) of a given class \(C_{i}\), as defined in Equation (5). \[ \begin{array}{c}P(C_{j}|\overrightarrow{x})=P(\overrightarrow{x}|C_{j})\ P \big{(}C_{j}\big{)}/P\Big{(}\overrightarrow{x}\Big{)}\\ P\Big{(}\overrightarrow{x}\ |C_{j}\Big{)}=\prod_{i=1}^{4}P(f_{i}|C_{j})\\ P\big{(}C_{j}\big{)}=k(C_{j})/T\\ P\Big{(}\overrightarrow{x}\Big{)}=\sum_{j=1}^{k}P\Big{(}\overrightarrow{x}|C _{j}\Big{)}P(C_{j})\\ P\big{(}f_{i}|C_{j}\big{)}=\frac{n\big{(}f_{i}\ C_{j}\big{)}+0.5}{n\big{(}C_{ j}\big{)}+0.5|V_{j}|}\end{array}  \tag{5}\]  
where  
* \(f_{i}\) represents the \(i\)th tag _of_\(\overrightarrow{x}\). * \(k(C_{j})\) represents the total number of users that has used the situation rules in \(C_{j}\). * \(T\) represents the total number of rules in situation rules repository. * \(n\big{(}f_{i},\ C_{j}\big{)}\) represents number of tag \(f_{i}\) appears in \(C_{j}\). * \(n\big{(}C_{j}\big{)}\) represents the sum of all tags appear in \(C_{j}\). * \(|V_{i}|\) represents the total number of tags appearing in \(C_{j}\). For example, we can calculate the probability of adding a rule item (house security's field) in an outdoors repository on a weekday. At last, the final score of the rule item will be measured using both content-based approach and Bayesian-classifier approach. The final score of the proposed recommendation process is calculated by the weighted linear combination as defined in Equation (6). \[ \begin{array}{c}Score=W_{EP}\times Sim_{EP}+W_{IP}\times Sim_{IP}+W_{S} \times\ P(C_{j}|\overrightarrow{x})\end{array}  \tag{6}\]  
where  
* \(W_{EP}\) is assigned to explicit similarity \(0\leq\ W_{EP}\leq 1\). * \(W_{IP}\) is assigned to implicit similarity \(0\leq\ W_{IP}\leq 1\). * \(W_{S}\) is assigned to situation probability similarity \(0\leq\ W_{S}\leq 1\). * \(W_{EP}+W_{IP}+W_{s}=1\).