admin 管理员组

文章数量: 887021


2023年12月20日发(作者:mayonnaise)

In[117]:AOut[117]:

array([[ 0.5, 0.2, 0.3], [ 0.3, 0.5, 0.2], [ 0.2, 0.3, 0.5]])In[118]:BOut[118]:

array([[ 0.5, 0.5], [ 0.4, 0.6], [ 0.7, 0.3]])In[119]:PiOut[119]: array([[ 0.2, 0.4, 0.4]])In[120]:OOut[120]: array([[1, 2, 1]])输出结果为:In[101]:alpha,p = ForwardAlgo(A,B,Pi,O)In[102]:alphaOut[102]:

array([[ 0.1 , 0.077 , 0.04187 ], [ 0.16 , 0.1104 , 0.035512], [ 0.28 , 0.0606 , 0.052836]])In[103]:pOut[103]: 0.130218In[104]:beta,p1 = BackwardAlgo(A,B,Pi,O)In[105]:betaOut[105]:

array([[ 0.2451, 0.54 , 1. ], [ 0.2622, 0.49 , 1. ], [ 0.2277, 0.57 , 1. ]])In[106]:p1Out[106]: 0.130218In[107]:gamma = GetGamma(A,B,Pi,O)In[108]:gammaOut[108]:

array([[ 0.18822283, 0.31931069, 0.32153773], [ 0.32216744, 0.41542644, 0.27271191], [ 0.48960973, 0.26526287, 0.40575036]])In[109]:xi = GetXi(A,B,Pi,O)In[110]:xiOut[110]:

array([[[ 0.1036723 , 0.04515505, 0.03939548],

array([[[ 0.1036723 , 0.04515505, 0.03939548], [ 0.09952541, 0.18062019, 0.04202184], [ 0.11611298, 0.1896512 , 0.18384555]], [[ 0.14782903, 0.04730529, 0.12417638], [ 0.12717136, 0.16956181, 0.11869327], [ 0.04653735, 0.05584481, 0.16288071]]])In[111]:a,b,pi = BaumWelchAlgo_n(A,B,Pi,O,5)In[112]:aOut[112]:

array([[ 0.43972438, 0.15395857, 0.40631705], [ 0.309058 , 0.45055446, 0.24038754], [ 0.3757005 , 0.50361975, 0.12067975]])In[113]:bOut[113]:

array([[ 0.50277235, 0.49722765], [ 0.49524289, 0.50475711], [ 0.91925551, 0.08074449]])In[114]:piOut[114]: array([[ 0.08435301, 0.18040718, 0.73523981]])In[115]:viterbi(A,B,Pi,O)Delta矩阵:

array([[ 0.1 , 0.028 , 0.00756], [ 0.16 , 0.0504 , 0.01008], [ 0.28 , 0.042 , 0.0147 ]])Psi矩阵:

array([[ 0., 3., 2.], [ 0., 3., 2.], [ 0., 3., 3.]])最优路径概率:

0.999998最优路径:

array([[ 3., 3., 3.]])__main__:192: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future


本文标签: 输出 路径 结果