Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a two-state HMM and I am using Baum-Welch to estimate all the model parameters, including the Transition matrix. Then I use Viterbi to infer the optimal hidden state sequence.

I am using such HMM to infer the hidden states, which are 1 or 0. However, currently the model gives me way more hidden states predicted as 1 than I'd like to have. What I'd like to have then is a good scoring system for the hidden states such that I can rank the states according to their probability of being 1/0 given all the data and parameters.

I am thinking of two different approaches to limit the number of states predicted as 1 for my hidden states:

Q1. Is it possible, and at which stage of my procedure, I should constrain the maximum number of states predicted as 1? Should I assume a certain form of the transition matrix, instead of estimating it, and then fit the other model parameters? I am open to suggestions here.

Q2. I could also use some posterior probability of each state (given all data) to filter some states predicted as 1 out. How should I compute the posterior probability of each state predicted by Viterbi? I.e., I'd like to compute a vector of probabilities of the same length as the viterbi predicted sequence giving the a posteriori probability of each hidden state.


share|improve this question
Can you please rephrase "however, such approach gives me way too many binding regions (state 0 no binding, and state 1 binding)" into HMM terms, for those of us who don't anything about protein binding regions? Thanks. – jerad Dec 4 '12 at 20:43
@jerad good point, let me re-write the Q in a more easy-to-follow way... – Dnaiel Dec 4 '12 at 20:44
@jerad, actually the binding/not binding is irrelevant so I took it away for being useless... – Dnaiel Dec 4 '12 at 20:48

To get a distribution over the hidden state sequence use the forward-backward algorithm rather than viterbi.

Regarding the problem of inferring too many 1s in your hidden sequence, you should think about why your training procedure is not working the way you expect it to. Is your training set too small? Is your training set biased toward some states? Take a look at your learned transition and emission matrices and try to identify wether it is the transition probability or emission probability that is leading to misclassifications? Once you have a better intuition about why your HMM is underperforming then you can try to address it.

One way to address either issue (wether it be with your emission probabilities or transition probabilities) is to use Bayesian HMM with a Dirichlet prior on each of the rows in your transition and emission matrices, and use Gibbs sampling for inference. You could then incorporate your domain knowledge by encoding it in your priors.

share|improve this answer
nice answer. I actually realized that as part of the baum-welch I end up getting the hidden states distribution because I use fwd-bwd each time on the baum-welch algo. With respect to the other comments, nice too, I will think about them and take a deeper look at the results before getting back to you on that one. Again, thanks. – Dnaiel Dec 4 '12 at 21:34
@Dnaiel, note that Bayesian HMMs are another setting in which hyperpriors on Dirichlet-Multinomials are used. – jerad Dec 6 '12 at 20:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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