HMM learning the transition probabilities and observations given an
array list of training instances.