本文整理汇总了Python中dynesty.DynamicNestedSampler方法的典型用法代码示例。如果您正苦于以下问题:Python dynesty.DynamicNestedSampler方法的具体用法?Python dynesty.DynamicNestedSampler怎么用?Python dynesty.DynamicNestedSampler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dynesty
的用法示例。
在下文中一共展示了dynesty.DynamicNestedSampler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_sampler
# 需要导入模块: import dynesty [as 别名]
# 或者: from dynesty import DynamicNestedSampler [as 别名]
def run_sampler(self):
import dynesty
self.sampler = dynesty.DynamicNestedSampler(
loglikelihood=self.log_likelihood,
prior_transform=self.prior_transform,
ndim=self.ndim, **self.sampler_init_kwargs)
if self.check_point:
out = self._run_external_sampler_with_checkpointing()
else:
out = self._run_external_sampler_without_checkpointing()
# Flushes the output to force a line break
if self.kwargs["verbose"]:
print("")
# self.result.sampler_output = out
self._generate_result(out)
if self.plot:
self.generate_trace_plots(out)
return self.result
示例2: __init__
# 需要导入模块: import dynesty [as 别名]
# 或者: from dynesty import DynamicNestedSampler [as 别名]
def __init__(self, model, nlive, nprocesses=1,
loglikelihood_function=None, use_mpi=False, run_kwds=None,
**kwargs):
self.model = model
log_likelihood_call, prior_call = setup_calls(
model,
nprocesses=nprocesses,
loglikelihood_function=loglikelihood_function)
# Set up the pool
pool = choose_pool(mpi=use_mpi, processes=nprocesses)
if pool is not None:
pool.size = nprocesses
self.run_kwds = {} if run_kwds is None else run_kwds
self.nlive = nlive
self.names = model.sampling_params
self.ndim = len(model.sampling_params)
self.checkpoint_file = None
if self.nlive < 0:
# Interpret a negative input value for the number of live points
# (which is clearly an invalid input in all senses)
# as the desire to dynamically determine that number
self._sampler = dynesty.DynamicNestedSampler(log_likelihood_call,
prior_call, self.ndim,
pool=pool, **kwargs)
else:
self._sampler = dynesty.NestedSampler(log_likelihood_call,
prior_call, self.ndim,
nlive=self.nlive,
pool=pool, **kwargs)