Skip to main content

ConditionalDistribution

Trait ConditionalDistribution 

Source
pub trait ConditionalDistribution: Send + Sync {
    // Required methods
    fn sample_conditional<R: Rng + ?Sized>(
        &self,
        current_state: &Array1<f64>,
        variable_index: usize,
        rng: &mut R,
    ) -> Result<f64>;
    fn dim(&self) -> usize;

    // Provided method
    fn log_density(&self, x: &Array1<f64>) -> Option<f64> { ... }
}
Expand description

Conditional distribution trait for Gibbs sampling

Required Methods§

Source

fn sample_conditional<R: Rng + ?Sized>( &self, current_state: &Array1<f64>, variable_index: usize, rng: &mut R, ) -> Result<f64>

Sample from the conditional distribution P(X_i | X_{-i})

§Arguments
  • current_state - Current values of all variables
  • variable_index - Index of the variable to sample
  • rng - Random number generator
§Returns

New value for the variable at variable_index

Source

fn dim(&self) -> usize

Get the dimensionality of the distribution

Provided Methods§

Source

fn log_density(&self, x: &Array1<f64>) -> Option<f64>

Optionally compute log density for monitoring

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§