8

I am new to Hidden Markov Model. I understand the main idea and I have tried some Matlab built-in HMM functions to help me understand more.

If I have a sequence of observations and corresponding states, e.g.

seq =    2     6     6     1     4     1     1     1     5     4
states = 1     1     2     2     2     2     2     2     2     2

and I can use hmmestimate function to calculate transition and emission probability matrices as:

[TRANS_EST, EMIS_EST] = hmmestimate(seq, states)

TRANS_EST =

0.5000    0.5000
     0    1.0000

EMIS_EST =

     0    0.5000         0         0         0    0.5000
0.5000         0         0    0.2500    0.1250    0.1250

In the example, the observation is just a single value.

The example picture below describes my situation. My situation If I have states: {Sleep, Work, Sport}, and I have a set of observations: {lightoff, light on, heart rate>100 .....} If I use number to represent each observation, in my situation each state has multiple observations at the same time,

seq =    {2,3,5}     {6,1}     {2}     {2,3,6}     {4}     {1,2}     {1}    
states = 1             1        2         2         2        2        2    

I have no idea how to implement this in Matlab to get transition and emission probability matrix. I am quite lost, what shall I do in the next step? Am I using the right approach?

Thanks!

leon
  • 10,085
  • 19
  • 60
  • 77
  • Hi leon, I am working on a similar problem. Have you found a solution to this? I have been searching extensively but could not even find a paper or an implementation example to verify that having multiple observation variables is possible with HMM's. From what I understand, having multiple observation sequences (of the same variable) is possible but I am not sure what the situation is if the sequences actually belong to different variables. – Zhubarb Jul 03 '13 at 16:25
  • Hi Berkan, HMM isn't a fit for this problem. I am looking into other options – leon Jul 04 '13 at 17:13
  • I have just sent a message on your blog. Can you elaborate on why you think HMM is not suitable for this? I have been reading on this for a week and as mentioned am not quite sure on the subject yet. I presume you have been looking at the problem for longer than me so any pointers or explanations (as to why it is not possible) would be immensely welcome. – Zhubarb Jul 05 '13 at 08:51

2 Answers2

5

If you know the hidden state sequence, then max likelihood estimation is trivial: it's the normalized empirical counts. In other words, count up the transitions and emissions and then divide the elements in each row by the total counts in that row.

In the case where you have multiple observation variables, code the observations as a vector where each element gives the value of one of the random variables on that time step, e.g. '{lights=1, computer=0, Heart Rate >100 = 1, location =0}'. The key is that you need to have the same number of observations at each time step or else things will be much more difficult.

jerad
  • 2,028
  • 15
  • 16
  • thanks for your answer, I stil dont know how to put vector into matlab hmmestimate function? – leon Mar 13 '13 at 09:53
  • You can't use hmmestimate for that, but you could pretty easily write a for loop that loops over each state and counts the outgoing transitions and emissions and then normalizing. – jerad Mar 13 '13 at 15:36
1

I think you have two options. 1) code multiple observations into one number. For example, if you know that the maximal possible value for the observation is N, and at each state you may have at most K observations, then you can code any combinations of observations as a number between 0 and N^K - 1. By doing this, you are assuming that {2,3,6} and {2,3,5} do not share anything, they are completely different two observations. 2) Or you can have multiple emission distributions for each state. I haven't used the built-in functions in matlab for HMM estimation, so I have no idea whether or not it supports that. But the idea is, if you have multiple emission distributions at a state, the emission likelihood is just the product of them. This is what jerad suggests.

yu239
  • 53
  • 4