80 likes | 88 Views
Exploring how the Viterbi algorithm works in Hidden Markov Models to find the most probable path of states by recursively computing probabilities and backtracking. Includes implementation details in Mathematica.
E N D
Dishonest Casino • Let’s take a look at a casino that uses a fair die most of the time, but occasionally changes it to a loaded die.This model is hidden because we see the sequence of rolls, but we don’t know which die was used for each roll.
Assumptions • Suppose that we know the expected behavior of the fair and the loaded die, and the probability of switching between them. The emission and transition probabilities for both dies are depictured below
Finding the most probable path • There are two states in this model: Fair and LoadedFinding the path of states for a specific rolls sequence is determining what was the state (or which die was used) for each particular roll in this sequence.One way to do it is to try all the possible state combinations and to compute probability for each of them in the following way:
The Viterbi Algorithm • There are a few algorithms for finding the most probable states in HMM: Viterbi, forward, Baum-WelchThe most common is Viterbi, for its speed / accuracy ratio.The result that interests us is • In the Viterbi algorithm the most probable path is found recursively
How it works • Suppose that we know the probability Vk(i) of the most probable path ending in state k with observation Xi for each k.Then the probabilities for Vl(i+1) can be computed in the following way: • The initial condition is V0(0) = 1. By keeping pointers backwards, the actual state sequence can be found by backtracking
The Viterbi algorithm • Now let’s see how it is implemented in Mathematica
Bibliography • “Biological Sequence Analysis”, R.Durbin