Skip to content

metropolis broken in 3.1rc2 with theano 0.9? #1994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rahuldave opened this issue Apr 5, 2017 · 6 comments · Fixed by #2001
Closed

metropolis broken in 3.1rc2 with theano 0.9? #1994

rahuldave opened this issue Apr 5, 2017 · 6 comments · Fixed by #2001

Comments

@rahuldave
Copy link

The model defined here: https://am207.github.io/2017/wiki/reguninfprior.html which itself is taken from Vanderplas's example in the getting started docs, with a metropolis step replacing the NUTS sampler is broken in 3.1rc2. It used to work in 3.0rc4

The intercept just wont budge from its initial value.

Discovered this in trying to do a theano shared for sample_ppc, which itself seems broken...

@junpenglao
Copy link
Member

I think the Uniform prior on alpha cause some problem in the gradient computation. If you change it into a weakly informed prior like alpha = pm.Normal('intercept', mu=0, sd=100) the model quickly converged
figure_1

@ColCarroll
Copy link
Member

It looks to me like intercept gets initialized to -128 for some reason, and can't move from there (which seems reasonable, since having a probability of 0 will cause mischief in the metropolis acceptance calculation).

This isn't a fix, but just expanding the lower bound on the intercept to include -128 fixes the problem as well: alpha = pm.Uniform('intercept', -130, 100), for example. I may try to look at how that initialization happens tonight.

Beautiful styling on that page, by the way!

@rahuldave
Copy link
Author

rahuldave commented Apr 5, 2017

Thanks! The thing is, this used to work on 3.0. Thats the part thats confusing...And the uniform prior ought to make a slow sampler, but i do run this for a huge number of iterations!

Its a bit bizarre that initialization is happening outside the range. When i ran it i got an additional warning I hadnt seen before:

//anaconda/envs/py35/lib/python3.5/site-packages/pymc3/sampling.py:163: UserWarning: Instantiated step methods cannot be automatically initialized. init argument ignored.
  warnings.warn('Instantiated step methods cannot be automatically initialized. init argument ignored.')

@twiecki
Copy link
Member

twiecki commented Apr 6, 2017

@rahuldave Does setting a test_value help?

@aseyboldt
Copy link
Member

The problem seems to be that the transform parameter is not passed to super() in the constructor of Uniform. Not sure how this leads to this behaviour, but at least for me it seems to work after fixing this. See #2001.

@twiecki
Copy link
Member

twiecki commented Apr 6, 2017

@rahuldave Can you update to master and check if the problem is fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants