隐马尔科夫模型HMM自学(5-2)

取自 自然语言处理百科

跳转到: 导航, 搜索

一般化上一篇最后得到的公式我们可以把概率的求解写成:

Image:6.1.2.3_b.gif

2d. 反向指针, Image:phi.gif's

考虑下面trellis

Image:trellis.1.gif

现在我们可以得到到达每一个中间或者终点状态的概率最大的路径。但是我们需要采取一些方法来记录这条路径。这就需要在每个状态记录得到该状态最优路径的前一状态。记为:

Image:6.1.2.4_a.gif

这样argmax操作符就会选择使得括号中式子最大的索引j。

如果有人问,为什么没有乘以混淆矩阵中的观察概率因子。这是因为我们关心的是在到达当前状态的最优路径中,前一状态的信息,而与他对应的观察状态无关。

2e. viterbi算法的两个优点

1)与Forward算法一样,它极大的降低了计算复杂度

2)viterbi会根据输入的观察序列,“自左向右”的根据上下文给出最优的理解。由于viterbi会在给出最终选择前考虑所有的观察序列因素,这样就避免了由于突然的噪声使得决策原理正确答案。这种情况在真实的数据中经常出现。

[编辑] ======================================

下面给出viterbi算法完整的定义1. Formal definition of algorithm

The algorithm may be summarised formally as:

For each i,, i = 1, ... , n, let :

Image:6.2.1_a.gif

- this intialises the probability calculations by taking the product of the intitial hidden state probabilities with the associated observation probabilities.

For t = 2, ..., T, and i = 1, ... , n let :

Image:6.2.1_b.gif

- thus determining the most probable route to the next state, and remembering how to get there. This is done by considering all products of transition probabilities with the maximal probabilities already derived for the preceding step. The largest such is remembered, together with what provoked it.

Let :

Image:6.2.1_c.gif

- thus determining which state at system completion (t=T) is the most probable.

For t = T - 1, ..., 1

Let :

Image:6.2.1_d.gif

- thus backtracking through the trellis, following the most probable route. On completion, the sequence i1 ... iT will hold the most probable sequence of hidden states for the observation sequence in hand.

[编辑] ======================================

我们还用天气的例子来说明如何计算状态CLOUDY的部分概率,注意它与Forward算法的区别

Image:example.viterbi.gif

还是那句话:

怎么样?看到这里豁然开朗了吧。要是还不明白,我就.....................还有办法,看个动画效果:

http://www.comp.leeds.ac.uk/roger/HiddenMarkovModels/html_dev/viterbi_algorithm/s3_pg3.html

参数定义:

http://www.comp.leeds.ac.uk/roger/HiddenMarkovModels/html_dev/viterbi_algorithm/s3_pg4.html

http://www.comp.leeds.ac.uk/roger/HiddenMarkovModels/html_dev/viterbi_algorithm/s3_pg5.html

别忘了,viterbi算法的目的是根据给定的观察状态序列找出最有可能的隐含状态序列,别忘了viterbi算法不会被中间的噪音所干扰。


编者注:隐马尔科夫模型HMM自学系列由崔晓源翻译。

英文原文见:http://www.comp.leeds.ac.uk/roger/HiddenMarkovModels/html_dev/main.html

翻译系列见:http://blogcui.spaces.live.com/blog/cns!46BDB23E24219CE9!144.entry?_c=BlogPart

个人工具
工具箱