Skip to main content

LaplaceMarginalSampler

Trait LaplaceMarginalSampler 

Source
pub trait LaplaceMarginalSampler: Send + Sync {
    // Required methods
    fn directional_cubic_diagnostic(
        &self,
        hessian: &Array2<f64>,
        design: &DesignMatrix,
        c_weights: &Array1<f64>,
        refine_supremum: bool,
    ) -> Result<(f64, Array1<f64>), String>;
    fn block_sampled_marginal_correction(
        &self,
        target: &dyn BlockExcessTarget,
    ) -> Result<BlockSampledMarginal, String>;
}
Expand description

The gam-inference-tier sampler for the #784 block-local Laplace correction.

Implemented UP in the monolith over hmc_io (laplace_directional_cubic_diagnostic + block_sampled_marginal_correction) and injected DOWN via set_laplace_marginal_sampler. gam-solve calls through laplace_marginal_sampler.

Required Methods§

Source

fn directional_cubic_diagnostic( &self, hessian: &Array2<f64>, design: &DesignMatrix, c_weights: &Array1<f64>, refine_supremum: bool, ) -> Result<(f64, Array1<f64>), String>

Per-direction standardized cubic skewness γ_r of the local posterior: returns (max_r |γ_r|, γ). Pure eigen-diagnostic (no sampling), but kept behind the trait because it lives in the sampler module up-tier.

Source

fn block_sampled_marginal_correction( &self, target: &dyn BlockExcessTarget, ) -> Result<BlockSampledMarginal, String>

Estimate Δ_b and its ρ-gradient by importance sampling against the local Laplace Gaussian, contracting the caller-supplied BlockExcessTarget.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§