to define a discret hmm you need atleast: a number of states n
for your model, a n X n
transition probability, a list of m
posible observations (emissions) and a n X m
matrix with the probabilities for each emission in each state. What you have is a series of observations, from that alone you can not define a HMM.
So i would start by having a look at this tutorial form mathworks to get a grasp of the basics. The functions used there are part of the statistics toolbox.
Then you start by creating a guess for the number of stats in your HMM. Let's say you have 2 stats(like in the tutorial mentioned above)
The next step would be the create a initial guess for the emission and transition matrices. if your posible emissions are 1 2 3 4 5
and your states are 2
then you get a 2x5
Emission probability matrix and a 2x2
transition matrix.
Now lets assume you guess that state 1 produces 1 2 3
and state 2 produces 4 5
then (evenly distributed) your emission matrix would look like this:
>> emis=[1/3 1/3 1/3 0 0; 0 0 0 1/2 1/2]
emis =
0.3333 0.3333 0.3333 0 0
0 0 0 0.5000 0.5000
you also guess that states do change from state 1 to 2 after a few emissins then stay there. your guess would kinda look like this:
>> trans = [.8 .2; 0 1]
trans =
0.8000 0.2000
0 1.0000
you can have a look what your HMM would generate:
>> [seq,states] = hmmgenerate(6, trans, emis)
seq =
2 1 3 2 4 5
states =
1 1 1 1 2 2
from that point you use observation series to train your HMM with the functions hmmestimate
or hmmtrain
.