Viterbi learning algorithm