How can I create a Hidden Markov Model (HMM) out of continuous Input and discrete Output?

25 visualizaciones (últimos 30 días)
I want to create a Hidden Markov Model. I am trying to use the HMM Toolbox from Kevin Murphy. Right now I am struggling with the first steps. My Input is 140 Observations of an acceleration signal with different length each. My Output is a discrete rating of performance from 1 to 7. It means I have 1 rating for every Observation.
How can I choose the number of States Q and the number O of Output Symbols? Would that mean Q=140 and O=7?
How do I get my signals into the model?

Respuestas (1)

Carl
Carl el 8 de Feb. de 2017
Editada: Carl el 8 de Feb. de 2017
See the guide here if you haven't done so already:
https://www.cs.ubc.ca/~murphyk/Software/HMM/hmm_usage.html
In the example, they use Q = the number of states, and O = the number of output symbols. You will have to bin your continuous signal values into a discrete set of states. For example, if your signal can take a value between 0 and 1, you can can bin this into 10 different states (0.0 to 0.1, 0.1 to 0.2, etc.). You can then set Q = the number of states you have defined, and O = 7.
In general, HMMs do not support continuous states, as they have to maintain state transition and output probabilities. If you would like a more robust way of binning your continuous values into a discrete space, look at the following Answers post. The code uses quantization to bin continuous observations, but you can generalize the solution to bin any type of data.
Also, I would suggest looking up the structure of HMMs in general. Rather than the concept of inputs and outputs, it operates on the concept of hidden internal states and observed outputs. It may be that you have your states and outputs mixed up; do you "observe" the signal, or the performance rating? What is the internal state?
  2 comentarios
ga56
ga56 el 9 de Feb. de 2017
Thank you for your detailed answer :) That guide is confusing me a bit. Does he use the random matrices for initiation or is the example just random? I wonder how I get the characteristics of my real system into the Model, if I just set the parameters Q and O.
Is it correct that I need 1 Observed State for every Hidden State? Because the way I planned to do it was to create states out of my signal, as you proposed. Then I have, let's say, 10 observable states that the signal goes through. On the other hand I have only 1 hidden state (the performance rating) for the same period, because the entire signal is rated in one value. Is there also a workaround for this problem?
To your questions: I observe the signal. The performance rating is hidden, but I have some sample data for it to train the model. So I guess the internal state is the performance rating, right?
Carl
Carl el 9 de Feb. de 2017
To answer your first question: both. The variables prior0, transmat0, and obsmat0 are randomized and used to generate the training data. Therefore, the data that they're using is random. The variables prior1, transmat1, and obsmat1 are initialized to random values, and then improved using the EM algorithm. These variables are the parameters of the HMM that is being trained.
Each state in a sequence should correspond with one observation. By the "number of states" or "number of observations", I actually mean the number of possible states or observations. So in your case you would have multiple possible values for both the signal and the rating.
This really depends on how you would like to work with your data. Generally, HMMs are trained only on sequences of observations. I would highly recommend reading more on HMMs, to better determine the best way of structuring this for your specific use case.
https://www.mathworks.com/help/stats/hidden-markov-models-hmm.html

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by