Implement the Baum-Welch EM algorithm and the Viterbi algorithm