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

Exact Hamiltonian Monte Carlo for exponential sampling #142

Closed
wants to merge 24 commits into from

Conversation

TolisChal
Copy link
Member

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.

Copy link
Collaborator

@papachristoumarios papachristoumarios left a 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
Copy link
Collaborator

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.

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 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"
Copy link
Collaborator

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.

Copy link
Member Author

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
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Member

@vissarion vissarion left a 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.

Copy link
Collaborator

@papachristoumarios papachristoumarios left a 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;
Copy link
Member

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?

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 for the comment. However, this will give us a compile error in the R interface.
I used #define IN_INSIDE_BODY_TOLLERANCE 1e-10.

@vissarion vissarion mentioned this pull request Sep 21, 2021
@vissarion vissarion added the dingo label Oct 1, 2021
@vissarion
Copy link
Member

This is merged with #144

@vissarion vissarion closed this Oct 3, 2021
@TolisChal TolisChal deleted the hmc_exponential branch June 21, 2024 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants