1
所以最优状态序列为
y∗=(y1∗,y2∗,y3∗)=(1,2,1)y^* = (y_1^*,y_2^*,y_3^*)=(1,2,1)y∗=(y1∗,y2∗,y3∗)=(1,2,1)
例题python...代码
# -*- coding:utf-8 -*-
# Python 3.7
# @Time: 2020/2/6 20:42
# @Author: Michael Ming
# @Website: https...time - 2, -1, -1):
y_star[i] = psi[i + 1][y_star[i + 1]]
return y_star, delta, psi
def crf_viterbi...delta)
psi[1:] += 1 # 序号从1开始,第0行没用
print("Psi路径:\n", psi)
if __name__ == '__main__':
crf_viterbi