1632
правки
Изменения
м
'''if''' (s, t) '''in''' fwd '''return''' fwd[s, t] f = 0 '''for''' j '''in''' S f += alpha(j, t - 1) * transitionProbability[j][, s] f *= emitProbability[s][, observations[t]] fwd[s, t] = f '''return''' fwd[s, t]
'''if''' (s, t) '''in''' bkw '''return''' bkw[s, t] b = 0 '''for''' j '''in''' S b += beta(j, t + 1) * transitionProbability[s][, j] * emitProbability[j][, O[t + 1]] bkw[s, t] = b '''return''' bkw[s, t]
'''for''' s '''in''' S fwd[s, 1] = emitProbability[s][, observations[1]] * П[s] bkw[s, observations.length - 1] = 1 chainProbability = 0 '''for''' j '''in''' S chainProbability += alpha(j, 1) * beta(j, 1) '''for''' s '''in''' S '''for''' t '''in''' [1, T] probabilities[s, t] = (alpha(s, t) * beta(s, t)) / chainProbability
rollbackEdits.php mass rollback
'''fun''' alpha(s: '''int''', t: '''int'''): '''int'''
'''fun''' beta(s: '''int''', t: '''int'''): '''int'''
'''fun''' forward_backward():
== См. также ==