Creating a hidden markov model