简体   繁体   English

使用带有 depmixS4 包的 R 的隐马尔可夫模型(HMM)

[英]Hidden Markov Model(HMM) using R with depmixS4 package

I am using depmixS4 package to use HMM.我正在使用 depmixS4 包来使用 HMM。

After using posterior function, I get 2 columns.使用后验函数后,我得到 2 列。 First column with currently which state I may be in(seems like using Viterbi Algorithm), and the next column is the probability of for being in each state.第一列当前我可能处于哪个状态(似乎使用维特比算法),下一列是处于每个状态的概率。

I think that the first column with the state should match with the maximum probability in second column, but the result shows that that is not always the case.我认为带有状态的第一列应该与第二列中的最大概率匹配,但结果表明情况并非总是如此。 For example if the probability for state 1 : 0.2, state 2 : 0.7, state 3 : 0.1, the first column that shows which state I am in may show that I am in state 1. (intuitively should show that I am in state 2)例如,如果状态 1 的概率:0.2,状态 2:0.7,状态 3:0.1,显示我处于哪个状态的第一列可能表明我处于状态 1。(直觉上应该表明我处于状态 2 )

https://cran.r-project.org/web/packages/depmixS4/depmixS4.pdf on here, it says that the second column shows "delta prob", but I cannot not find that word even in the reference. https://cran.r-project.org/web/packages/depmixS4/depmixS4.pdf在这里,它说第二列显示“delta prob”,但即使在参考文献中我也找不到那个词。

Thanks for reading谢谢阅读

I'm not sure the above answer is correct.我不确定上面的答案是否正确。 The state is a combination of the previous states and the probability of the current observed value occurring under the 3 distributions.状态是先前状态和当前观测值在 3 个分布下出现的概率的组合。 To see the code that generates the deltas take a look at要查看生成增量的代码,请查看

depmixS4::viterbi

Where you can see the states generated in the "backwards" part of the viterbi algorithm在哪里可以看到在维特比算法的“向后”部分生成的状态

The delta probabilities are defined in Rabiner(1989) at equation 30. delta 概率在 Rabiner(1989) 的公式 30 中定义。

The delta probabilities give you a vector of probabilities for each state. delta 概率为您提供每个状态的概率向量。 Then you use this vector to simulate the state;然后你用这个向量来模拟状态; this means that you will simulate state 1, 20% of the time, state 2, 70% and so on.这意味着您将模拟状态 1、20% 的时间、状态 2、70% 等等。 I am guessing that the package gives you one simulation.我猜这个包会给你一个模拟。 Hope that helps.希望有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM