optimize API reference#

Samplers#

class optimize.samplers.ZeusSampler(obj=None, obj_args=None, obj_kwargs=None)#

Bases: optimize.samplers.emceeLikeSampler

A class to interface with the zeus sliced Ensemble Sampler.

init_sampler()#

Initializes the zues Ensemble sampler.

run_mcmc(pars=None, walkers=None, n_burn_steps=500, check_every=200, n_steps=75000, rel_tau_thresh=0.01, n_min_steps=1000, n_cores=1, n_taus_thresh=40, progress=True)#

Wrapper to perform a burn-in + full MCMC exploration.

Parameters
  • pars (Parameters, optional) – The starting parameters. Defaults to p0.

  • walkers (np.ndarray, optional) – The starting walkers. Defaults to calling self.init_walkers(pars).

  • n_burn_steps (int, optional) – The number of burn in steps. Defaults to 100 * pars.num_varied().

  • n_steps (int, optional) – The number of mcmc steps to perform in the full phase (post burn-in). Defaults to 50_000 * pars.num_varied().

  • rel_tau_thresh (float, optional) – The relative change in the auto-correlation time for convergence. This criterion must be met for all walkers. Defaults to 0.01.

  • n_min_steps (int, optional) – The minimum number of steps to run. Defaults to 1000

  • n_threads (int, optional) – The number of threads to use. Defaults to 1.

Returns

The sampler result, with keys: flat_chains, autocorrs, steps, pbest, errors, lnL.

Return type

dict

class optimize.samplers.emceeSampler(obj=None, obj_args=None, obj_kwargs=None)#

Bases: optimize.samplers.emceeLikeSampler

An class to interface to the emcee affine invariant Ensemble Sampler.

initialize_sampler()#

Initializes the emcee.Ensemble sampler.

run_mcmc(p0=None, obj=None, obj_args=None, obj_kwargs=None, n_burn_steps=500, check_every=200, n_steps=75000, rel_tau_thresh=0.01, n_min_steps=1000, n_cores=1, n_taus_thresh=40, progress=True)#

Wrapper to perform a burn-in + full MCMC exploration.

Parameters
  • pars (Parameters, optional) – The starting parameters. Defaults to p0.

  • walkers (np.ndarray, optional) – The starting walkers. Defaults to calling self.init_walkers(pars).

  • n_burn_steps (int, optional) – The number of burn in steps. Defaults to 100 * pars.num_varied.

  • n_steps (int, optional) – The number of mcmc steps to perform in the full phase (post burn-in). Defaults to 50_000 * pars.num_varied().

  • rel_tau_thresh (float, optional) – The relative change in the auto-correlation time for convergence. This criterion must be met for all walkers. Defaults to 0.01.

  • n_min_steps (int, optional) – The minimum number of steps to run. Defaults to 1000

  • n_threads (int, optional) – The number of threads to use. Defaults to 1.

Returns

The sampler result, with keys: flat_chains, autocorrs, steps, pbest, errors, lnL.

Return type

dict