I want to know - what are the differences between the forward-backward algorithm and the Viterbi algorithm for inference in hidden Markov models (HMM)?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
A bit of background first maybe it clears things up a bit.
When talking about HMMs (Hiden Markov Models) there are generally 3 problems to be considered:
Baum Welch works in the following way
For each sequence in the training set of sequences
To sum it up, you use the Viterbi algorithm for the decoding problem and Baum Welch/Forward-backward when you train your model on a set of sequences.
If you need a full description of the equations for Viterbi decoding and the training algorithm let me know and I can point you in the right direction.
Forward-Backward gives marginal probability for each individual state, Viterbi gives probability of the most likely sequence of states. For instance if your HMM task is to predict sunny vs. rainy weather for each day, Forward Backward would tell you the probability of it being "sunny" for each day, Viterbi would give the most likely sequence of sunny/rainy days, and the probability of this sequence.
Morat's answer is false on one point: Baum-Welch is an Expectation-Maximization algorithm, used to train an HMM's parameters. It uses the forward-backward algorithm during each iteration. The forward-backward algorithm really is just a combination of the forward and backward algorithms: one forward pass, one backward pass. On its own, the forward-backward algorithm is not used for training an HMM's parameters, but only for smoothing: computing the marginal likelihoods of a sequence of states.