The main idea is that there is a Markov chain operating in the background, but we cannot directly observe the states of this chain. Instead we observe a random variable which is correlated with the state, but does not uniquely identify it. We may wish to infer the actual state from the observed state, but we cannot do this with 100% certainty.
10.4.1 The cheating casino
Here is a simple example. A casino uses two kinds of dice. One type is fair, the other is biased with probability 1/2 to come up 6, and equal probabilities for the other values. The casino secretly switches between the two types of dice. Suppose they switch from fair to biased with probability 0.01 before each roll, and switch from biased to fair with probability 0.5. You (the player) do not know which dice are being used, you only see the rolls of the dice.
This is a hidden 2-state Markov model. The two states are the types of dice. The observed rolls occur with different probabilities depending on the current state. You may wish to figure out which dice were used based on the observed sequence of rolls. This is called ‘decoding’ the state sequence from the observation sequence.
10.4.2 Formal definition
The HMM consists of
an underlyingN-state ergodic Markov chainX0, X1, . . . with transition
matrix T (ergodicity is not essential but simplifies the analysis) for each underlying state, a conditional probability distribution for the
M possible observations v1, . . . , vM:
bj(k) = P(v =k|X =j), j = 1, . . . , N, k = 1, . . . , M (424) an initial probability distribution for X0
With this you can in principle compute the probability of any particular sequence of observations.
10.4.3 Applications
Here are two applications. First, in speech recognition: a speech signal is divided into frames (approx 20 ms long). Each frame is assigned to one of a pre-determined set of possible categories. The speech signal is then a long sequence of these categories. The task is to figure out the underlying sequence of words which produced the observed signal. Randomness arises through variations in the sounds uttered and in the time taken to say the words. Second, in DNA sequence analysis: the sequence consists of the 20 amino acids, while the underlying structure is the protein family. Variations arise from insertions and deletions in the protein sequences.
Given a particular HMM, we want to find the likelihood of an observed sequence (for example to compare different parameter values or models). This is done using the forward-backward procedure.
10.4.4 The forward-backward procedure
LetY = (y0, y1, y2, . . . , yn) be the observed sequence, and letX = (X0, X1, . . . , Xn) be an underlying chain sequence. Then
P(Y) = X X P(Y |X)P(X) = X j1,...,jn bj1(y1)· · ·bjn(yn)πj0pj0,j1· · ·pjn−1,jn
where πj =P(X0 =j) is the initial distribution. The number of operations
here scales as Nn, so we need a more efficient method than direct computa- tion.
For all 0≤m≤n define the forward joint probability
αm(j) = P(Y0 =y0, Y1 =y1, . . . , Ym =ym, Xm =j) (425) Note that
α0(j) = P(Y0 =y0, X0 =j)
= P(Y0 =y0|X0 =j)P(X0 =j)
Also we have an induction rule: αn+1(j) = X i αn(i)pij bj(yn+1) (426) Exercise 114 Derive (426).
Finally we get our desired probability as
P(Y) =X j
αn(j) (427)
Note that each step in (426) needs only N2 operations, so this is much more
efficient than before.
In a similar way we define thebackward joint probability
βm(j) =
(
P(Ym+1 =ym+1, . . . , Yn =yn|Xm =j) 0≤m≤n−1
1 m=n (428)
Exercise 115 Show that for 0≤m ≤n−1
βm(j) =
X
i
pjibi(ym+1)βm+1(i) (429)
10.4.5 Viterbi algorithm
This addresses the following question: given a sequence of observations, what is the ‘best’ guess for the underlying Markov chain sequence which produced it? The Viterbi algorithm answers this by finding the state sequence which maximizes the joint probability P(X, Y) where Y is the observed sequence. This is equivalent to maximizing the conditional probability P(X|Y).
Define
δm(j) = max j0,...,jm−1
P(X0 =j0, X1 =j1, . . . , Xm =j, Y0 =y0, . . . , Ym =ym(430)) So δm(j) is the highest probability along a single path of the Markov chain, up to tim em, which accounts for the firstm observations and ends in state
j. The initialization is
We also have an induction step: δm+1(j) = h max i δm(i)pij i bj(ym+1) (432) Exercise 116 Derive (432). Define ψm(j) = arg max i h δm−1(i)pij i (433) The termination step is
P∗ = max
i δn(i), y
∗
n = arg maxi δn(i) (434) The optimal sequence ym∗ is then computed by backtracking:
References
[1] P. Billingsley, “Probability and Measure”, third edition. Wiley (1995). [Wiley series in probability and mathematical statistics]
[2] R. Durrett, “Probability: theory and examples”, second edition. Duxbury Press (1996).
[3] W. Feller, “An introduction to probability theory and its applications”, volume 1, second edition. Wilet (1957). [Wiley publications in Statistics] [4] G. R. Grimmett and D. R. Stirzaker, “Probability and Random Pro-
cesses”, second edition. Oxford University Press (1992).
[5] C. M. Grinstead and J. L. Snell, “Introduction to Probability”, AMS (2003).
[6] S. I. Resnick, “A Probability Path”, Birkhauser (1999).
[7] J. S. Rosenthal, “A first look at rigorous probability theory”, second edition. World Scientific (2006).
[8] S. M. Ross, “Introduction to Probability Models”, eighth edition. Aca- demic Press (2003)
[9] H. L. Royden, “Real Analysis”, third edition. Macmillan (1988).
[10] E. Seneta, “Non-negative matrices and Markov chains”, Springer (2006). [Springer series in Statistics]
[11] Y. Suhov and M. Kelbert, “Probability and Statistics by Example”, Volume 1, Basic Probability and Statistics Cambridge University Press (2005)