-
Notifications
You must be signed in to change notification settings - Fork 122
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
Multiphase Monte Carlo Sampling #147
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.
Great, thanks! I have only a few comments.
R-proj/src/copula.cpp
Outdated
@@ -7,6 +7,7 @@ | |||
|
|||
//Contributed and/or modified by Apostolos Chalkis, as part of Google Summer of Code 2018 program. | |||
|
|||
|
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.
many files have this empty line insertion, could you undo these changes?
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.
done in root/R-proj
folder
|
||
NT variance = (normalized_samples.cwiseProduct(normalized_samples)).sum(); | ||
variance *= (1.0 / N); | ||
variance += NT(1e-16)*(samples_mean*samples_mean); |
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.
what is the purpose of this computation? why 1e-16
? Is this some magic number that simply works?
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.
Yes, it was added to avoid numerical overflow in case where (normalized_samples.cwiseProduct(normalized_samples)).sum()
is zero.
Now I use const NT eps = 1e-16;
@@ -173,15 +248,15 @@ struct AcceleratedBilliardWalk | |||
T -= _lambda_prev; | |||
P.compute_reflection(_v, _p, _update_parameters); | |||
|
|||
while (it <= 100*n) | |||
while (it <= 1000*n) |
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.
what is the reason behind this change? stability?
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.
Better performance in the initialization of the parameters when we have very skinny polytopes.
Now I use unsigned int _rho = 1000*n;
include/sampling/mmcs.hpp
Outdated
> | ||
void perform_mmcs_step(Polytope &P, | ||
RandomNumberGenerator &rng, | ||
const unsigned int &walk_length, |
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.
should this be unsigned int const&
as below ?
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.
done
include/sampling/mmcs.hpp
Outdated
unsigned int &total_samples, | ||
unsigned int const& num_rounding_steps, | ||
MT &TotalRandPoints, | ||
bool &complete, |
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 is is clearer if this functions returns this bool
and below you simply return true or false instead of setting this variable and return void.
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.
done
include/sampling/parallel_mmcs.hpp
Outdated
unsigned int &total_samples, | ||
unsigned int const& num_rounding_steps, | ||
MT &TotalRandPoints, | ||
bool &complete, |
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.
same as above
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.
done
This PR implements a Multiphase Monte Carlo Sampling (MMCS) algorithm that unifies sampling with distribution isotropization. The PR contains:
-- A C++ implementation of a single step of MMCS
-- A C++ class to update the Effective Sample Size for each new generated chain
-- A C++ implementation for the estimator of autocovariance in "Charles J. Geyer, Practical Markov Chain Monte Carlo, Statistical Science 1992."
-- New burn-in routines for Billiard Walk.
-- Two C++ examples to illustrate the new method.
This PR depends on #142 and #144