Skip to content

Commit

Permalink
n_steps control for pocoMC
Browse files Browse the repository at this point in the history
  • Loading branch information
minaskar committed Jul 11, 2024
1 parent 4f84106 commit 0d8bc41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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 = seld.read_ini("n_steps", int, len(pipeline.varied_params))
self.n_max_steps = seld.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.

0 comments on commit 0d8bc41

Please sign in to comment.