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

Document initializing Turing #17

Closed
wants to merge 6 commits into from
Closed

Document initializing Turing #17

wants to merge 6 commits into from

Conversation

sethaxen
Copy link
Member

@sethaxen sethaxen commented Nov 2, 2021

This PR introduces a docs page showing how to initialize Turing with Pathfinder. Note that to initialize the metric, we'd need to work with AdvancedHMC directly, but this is really clunky right now due to the complexity of getting the unconstrained log density. Hopefully there's a simpler way than how I'm currently doing it!

@codecov
Copy link

codecov bot commented Nov 2, 2021

Codecov Report

Merging #17 (7e74162) into main (93691b4) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #17   +/-   ##
=======================================
  Coverage   98.65%   98.65%           
=======================================
  Files           8        8           
  Lines         223      223           
=======================================
  Hits          220      220           
  Misses          3        3           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 93691b4...7e74162. Read the comment docs.

@@ -0,0 +1,100 @@
# Using Pathfinder to initializing sampling with Turing

If you have a _differentiable_ Turing model, then you can use Pathfinder to initialize its parameters.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just my two cents. Differentiable Turing model means one that do not have for loops and integers? Like a model which would run in Zygote or ReverseDiff?

Maybe explain with a footnote?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, yeah I wrote the text hastily. Should say the technical requirements are that all parameters are continuous and the log-density can be differentiated by an AD framework.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that what I got the intuition. But a footnote would solve this all. Thanks!

@sethaxen sethaxen closed this Nov 6, 2021
@sethaxen sethaxen reopened this Nov 6, 2021
@sethaxen
Copy link
Member Author

With #25, we can run Pathfinder on a Turing DynamicPPL.Model model as follows:

prob = optim_problem(model, MAP(); constrained=false)
pathfinder(prob, 1)

It's probably worth it to add a conditionally loaded interface for a Turing model that makes it easy to draw samples into a format useful for Turing users, e.g. as an MCMCChains.Chains.

@sethaxen sethaxen closed this May 4, 2022
@sethaxen sethaxen deleted the turing_docs branch May 4, 2022 01:28
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.

2 participants