Hidden Markov Model

I am trying to construct a Hidden Markov Model to predict the next state to go to.

I am doing an example system, or, a test system that contains the following:

Ok so the training I have used is:

training = "HTTHTTTHHTTHTTTHHTTHTTTHHTTHTTTHHTTHTTTHHTTHTTTHHTTHTTTHHTTHTTTH"

and the test case is:

"HTHTTHTHTTHTHTHTHTTHHTHTHTTHTHTTHHT"

I assign the values to these, so like:

1, 'H', 0.5

2, 'H', 0.75

3, 'H', 0.25

1, 'T', 0.5

2, 'T', 0.25

3, 'T', 0.75

I compute the forward probability, this gives a result of: 0.25

And the viberti algorithm is used to find the best path:

 2 , 3 , 3 , 2 , 3 , 3 , 3 , 2 , 2 , 3 , 3 , 2 , 3 , 3 , 3 , 2 , 2 , 3 , 3 , 2
, 3 , 3 , 3 , 2 , 2 , 3 , 3 , 2 , 3 , 3 , 3 , 2 , 2 , 3 , 3 , 2 , 3 , 3 , 3 ,
2 , 2 , 3 , 3 , 2 , 3 , 3 , 3 , 2 , 2 , 3 , 3 , 2 , 3 , 3 , 3 , 2 , 2 , 3 , 3
, 2 , 3 , 3 , 3 , 2


The confusion is how to do I determine which is the next sequence from the Viberti Algorithm? It gives values of (2, 3) BUT, I do not know whether these are H, or T.

Anyone offer any help?

-
...but hmm is :) –  learnvst Nov 28 '12 at 23:28
@learnvst Hey - I updated my question, can you make any suggestions? –  Phorce Nov 29 '12 at 0:35

1 Answer

You don't need to use the Viterbi algorithm to do what you want to do.

You have only two possible outcomes: T or H. So train a model on your training sequence (not sure if this is the numbers you give - it looks like emission probabilities for 3 states, but you don't mention a transition matrix and how you derived these probabilities...), and then compute the probability of the observation sequence test + 'H' and test + 'T' - whichever has the highest score is the prediction. Cf "problem 1" in the classic Rabiner tutorial.

-
I am really confused. Basically, this was just an example I wrote from a book (I use emission probabilities for 3 states)... My overall outcome is this: I have 2 datasets, they both have sequences / patterns about them. The first dataset "Yes" starts low and it's value does not increase, it stays stagnant. The second dataset "No" has values that start low and then increase above 100 and do not fall. Is a Hidden Markov Model a good model to use? For example, I need to predict the next state, if it's low the value is "Yes" if it's high, the value is "No".. Hope you understand. –  Phorce Nov 29 '12 at 1:22
Please check the Rabiner tutorial and any online class material on speech recognition. You are mixing up concepts like prediction and classification; states and models/classes. In a typical recognition application (handwriting, speech, motion), you have several models, one per item to recognize (letter, phone, gesture...) ; and recognition is performed by picking the model which has the highest likelihood given the observed sequence. –  pichenettes Nov 29 '12 at 2:21
Thank you for the reply. Basically, I have samples of people saying "Yes" and "No". I can identify whether someone is saying these words by counting the zero-crossings of each sample, for "No" the values are low, for "Yes" the values are high. This works across the samples I have. My question to you is, what is the best model so be able to find the next state for both with training? I need to determine basically, if the next state is low, the person is saying "No" if the next state is high, the person is saying "Yes" i hope you can help. I read the paper, it helps a little. –  Phorce Nov 29 '12 at 2:35
It seems that you are trying to build something with two states, one per word. This is not how things are done - check a book or class material about speech recognition. Speech recognition is not a "predict the next state" problem and there are no "high" and "low" states - or you are using the wrong terminology. Also, I recommend you to abandon the zero-crossing rate as a feature. It is roughly capturing the pitch of the sound, and it looks like its ability to discriminate between "yes"/"no" in your database is a coincidence - due to the intonation with which these words were pronounced. –  pichenettes Nov 29 '12 at 9:20