Viterbi trellis V[state][position] = max log-prob ending in that state
Highlighted in the parameter tables on the right: which π / a / e values feed the current cell. Viterbi uses one transition (the argmax winner); Forward and Backward use all transitions out of / into the row. The active line in the recurrence below the parameter tables is highlighted too.
Decoded path most-likely state sequence
HMM parameters
Initial probabilities π
| B | I | |
|---|---|---|
| π | 0.50 | 0.50 |
Transition matrix A
| from \ to | B | I |
|---|---|---|
| B | 0.90 | 0.10 |
| I | 0.20 | 0.80 |
Emission matrix E
| state | A | C | G | T |
|---|---|---|---|---|
| B | 0.40 | 0.10 | 0.10 | 0.40 |
| I | 0.10 | 0.40 | 0.40 | 0.10 |
Background prefers A/T; island prefers C/G. (Real CpG-island HMMs use 8 emitting states for dinucleotide context — this 2-state version captures the core idea.)