Struct emcee::EnsembleSampler
[−]
[src]
pub struct EnsembleSampler<'a, T: Prob + 'a> { pub thin: usize, // some fields omitted }
Affine-invariant Markov-chain Monte Carlo sampler
Fields
thin: usize
Thin the stored chains by this much
Methods
impl<'a, T: Prob + 'a> EnsembleSampler<'a, T>
[src]
fn new(nwalkers: usize, dim: usize, lnprob: &'a T) -> Result<Self>
Create a new EnsembleSampler
Errors are handled by returning a Result
which contains
EmceeError::InvalidInputs
error variant for the following
errors:
- the number of walkers must be even * the number of walkers must be at least twice the number of parameters
fn seed(&mut self, seed: &[usize])
Swap the built in random number generator for a seedable one
This means the random number generation can be reproducable. Seed is whatever
SeedableRng.from_seed
accepts.
fn sample<F>(
&mut self,
params: &[Guess],
iterations: usize,
callback: F
) -> Result<Step> where
F: FnMut(Step),
&mut self,
params: &[Guess],
iterations: usize,
callback: F
) -> Result<Step> where
F: FnMut(Step),
Run the sampler with a callback called on each iteration
On each iteration, this function is called with an instance of Step
in the new
proposal position. The callback is passed as mutable so it can interact with state from the
calling site.
fn run_mcmc(&mut self, p0: &[Guess], niterations: usize) -> Result<Step>
Run the sampling
This runs the sampler for niterations
iterations. Errors are signalled by the function
returning a Result
fn set_initial_state(&mut self, state0: Step) -> &mut Self
Set the initial state of the sampler
fn flatchain(&self) -> Option<Vec<Guess>>
Return the samples as computed by the sampler
fn acceptance_fraction(&self) -> Vec<f64>
Return the number of iterations accepted, one value per walker
fn reset(&mut self)
Return the sampler to its default state