PyMC3中的隐马尔可夫模型

8
我需要解决一个多元蒙特卡罗隐马尔可夫问题:
   x[k] = f(x[k-1]) + B u[k]
   y[k] = g(x[k])

其中:

x[k] the hidden states (Markov dynamics)
y[k] the observed data
u[k] the stochastic driving process

PyMC3已经成熟到足以处理这个问题了吗?还是应该继续使用2.3版本?其次,如果有关于PyMC框架中HM模型的任何参考资料,将不胜感激。谢谢。

-- Henk


由于可以将HMM视为状态空间模型的特例,因此这个PySSM软件包可能会对您有所帮助 :)仓库链接:https://bitbucket.org/christophermarkstrickland/pyssm 论文链接:http://www.jstatsoft.org/v57/i06/paper - Samoht-Sann
1个回答

2
我用 PyMC 2.x 做过类似的事情。不过我的 u 不是时变的。这是我的示例。
# we're using `some_tau` for the noise throughout the example.
# this should be replaced with something more meaningful.
some_tau = 1 / .5**2

# PRIORS
# we don't know too much about the velocity, might be pos. or neg. 
vel = pm.Normal("vel", mu=0, tau=some_tau)

# MODEL
# next_state = prev_state + vel (and some gaussian noise)
# That means that each state depends on the prev_state and the vel.
# We save the states in a list.
states = [pm.Normal("s0", mu=true_positions[0], tau=some_tau)]
for i in range(1, len(true_positions)):
    states.append(pm.Normal(name="s" + str(i),
                            mu=states[-1] + vel,
                            tau=some_tau))

# observation with gaussian noise
obs = pm.Normal("obs", mu=states, tau=some_tau, value=true_positions, observed=True)

我猜你需要将你的vel建模成一个随机变量列表。它们可能也有一些依赖关系。
这是原始问题: PyMC:马尔可夫系统中的参数估计 这是完整的示例IPython笔记本: http://nbviewer.ipython.org/github/sotte/random_stuff/blob/master/PyMC%20-%20Simple%20Markov%20Chain.ipynb

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接