add viterbi decoding and prediction with previous state