# Maintenance Prediction through Sensing Using Hidden Markov Models--A Case Study
## 2 Theoretically Background
### Hidden Markov Models (HMM)  
Hidden Markov Models (HMMs) started to be introduced around the 1970s, with the publications of [PERSON] [48] and Baum & Petrie [49], and later became quite popular in the late 1980s with the contribution of [PERSON] [50]. Currently, the HMM is a statistical modeling tool that has become popular in several areas, such as speech processing, DNA recognition, weather forecast, machine maintenance, pattern identification, and health monitoring. HMMs are based on a doubly stochastic process, in which an underlying stochastic process that develops as a Markov chain produces an unobservable (\"hidden\") state, which can be inferred only through another set of stochastic processes [51]. Therefore, an HMM is a stochastic technique for modeling signals that evolve through a finite number of states. States are considered hidden and responsible for producing observations [4; 6]. A typical notation used for HMM is  
* \(N\)--Number of states \begin{table}
\begin{tabular}{l}
**INPUT:**\(X\epsilon\)\(R^{n\star d}\) \\
**OUTPUT:**\(Y\epsilon\)\(R^{n\star k}\) \\
**1:**CONSTRUCT THE COVARIANCE MATRIX (\(X.X^{t}\)) \\
**2:**APPLY LINEAR EIGEN DECOMPOSITION \(X.(X^{t})\)TO OBTAIN EIGEN VALUES \\
**AND VECTORS;** \\
**3:**SORT EIGEN VALUES IN DECREASING ORDER TO SORT EIGEN VECTORS \\
**4:**BUILD MATRIX \(W(D^{t})\) WITH KTO EIGEN VECTORS \\
**5:**TRANSFORM \(X\) USING \(W\) TO OBTAIN THE NEW SUBSPACE Y=X.W \\ \end{tabular}
\end{table} 
Table 1: PCA algorithm steps. * \(M\)--Number of observations
* \(T\)--Observation sequence length
* Sequence of observations up to T is presented as:
* \(O_{1},O_{2},O_{3},\ldots,O_{T}\) with \(O_{t}\in\{V_{1},V_{2},V_{3},\ldots,V_{M}\}\)
* Corresponding status sequence is displayed as: \(\Circle\)\(Q_{T}=\{q_{1},q_{2},q_{3},\ldots,q_{T}\}\) with \(q_{t}\in\{S_{1},S_{2},S_{3},\ldots,S_{N}\}\)
* is a representation of an HMM model \(A\)--Transition probability matrix between hidden states \[A=\{a_{ij}\},1\leq i,j\leq N\] (4) where:
* \(a_{ij}=P\) and \(q_{t}\) represents the hidden state at time \(t\)
* \(B\)--Emission Probability Matrix \[B=\{b_{j}(k)\}(1\leq j\leq N)\] (5)
* \(\pi\)--initial state probability distribution \[\tau_{i}=P(q_{t}=S_{i})\] (6) where the observations are issued from each state according to the probability distribution \[b_{j}(k)=P\big{(}O_{k}\lor q_{t}=S_{j}\big{)},\text{ it's}\] (7)  
An HMM has several hidden states (\(N\)), an initial probability value (\(\pi\)) for each state, a transition probability matrix (\(A\)) indicating the probability of transition from one hidden state to another, and a probability matrix of transition (\(B\)) which indicates the probability of an observation given a certain hidden state. The sum of all initial probabilities must be equal to 1, as well as the sum of all elements in a row in the transition and issue probability matrix [50]. According to [PERSON] [50], there are three basic HMM problems:  
Problem 1--This is an evaluation problem, where, given a sequence of observations \(O=\{O_{1};O_{2};O_{3};\ldots;O_{T}\}\) and the model \(\lambda=(A,B,\pi)\), it allows to efficiently to calculate the associated probability to the \(P(O\lor\lambda)\) emission sequence. Problem 2--This is a decoding problem, which consists of finding the most likely sequence of hidden states given the sequence of observed emissions \(O=\{O_{1};O_{2};O_{3};\ldots;O_{T}\}\) and the model \(\lambda\), namely, how to find a corresponding sequence of states \(S=\{S_{1};S_{2};S_{3};\ldots;S_{T}\}\). Problem 3--This is about to know a database of sequences and how to adjust the parameters of the model \(\lambda=(A,B,\pi)\) in order to maximize \(P(O\lor\lambda)\). The solution for Problem 1  
To solve the first problem, the forward and backward algorithms must be used.