模块“pymc3”没有属性“traceplot”错误

问题描述

我正在尝试生成我的模型的轨迹图,但它显示 module 'pymc3' has no attribute 'traceplot' 错误。我的代码是:

with pm.Model() as our_first_model:
    # a priori
    theta = pm.Beta('theta',alpha=1,beta=1)
    # likelihood
    y = pm.Bernoulli('y',p=theta,observed=data)
    #y = pm.Binomial('theta',n=n_experimentos,observed=sum(datos))
    start = pm.find_MAP()
    step = pm.Metropolis()
    trace = pm.sample(1000,step=step,start=start)
    burnin = 0  # no burnin
    chain = trace[burnin:]
    pm.traceplot(chain,lines={'theta':theta_real});

然后给出以下错误:

AttributeError                            Traceback (most recent call last)
<ipython-input-8-40f97a342e0f> in <module>
      1 burnin = 0  # no burnin
      2 chain = trace[burnin:]
----> 3 pm.traceplot(chain,lines={'theta':theta_real});
AttributeError: module 'pymc3' has no attribute 'traceplot'

我使用的是 windows10 并且我已经用 pip 下载了 pymc3,因为它没有包含在我下载的 anaconda 中。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)