Skip to content
Snippets Groups Projects
Commit 10ab5d05 authored by Moritz Huebner's avatar Moritz Huebner
Browse files

Merge branch 'dynesty_default_nlive' into 'master'

Resolve "Default 'walks' for dynesty"

Closes #557

See merge request lscsoft/bilby!961
parents 678c4032 a8ea8790
No related branches found
No related tags found
No related merge requests found
...@@ -101,7 +101,9 @@ class Dynesty(NestedSampler): ...@@ -101,7 +101,9 @@ class Dynesty(NestedSampler):
Method used to sample uniformly within the likelihood constraints, Method used to sample uniformly within the likelihood constraints,
conditioned on the provided bounds conditioned on the provided bounds
walks: int walks: int
Number of walks taken if using `sample='rwalk'`, defaults to `ndim * 10` Number of walks taken if using `sample='rwalk'`, defaults to `100`.
Note that the default `walks` in dynesty itself is 25, although using
`ndim * 10` can be a reasonable rule of thumb for new problems.
dlogz: float, (0.1) dlogz: float, (0.1)
Stopping criteria Stopping criteria
verbose: Bool verbose: Bool
...@@ -212,7 +214,7 @@ class Dynesty(NestedSampler): ...@@ -212,7 +214,7 @@ class Dynesty(NestedSampler):
def _verify_kwargs_against_default_kwargs(self): def _verify_kwargs_against_default_kwargs(self):
from tqdm.auto import tqdm from tqdm.auto import tqdm
if not self.kwargs['walks']: if not self.kwargs['walks']:
self.kwargs['walks'] = self.ndim * 10 self.kwargs['walks'] = 100
if not self.kwargs['update_interval']: if not self.kwargs['update_interval']:
self.kwargs['update_interval'] = int(0.6 * self.kwargs['nlive']) self.kwargs['update_interval'] = int(0.6 * self.kwargs['nlive'])
if self.kwargs['print_func'] is None: if self.kwargs['print_func'] is None:
...@@ -324,7 +326,7 @@ class Dynesty(NestedSampler): ...@@ -324,7 +326,7 @@ class Dynesty(NestedSampler):
"Using the bilby-implemented rwalk sample method with ACT estimated walks") "Using the bilby-implemented rwalk sample method with ACT estimated walks")
dynesty.dynesty._SAMPLING["rwalk"] = sample_rwalk_bilby dynesty.dynesty._SAMPLING["rwalk"] = sample_rwalk_bilby
dynesty.nestedsamplers._SAMPLING["rwalk"] = sample_rwalk_bilby dynesty.nestedsamplers._SAMPLING["rwalk"] = sample_rwalk_bilby
if self.kwargs.get("walks", 25) > self.kwargs.get("maxmcmc"): if self.kwargs.get("walks") > self.kwargs.get("maxmcmc"):
raise DynestySetupError("You have maxmcmc > walks (minimum mcmc)") raise DynestySetupError("You have maxmcmc > walks (minimum mcmc)")
if self.kwargs.get("nact", 5) < 1: if self.kwargs.get("nact", 5) < 1:
raise DynestySetupError("Unable to run with nact < 1") raise DynestySetupError("Unable to run with nact < 1")
...@@ -728,8 +730,8 @@ def sample_rwalk_bilby(args): ...@@ -728,8 +730,8 @@ def sample_rwalk_bilby(args):
# Setup. # Setup.
n = len(u) n = len(u)
walks = kwargs.get('walks', 25) # minimum number of steps walks = kwargs.get('walks', 100) # minimum number of steps
maxmcmc = kwargs.get('maxmcmc', 2000) # Maximum number of steps maxmcmc = kwargs.get('maxmcmc', 5000) # Maximum number of steps
nact = kwargs.get('nact', 5) # Number of ACT nact = kwargs.get('nact', 5) # Number of ACT
old_act = kwargs.get('old_act', walks) old_act = kwargs.get('old_act', walks)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment