本文整理匯總了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)