Referred to Baum–Welch algorithm, http://cs.au.dk/~cstorm/courses/MLiB_f14/slides/hidden-markov-models-4.pdf

formula hmm

Is this formula correct? I spend a couple days to figure out which part is wrong.

I'm trying to train many of sequences. Each sequence are numbers(1,2,3,4) which has length = 6.

First, in the E-Step, I do forwards and backwards to calculate

$\gamma (N * totalState * lengthOfSequence) $


$\xi(N * totalPossiblelInput * totalState * totalState)$

$\gamma = forward(t) * backward(t)$/ normalize (sum of each same $t = 1$)

$\xi_{ij}(t) = \alpha_i(t) * A(i,j) * \beta_j(t+1) * B_j(t+1)$/ normalize (sum of each same t = 1)

For M-Step, I just put everything follow the above equation, update A, B, $\pi$.

The question is.... is my step correct?

When I train it, it converge very fast and stop very fast. (4-5 iterations) At first, I think that is a local minimum, but I use the same initial weights with MATLAB hmmtrain, It turned out that my code is wrong.


It is neccessary to start the parameter not too symmetry, ie. pi = 0.5 and 0.5. After change it a little bit .49, .51 then it works.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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