I am trying to find some (preferably MATLAB) code for the Viterbi algorithm in a 2nd order HMM. I know how to apply it for a first order model, and understand the concept for 2nd order. However I am having trouble implementing it for a 2nd order model. Can anyone give me any good references? I have searched Google and, surprisingly, could not find anything that's reasonably clear.
Also, is there a MATLAB library that already implements this? I know there is one for a first order HMM. Thanks
I know this is old, but I had this question, and had to figure out the answer myself.
You just need to represent the transition probabilities as
P((State_t-2, State_t-1) => (State_t-1, State_t))
You can keep emission probabilities in terms of
State_t
though (you need a lot of data for 2nd-order emission probabilities to be reasonable).That should give you reasonable results.