Train the hmms