Pseudocode
Here is some necessary set up for the problem. Given the observation space, the state space, a sequence of observations, transition matrix of size such that stores the transition probability of transiting from state to state, emission matrix of size such that stores the probability of observing from state, an array of initial probabilities of size such that stores the probability that .We say a path is a sequence of states that generate the observations .
In this dynamic programming problem, we construct two 2-dimensional tables of size . Each element of, stores the probability of the most likely path so far with that generates . Each element of, stores of the most likely path so far for
We fill entries of two tables by increasing order of .
- , and
Read more about this topic: Viterbi Algorithm