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

Adding notebook demoing using Mici with PyMC3 model #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

matt-graham
Copy link
Owner

This is intended to address #3. It adds a tutorial notebook explaining how to sample from the posterior defined using a PyMC3 model using Mici. A hierarchical linear regression model from this PyMC3 tutorial is used as an example model. Most of the code is not model specific and so could be used with other PyMC3 models and convenience function partially replicating the signature of the PyMC3 sample function is provided to act as a (sort of) drop-in replacement for sampling with Mici instead of the inbuilt sampler implementations.

@twiecki - if you have a chance could you possibly have a look through the notebook to see if you have any suggestions for clarifications or improvements to how I am handling getting the log density and gradient functions from the PyMC3 model? One thing in particular I wasn't sure about is if my description of why the set_extra_values({}) call to the ValueGradFunction instance is necessary before calling the object is correct.

@twiecki
Copy link

twiecki commented Dec 17, 2020

This is great! Especially the sample_mici function should be added to the core API here.

@twiecki
Copy link

twiecki commented Dec 17, 2020

And I don't think you need set_extra_values here but need to look closer. @junpenglao do you know?

@junpenglao
Copy link

@twiecki yes you do need to call set_extra_values even if there is no extra values (with an empty dict as input in that case).
In https://docs.pymc.io/developer_guide.html there is a few more different flavor of compiling a theano function that output both value and gradient (and potentially, jacobian also)

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.

3 participants