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

n_steps control for pocoMC #133

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cosmosis/samplers/poco/poco_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def config(self):
self.flow = self.read_ini("flow", str, "nsf6")
self.precondition = self.read_ini("precondition", bool, True)
self.dynamic = self.read_ini("dynamic", bool, True)
self.n_steps = self.read_ini("n_steps", int, len(pipeline.varied_params))
self.n_max_steps = self.read_ini("n_max_steps", int, 10*len(pipeline.varied_params))
seed = self.read_ini("seed", int, 0)
if seed == 0:
seed = None
Expand Down Expand Up @@ -79,6 +81,8 @@ def config(self):
flow=self.flow,
precondition=self.precondition,
dynamic=self.dynamic,
n_steps=self.n_steps,
n_max_steps=self.n_max_steps,
output_dir=self.output_dir,
pool=self.pool,
blobs_dtype=float,
Expand Down
2 changes: 2 additions & 0 deletions cosmosis/samplers/poco/sampler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ params:
dynamic: (bool, default=True) Whether to use dynamic particle allocation.
n_total: (integer, default=4096) Total number of effective samples to generate. Higher values will increase the accuracy of the posterior estimate (recommended ~10000 for publication quality corner plots).
n_evidence: (integer, default=4096) Number of samples to generate for the Bayesian evidence calculation.
n_steps: (integer, default=None) Number of MCMC steps. This will be automatically adjusted based on the sampling efficiency. Default is `n_steps=n_dim`. Larger values will provide more robust results at higher computational cost.
n_max_steps: (integer, default=None) Maximum number of MCMC steps. Default is `n_max_steps=10*n_dim`. This should be greater than `n_steps`.
save_every: (int, default=None) Save the state of the sampler every `save_every` iterations. If not provided, the sampler will not save intermediate states.
seed: (int; default=0) A random seed for reproducibility. Default is to generate automatically.
progress: (bool, default=True) Whether to show a progress bar during sampling.
Loading