Hidden Markov Model predicting next observation

user975733 picture user975733 · Oct 2, 2011 · Viewed 9.2k times · Source

I have a sequence of 500 observations of the movements of a bird. I want to predict what the 501st movement of the bird would be. I searched the web and I guess this can be done by using HMM, however I do not have any experience on that subject. Can anyone explain the steps of an algorithm used to solve this problem?

Answer

ninjagecko picture ninjagecko · Oct 2, 2011
x1-x2-x3-x4-x5......x500-x501
|  |  |  |  |       |
y1 y2 y3 y4 y5      y500

x - actual state
y - observations

P(y_i|x_i) - how you think the observation depends on the actual state
P(x_i|x_(i-1)) - how you think the actual state evolves

for i = 1,2,3...,501:
    write down best-guess of x_i based on y_i* and x_(i-1)**
you have your solution, since you only care about the last state

* missing in step 1
** missing in step 501

The above is known as the forward-backward algorithm ( http://en.wikipedia.org/wiki/Forward-backward_algorithm ) and is a special case of the sum-product algorithm (on Bayesian network trees and Markov network trees) on this particular kind of tree (a simple chain with nodes hanging off). You can ignore the "backwards" step because you don't need it, since you only care about the last state.

If the transition probabilities in your HMM are unknown, you must either:

  • perform a learning algorithm, such as EM (known as Baum-Welch when performed on HMMs)
  • take a naive guess based on domain knowledge (e.g. if your hidden states is DNA you can count the frequencies of transition events given the previous state by manually labeling the transitions on DNA data and computing the frequencies)