Trait nuts_rs::Chain

source ·
pub trait Chain<M: Math>: SamplerStats<M> {
    type Hamiltonian: Hamiltonian<M>;
    type AdaptStrategy: AdaptStrategy<M>;

    // Required methods
    fn set_position(&mut self, position: &[f64]) -> Result<(), NutsError>;
    fn draw(&mut self) -> Result<(Box<[f64]>, Self::Stats), NutsError>;
    fn stats_summary(stats: &Self::Stats) -> SampleStats;
    fn dim(&self) -> usize;
}
Expand description

Draw samples from the posterior distribution using Hamiltonian MCMC.

Required Associated Types§

source

type Hamiltonian: Hamiltonian<M>

source

type AdaptStrategy: AdaptStrategy<M>

Required Methods§

source

fn set_position(&mut self, position: &[f64]) -> Result<(), NutsError>

Initialize the sampler to a position. This should be called before calling draw.

This fails if the logp function returns an error.

source

fn draw(&mut self) -> Result<(Box<[f64]>, Self::Stats), NutsError>

Draw a new sample and return the position and some diagnosic information.

source

fn stats_summary(stats: &Self::Stats) -> SampleStats

source

fn dim(&self) -> usize

The dimensionality of the posterior.

Object Safety§

This trait is not object safe.

Implementors§