-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add support for constructing target distribution from formula #66
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…bution and trace function
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #66 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 11 11
Lines 525 564 +39
=========================================
+ Hits 525 564 +39 ☔ View full report in Codecov by Sentry. |
Clarify trace_function allowable output types
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for specifying target distribution by specifying a formula for log density using R
~
formula syntax (only right-hand side of formula is used). A function to compute log density and its gradient is then constructed using thestats::deriv
function along with a function to trace variables from chain state.As well as adding a utility function for this conversion, this PR also changes the behaviour of
sample_chain
to allow accepting formulas andbridgestan
Stan models directly as thetarget_distribution
argument, with these then converted internally to a list of functions. As part of this the separatetrace_function
optional argument has been removed in favour of assuming this is specified as part of thetarget_distribution
list (or constructed from the formula / Stan model).