- Notifications
You must be signed in to change notification settings - Fork190
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[WIP] Imbedded Laplace Approximation#3097
Draft
SteveBronder wants to merge189 commits intodevelopChoose a base branch fromexperimental/laplace
base:develop
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Draft
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
…ev/math into try-laplace_approximation
fvar<fvar<var>> target_ffvar = 0; | ||
VectorXd v(theta_size); | ||
VectorXd w(theta_size); | ||
for (Eigen::Index i = 0; i < hessian_block_size; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Note for myself. I think for a large enough Hessian block size we could run this loop using a tbb parallel for loop
…into fixme_negbinomial
…e' into experimental/laplace
Sign up for freeto 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.
Summary
Code for the embedded laplace approximation. The tests are all passing but there is a few things still needed
The file for laplace have been added to the
mix
folder since it uses higher order auto diff.The current signature for the generalized laplace looks like the following in C++
which will translate to stan like the following
Note that the first tuple used for the likelihood argumentsmust be data.
Instead of using a tuple for the first functor's inputs and variadic arguments for the covariance functors arguments I would rather have them both be tuples like the following
I think this is nice because it makes it makes the tolerance parameters always sit at the end and both functors have the same input scheme for their arguments. Does anyone have thoughts on this
Other additions related to this PR
filter_map
function that applies a conditionally applies a lambdaf
to each input of a tuple given atype_trait
i.e. the following code would print "fp detected" twice and increment thedouble
elements of the tuple by 1.The test_ad suite now has a compile time option for only running the tests with only prim and reverse mode with a new boolean template parameter to
expect_ad
. This is needed to use laplace with the test framework as the laplace impl here does not work with higer order autodiff (since it needs higher order autodiff)Tests
Since the tests all seem very related I kept them in their own folder, is that alright? Or should I distribute them across the test folders like normal? While this PR is WIP I'm going to leave them in the same folder and if we don't want that then we can move them before we merge
Side Effects
Release notes
Checklist
Copyright holder: Simon's Foundation
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit
)make test-headers
)make test-math-dependencies
)make doxygen
)make cpplint
)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested