Dynesty Sampler #904
Felipe-4
started this conversation in
Show and tell
Replies: 1 comment
-
Hi @Felipe-4! This is not the neatest thing to do as the changes are pretty strongly integrated into Bilby, but it can be done. I've put in a snippet that works for me combing this dynesty test with logic from this method. This specifically uses the import numpy as np
import dynesty
from bilby.core.sampler.base_sampler import _SamplingContainer
from bilby.core.sampler.dynesty_utils import LivePointSampler, ACTTrackingRWalk
nlive = 1000
# printing = get_printing()
# EGGBOX
# see 1306.2144
def loglike_egg(x):
logl = ((2 + np.cos(x[0] / 2) * np.cos(x[1] / 2))**5)
return logl
def prior_transform_egg(x):
return x * 10 * np.pi
LOGZ_TRUTH = 235.856
def test_bounds(bound, sample):
# stress test various boundaries
ndim = 2
# rstate = get_rstate()
sampler = dynesty.NestedSampler(loglike_egg,
prior_transform_egg,
ndim,
nlive=nlive,
bound=bound,
sample=sample,
walks=10, # note there is an additional needed waveform kwargs
)
sampler.run_nested(dlogz=0.01, print_progress=True)
assert (abs(LOGZ_TRUTH - sampler.results.logz[-1]) <
5. * sampler.results.logzerr[-1])
# here I register the new sampling methods
dynesty.dynamicsampler._SAMPLERS["live"] = LivePointSampler
dynesty.nestedsamplers._SAMPLING["act-walk"] = ACTTrackingRWalk()
# this is an unfortunately needed Bilby argument
_SamplingContainer.maxmcmc = 100000
test_bounds(bound="live", sample="act-walk") I'm going to move this to a discussion rather than an issue, as I think that is more appropriate for this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is not a bug, or a problem, but I didn't find any specific bilby forum.
It seems to me that there are differences between the dynamic nested sampling implemented by dynesty and the one by bilby. I want to use the bilby one, but I need a sampler with the same syntax of the dynesty software, that is, I just pass the loglikelihood and the prior transform function, from the unit cube to my actual prior. Is there such a function in bilby?
Beta Was this translation helpful? Give feedback.
All reactions