Suppose your starting probability is one: In the HMM, you either have a fixed initial state or a probability distribution over all states that indicates how likely it is to start in state X. Suppose that your starting probability for this state is 1 is equal to the first alternative.
Viterbi algorithm: In the viterbi matrix, the i-th row offten corresponds to the i-th state, and the j-th column corresponds to the lenth j prefix of your emitted symbol. In each entry (i, j) there is a maximum probability that you have already seen the prefix j, and you are in state i.
For your return following, you need to track each (i, j) -cube in which the maximum predecessor participated in the calculation of (i, j) -cages. If you have this information, you can step back from the cell with the highest value in the last column to the beginning. Drop it back and you got your way viterbi.
source share