calculating log likelihood for hmm