Skip to content
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

Print warnings for some bad traces #2002

Merged
merged 2 commits into from
Apr 7, 2017
Merged

Conversation

aseyboldt
Copy link
Member

Right now we don't report anything if a trace if obviously nonsense. This PR prints warnings if a trace does not meet some minimum requirements.
The test about the target acceptance probability is a bit hairy, I don't know any obvious choices for the threshold. The one I implemented works out to printing a warning if:

  • If the target accept is 0.99, fail if mean accept is not between 0.96 and 0.9997.
  • If target_accept = 0.8, fail if mean accept is not between 0.72, 0.87.
    I'm open for better ideas...

@ColCarroll
Copy link
Member

This looks really useful. Neal (https://arxiv.org/pdf/1206.1901.pdf) has some calculations for optimal acceptance rate for Metropolis and HMC/NUTS on page 30. Not sure how wide the band should be around that...

@twiecki
Copy link
Member

twiecki commented Apr 7, 2017

Very useful. Seems like there are some legit test errors.

@springcoil
Copy link
Contributor

springcoil commented Apr 7, 2017 via email

@aseyboldt
Copy link
Member Author

I guess this also means we need a way to pass parameters to nuts though pm.sample. It's a bad idea to tell users to increase target_accept, but to do this you need to manually specify your step methods and automatic initialization with advi doesn't work anymore.

@twiecki
Copy link
Member

twiecki commented Apr 7, 2017

@aseyboldt Yeah, I had this on my mind before, should definitely pass kwargs. Maybe best way is to have step_method_kwargs and init_kwargs (or advi_kwargs?).

@junpenglao
Copy link
Member

I guess this also means we need a way to pass parameters to nuts though pm.sample. It's a bad idea to tell users to increase target_accept, but to do this you need to manually specify your step methods and automatic initialization with advi doesn't work anymore.

@aseyboldt isn't that always an option https://github.com/pymc-devs/pymc3/blob/master/pymc3/sampling.py#L491 ?

@aseyboldt
Copy link
Member Author

@junpenglao Yes, but this does not work through pm.sample.

@aseyboldt
Copy link
Member Author

See #2004

@twiecki twiecki merged commit 856d675 into pymc-devs:master Apr 7, 2017
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 this pull request may close these issues.

5 participants