CamDavidsonPilon / Probabilistic-Programming-and-Bayesian-Methods-for-Hackers

aka "Bayesian Methods for Hackers": An introduction to Bayesian methods + probabilistic programming with a computation/understanding-first, mathematics-second point of view. All in pure Python ;)
http://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/
MIT License
26.55k stars 7.85k forks source link

Capter 5 module 'pymc3.variational' has no attribute 'advi' #385

Closed yuliang0225 closed 6 years ago

yuliang0225 commented 6 years ago

In[8] with model: mu, sds, elbo = pm.variational.advi(n=50000) step = pm.NUTS(scaling=model.dict_to_array(sds), is_cov=True) trace = pm.sample(5000, step=step, start=mu) Out

AttributeError Traceback (most recent call last)

in () 3 4 with model: ----> 5 mu, sds, elbo = pm.variational.advi(n=50000) 6 step = pm.NUTS(scaling=model.dict_to_array(sds), is_cov=True) 7 trace = pm.sample(5000, step=step, start=mu) AttributeError: module 'pymc3.variational' has no attribute 'advi' ------------------------------ pymc3: 3.4.1-py36_0
yuliang0225 commented 6 years ago

I had updated my PyMC to 3.4.1.

yuliang0225 commented 6 years ago

I understand where is wrong. The code should be updated.

edoven commented 6 years ago

@yuliang0225 how did you solve? I'm having the same problem.

ryanxiang0306 commented 5 years ago

how to updated the code ?

BartKeulen commented 5 years ago

I cannot find the updated code either.

@yuliang0225 please add your fix.

bernha18 commented 5 years ago

same issue, somebody figured out?

ysgit commented 5 years ago

anyone who gets here and is trying to solve it, replace the code block with:

with model:
    trace = pm.sample(5000, init='advi', n_init=50000)
JohnPaton commented 5 years ago

+1