Skip to main content

Module sample

Module sample 

Source
Expand description

Library-side orchestration for NUTS posterior sampling from a saved model.

The CLI’s gam sample subcommand and the Python Model.sample(...) API both call into sample_saved_model, which dispatches on the saved model’s class (standard GLM, standard with link-wiggle, or survival) and returns a fully-converged NutsResult over the original coefficient space. Gaussian identity standard models are sampled from the saved closed-form posterior, conditioning on the training fit rather than any prediction rows supplied by the caller.

Re-exports§

pub use super::hmc_io::NutsConfig;
pub use super::hmc_io::NutsResult;

Functions§

laplace_gaussian_fallback
Draw iid samples from N(mode, H^{-1}) using the saved penalised Hessian H = L L^T.
sample_saved_model
Run NUTS posterior sampling over a saved model.
saved_baseline_timewiggle_spec
Reconstruct the LinkWiggleFormulaSpec from a saved model’s baseline-time-wiggle runtime, returning None when the model has no time-wiggle component. Re-exported because the survival fitter’s tests exercise the spec independently of running NUTS.