-
Notifications
You must be signed in to change notification settings - Fork 137
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
Exact Hamiltonian Monte Carlo for exponential sampling #142
Conversation
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.
My review is done for this PR. The last recommendation is the addition of tests. Tests can be added to the logconcave_sampling_test.cpp
file which exists already in test/
.
Thank you in advance!
|
||
// Exact HMC for sampling from the Exponential distribution restricted to a convex polytope | ||
|
||
struct HMCExponentialWalk |
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.
I think here you should change the name of the struct to agree with the one that's already in the develop branch, namely HMCExponentialWalk -> HamiltonianMonteCarloExactExponentialWalk.
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.
Thanks for the comment. I renamed it to "ExponentialHamiltonianMonteCarloExactWalk".
@@ -20,6 +20,7 @@ | |||
#include "random_walks/uniform_john_walk.hpp" | |||
#include "random_walks/uniform_vaidya_walk.hpp" | |||
#include "random_walks/uniform_accelerated_billiard_walk.hpp" | |||
#include "random_walks/exponential_hamiltonian_monte_carlo_walk.hpp" |
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.
Please keep header names consistent. If the struct name has exponential after hmc, it should be better if it's the same here.
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.
I renamed it accordingly to the previous comment.
< | ||
typename Walk | ||
> | ||
struct ExponentialRandomPointGenerator |
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.
Apply naming consistency if needed.
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.
I think this is consistent with the other structure names.
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.
Thanks, very nice PR! I have a few comments mostly on style but also on robustness, simplification of code and testing.
include/random_walks/exponential_hamiltonian_monte_carlo_walk.hpp
Outdated
Show resolved
Hide resolved
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.
Great! See my comments on #144 for a final change on the macro RVOLESTI
.
Point _v; | ||
Point _c; | ||
NT _Temp; | ||
const double _tol = 1e-10; |
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.
this could be static
, right?
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.
Thanks for the comment. However, this will give us a compile error in the R interface.
I used #define IN_INSIDE_BODY_TOLLERANCE 1e-10
.
This is merged with #144 |
This PR implements exact Hamiltonian Monte Carlo for exponential sampling.
Algorithmic details:
-- The exact HMC for exponential sampling exploits quadratic polynomial trajectories in the interior of the polytope.
-- When the trajectory hits the boundary it is reflected.
Implementation details:
-- The sampler is implemented by a new structure.
-- The PR includes a new C++ interface for exponential sampling.
-- The sampler is integrated into the R interface of volesti.
-- There is a probability of failure for small values of variance. The implementation stops when it fails to generate the next point of the random walk.