Dbn

Algorithm 1 Mocapy++’s Viterbi path approximation algorithm. samples[m, l] corre-
sponds to slice l in sample m. P (samples[m, l]|samples[n, l − 1]) is the likelihood of all
the node values in slice l, where the values for the nodes are taken from position l of
sample m, and the nodes’ parent values in the previous slice are taken from position
l − 1 of sample n. Sequence indices run from 0 to L − 1. If a previous approximation of
the Viterbi path is available, it can be added to the initial list of samples. The procedure
will then come up with an improved variant of it or produce the same path.
S=number of samples
L=sequence length
V =number of scalars in a sequence slice
samples=sequence (S × L × V matrix)
score=matrix(S × L)
path=matrix(S × L)
# Start of dynamic programming
# 1. Initialization
for m = 0 to S − 1:
score[m, 0]=log P(samples[m, 0]])
# 2. Recursion
for l = 0 to L − 1:
for m = 0 to S − 1:
p=matrix(S)
for n = 0 to S − 1:
p[n]=log P(samples[m, l]|samples[n, l − 1])
index=argmax(p)
score[m, l]=score[m, l − 1]+p[index]
path[m, l]=index
# 3. Termination
index=argmax(score[L − 1])
viterbi=matrix(L × V )
viterbi[L − 1]=samples[index, L − 1]
# 4. Backtracking
for l = L − 2 to 0:
index=path[index, l]
viterbi[l]=samples[index, l]
report viterbi
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值