Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hidden Markov Model Multiple Observation values for each state

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!

like image 397
leon Avatar asked Mar 12 '13 18:03

leon


2 Answers

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.

like image 140
jerad Avatar answered Nov 09 '22 08:11

jerad


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.

like image 31
yu239 Avatar answered Nov 09 '22 07:11

yu239