0

我正在尝试生成我的模型的跟踪图,但它显示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, p=theta, 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中。

4

1 回答 1

4
于 2021-02-04T09:52:23.787 回答