Trait nuts_rs::Chain

source ·
pub trait Chain {
    type Hamiltonian: Hamiltonian;
    type AdaptStrategy: AdaptStrategy;
    type Stats: SampleStats + 'static;
    type Builder: ArrowBuilder<Self::Stats>;

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

Draw samples from the posterior distribution using Hamiltonian MCMC.

Required Associated Types§

source

type Hamiltonian: Hamiltonian

source

type AdaptStrategy: AdaptStrategy

source

type Stats: SampleStats + 'static

source

type Builder: ArrowBuilder<Self::Stats>

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 dim(&self) -> usize

The dimensionality of the posterior.

source

fn stats_builder(&self, dim: usize, settings: &SamplerArgs) -> Self::Builder

Implementors§