ENH add hidden Markov model