How likely is what we saw?
Suppose we saw the moves Small, Large, Large. How likely is that sequence under our model? We could list every hidden path (Calm-Calm-Calm, Calm-Calm-Stormy, and so on), compute each path's probability and add them up. With states and days that is paths, far too many. The forward algorithm does the same sum in steps by reusing work. It keeps a number : the probability of the first observations and of being in state on day .
Read the recursion in words: to be in state today, you came from some state yesterday (sum over with the transition chance), and then today's state produced today's observation. Dividing by its total gives the filtered probabilities, your belief about today's state given the data up to today. One practical problem: multiplying many small numbers gives numbers that shrink toward zero and underflow. So at each step we divide by the total and keep it. The log of the data probability is then simply the sum of .
- Forward algorithm: sum over all hidden paths in steps instead of .
- Filtered probabilities: normalise to get your belief about today's state from data up to today.
- Scaling: divide by each step and add up to avoid underflow.
Lab · what's graded
- The first forward value15 pts
- The total of day one10 pts
- Filtered after two days15 pts
- The probability of the sequence15 pts
- The log-likelihood10 pts
- What the forward algorithm saves10 pts
- Match the vocabulary10 pts
- Why the values are rescaled15 pts