Example implementation of EM (brute force and forward-backward methods) + Viterbi