I have a particular problem, and I would like to know if using a HMM is the correct tool for it. Apologies for the poor wording of the problem, HMMs are definitely not my specialty.

I have the following data:

  • Several sequences of continuous values
  • Each sequence can be of a different length
  • All sequences come from the same underlying Markov chain
  • The number of states (N) is known
  • The structure of the Markov chain is known: a state always stays as the same state ($N_i$) or transitions to the next state ($N_{i+1}$)

I would like to segment a sequence into the underlying states to be able to calculate the mean value of each state.

For example:

# observable values
x = [0.80, 0.75, 0.85, 1.20, 1.15, 1.20, 1.15, 2.10, 2.05, 2.10]
# label states (we do not know)
y = [   A,    A,    A,    B,    B,    B,    B,    C,    C,    C]
# what I would like to learn in the end
state_means = {'A': 0.80, 'B': 1.175, 'C: 2.075}

I have the feeling that it might be possible to train a HMM with the objective function to minimize the mean squared error between the estimated state_means and the observed values.


1 Answer 1


Yes you totally are in the context of an HMM with discrete hidden states and continuous observations, in an unsupervised setting.

Once the probability model is set up, you will need to learn the parameters of the distributions. This can be done with the Expectation Maximization algorithm, have a look at Section III.C of this article "A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition" by Lawrence R. Rabiner. This set of parameters include the transition of the hidden random process and the means and variances of the Gaussian emission distribution (the latter choice of distribution is the most common one).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.