I have an HMM (picture below), with a single parameter $\theta$ I want to estimate using Baum-Welch. I have a single training example X="HHT", and I start with an arbitrary guess $\theta = 0.8$. I know how to use the forward-backward algorithm to build the $A$ matrix with the expected number of transitions, e.g. $A(Fair,Loaded)$ is the expected number of transitions from the $Fair$ state to the $Loaded$ state.

But then what do I do to get the next best estimate for $\theta$? Do I use the MLE estimate:

$a(Fair, Loaded) = \frac{A(Fair,Loaded)}{A(Fair,Loaded)+A(Fair,Fair)+A(Fair,End)}$

and if I do, do I need the other estimators, e.g.

$a(Loaded, Fair)$?

Please be concrete as possible as I thought I understand the theory but when I started practicing I realized I didn't :(


Baum-Welch is an example of the expectation-maximization algorithm, which is explained well by the answers to this question. The answer by Berkmeister gives a detailed example (with code and a link to a nice paper) with an HMM.

The short version is that you alternate between two steps:

  • estimating the probabilities given $\theta$ (e.g. using the forward-backward algorithm you mentioned)

  • treating the estimated probabilities as "data" and finding the values of $\theta$ that are most consistent with that data (e.g. by counting the number of times each transition would have to occur, given the probabilities you estimated).

Each time you repeat those two steps, you get closer to the maximum likelihood estimate for $\theta$.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.