# Surveying Human Habit Modeling and Mining Techniques in Smart Spaces
## 5 Model Types  
Knowledge is represented in AmI systems using models. The literature about representing models of human habits is wide. In this section, we will review the most adopted approaches, highlighting those formalisms that are human understandable, thus, being easy to validate by a human expert or by the final user (once the formalism is known). Bayesian classification techniques are based on the well known [PERSON] theorem \(P(H|X)=\frac{P(X|H)P(H)}{P(X)}\), where \(H\) denotes the hypothesis (e.g., a certain activity is happening) and \(X\) represents the set of evidences (i.e., the current value of context objects). As calculating \(P(X|H)\) can be very expensive, different assumptions can be made to simplify the computation. For example, _naive Bayes_ (NB) is a simple classification model, which supposes the \(n\) single evidences composing \(X\) independent (that the occurrence of one does not affect the probability of the others) given the situational hypothesis; this assumption can be formalized as \(P(X|H)=\prod_{k=1}^{n}P(x_{k}|H)\). The inference process within the naive Bayes assumption chooses the situation with the maximum a posteriori (MAP) probability. Hidden Markov Models (HMMs) represent one of the most widely adopted formalism to model the transitions between different states of the environment or humans. Here hidden states represent situations and/or activities to be recognized, whereas observable states represent sensor measurements. HMMs are a statistical model where a system being modeled is assumed to be a Markov chain, which is a sequence of events. A HMM is composed of a finite set of hidden states (e.g., \(s_{t-1}\), \(s_{t}\), and \(s_{t+1}\)) and observations (e.g., \(o_{t-1}\), \(o_{t}\), and \(o_{t+1}\)) that are generated from states. HMM is built on three assumptions: (i) each state depends only on its immediate predecessor; (ii) each observation variable only depends on the current state; and (iii) observations are independent from each other. In a HMM, there are three types of probability distributions: (i) prior probabilities over initial state \(p(s_{0})\); (ii) state transition probabilities \(p(s_{t}|s_{t-1})\); and (iii) observation emission probabilities \(p(o_{t}|s_{t})\). A drawback of using a standard HMM is its lack of hierarchical modeling for representing human activities. To deal with this issue, several other HMM alternatives have been proposed, such as _hierarchical_ and _abstract_ HMMs. In a hierarchical HMM, each of the hidden states can be considered as an autonomous probabilistic model on its own; that is, each hidden state is also a hierarchical HMM. HMMs generally assume that all observations are independent, which could possibly miss long-term trends and complex relationships. _Conditional Random Fields_--CRFs, on the other hand, eliminate the independence assumptions by modeling the conditional probability of a particular sequence of hypothesis, \(Y\), given a sequence of observations, \(X\); succinctly, CRFs model \(P(Y|X)\). Modeling the conditional probability of the label sequence rather than the joint probability of both the labels and observations \(P(X,Y)\), as done by HMMs, allows CRFs to incorporate complex features of the