The single most likely story
The forward algorithm adds up all hidden paths to say how likely the data are. Often we want something else: the one best story, the single sequence of states that explains the data with the highest probability. Viterbi decoding finds it. The idea is the forward algorithm with one change: instead of summing over the previous states, take the best one. Keep a score , the probability of the best path that ends in state on day , and remember which previous state gave it, the back-pointer.
After the last day, pick the state with the largest and walk back through the pointers to read off the whole path. Two practical points. First, work with logs: products of many probabilities shrink to nearly zero, but logs turn them into sums, and since the log is increasing the best path is the same. Second, the best path is not the same as picking the most likely state on each day separately. The path can be forced by what comes later, as the example shows.
- Viterbi replaces the sum of the forward algorithm by a maximum and keeps back-pointers.
- The best path can differ from the most likely state of each day taken separately.
- Use logs: sums of logs avoid underflow and keep the same best path.
Lab · what's graded
- A Viterbi score on day two15 pts
- The best path's probability15 pts
- The log of the best path10 pts
- Against another path10 pts
- The first state of the best path15 pts
- The steps of Viterbi10 pts
- Match the vocabulary10 pts
- Why use logs15 pts