Definitions

# Hidden Markov model

A hidden Markov model (HMM) is a statistical model in which the system being modeled is assumed to be a Markov process with unknown parameters, and the challenge is to determine the hidden parameters from the observable parameters. The extracted model parameters can then be used to perform further analysis, for example for pattern recognition applications. An HMM can be considered as the simplest dynamic Bayesian network.

In a regular Markov model, the state is directly visible to the observer, and therefore the state transition probabilities are the only parameters. In a hidden Markov model, the state is not directly visible, but variables influenced by the state are visible. Each state has a probability distribution over the possible output tokens. Therefore the sequence of tokens generated by an HMM gives some information about the sequence of states.

Hidden Markov models are especially known for their application in temporal pattern recognition such as speech, handwriting, gesture recognition, part-of-speech tagging, musical score following, partial discharges and bioinformatics.

## Architecture of a hidden Markov model

The diagram below shows the general architecture of an instantiated HMM. Each oval shape represents a random variable that can adopt a number of values. The random variable $x\left(t\right)$ is the hidden state at time $t$ (with the model from the above diagram, $x\left(t\right) in \left\{x_1, x_2, x_3\right\}$). The random variable $y\left(t\right)$ is the observation at time $t$ ($y\left(t\right) in \left\{y_1, y_2, y_3, y_4\right\}$). The arrows in the diagram (often called a trellis diagram) denote conditional dependencies.

From the diagram, it is clear that the value of the hidden variable $x\left(t\right)$ (at time $t$) only depends on the value of the hidden variable $x\left(t-1\right)$ : the values at time $t-2$ and before have no influence. This is called the Markov property. Similarly, the value of the observed variable $y\left(t\right)$ only depends on the value of the hidden variable $x\left(t\right)$ (both at time $t$).

## Probability of an observed sequence

The probability of observing a sequence $Y=y\left(0\right), y\left(1\right),dots,y\left(L-1\right)$ of length $L$ is given by

$P\left(Y\right)=sum_\left\{X\right\}P\left(Ymid X\right)P\left(X\right),$

where the sum runs over all possible hidden node sequences $X=x\left(0\right), x\left(1\right), dots, x\left(L-1\right)$. Brute force calculation of $P\left(Y\right)$ is intractable for most real-life problems, as the number of possible hidden node sequences is typically extremely high. The calculation can however be sped up enormously using the forward algorithm or the equivalent backward algorithm.

## Using hidden Markov models

There are three canonical problems associated with HMM:

• Given the parameters of the model, compute the probability of a particular output sequence, and the probabilities of the hidden state values given that output sequence. This problem is solved by the forward-backward algorithm.
• Given the parameters of the model, find the most likely sequence of hidden states that could have generated a given output sequence. This problem is solved by the Viterbi algorithm.
• Given an output sequence or a set of such sequences, find the most likely set of state transition and output probabilities. In other words, discover the parameters of the HMM given a dataset of sequences. This problem is solved by the Baum-Welch algorithm.

### A concrete example

This example is further elaborated in the Viterbi algorithm page.

## History

Hidden Markov Models were first described in a series of statistical papers by Leonard E. Baum and other authors in the second half of the 1960s. One of the first applications of HMMs was speech recognition, starting in the mid-1970s.

In the second half of the 1980s, HMMs began to be applied to the analysis of biological sequences, in particular DNA. Since then, they have become ubiquitous in the field of bioinformatics.