RWKernel#
- class liesel.goose.RWKernel(position_keys, initial_step_size=1.0, da_target_accept=0.234, da_gamma=0.05, da_kappa=0.75, da_t0=10, identifier='')[source]#
Bases:
ModelMixin,TransitionMixin[RWKernelState,DefaultTransitionInfo],ReprMixinA random walk kernel.
Uses Gaussian proposals, Metropolis-Hastings correction and dual averaging. Implements the
Kernelprotocol.The kernel uses a default Metropolis-Hastings target acceptance probability of 0.234, which is optimal for a random walk sampler (in a certain sense). See Gelman et al. (1997) Weak convergence and optimal scaling of random walk Metropolis algorithms: https://doi.org/10.1214/aoap/1034625254.
- Parameters:
position_keys (
Sequence[str]) – Sequence of position keys (variable names) handled by this kernel.initial_step_size (
float, default:1.0) – Value at which to start step size tuning.da_target_accept (
float, default:0.234) – Target acceptance probability for dual averaging algorithm.da_gamma (
float, default:0.05) – The adaptation regularization scale.da_kappa (
float, default:0.75) – The adaptation relaxation exponent.da_t0 (
int, default:10) – The adaptation iteration offset.identifier (
str, default:'') – An string acting as a unique identifier for this kernel.
Methods
end_epoch(prng_key, kernel_state, ...)Sets the step size as found by the dual averaging algorithm.
end_warmup(prng_key, kernel_state, ...)Currently does nothing.
init_state(prng_key, model_state)Initializes the kernel state.
start_epoch(prng_key, kernel_state, ...)Resets the state of the dual averaging algorithm.
tune(prng_key, kernel_state, model_state, epoch)Currently does nothing.
Attributes
Dict of error codes and their meaning.
Kernel identifier, set by
EngineBuilderWhether this kernel needs its history for tuning.
Tuple of position keys handled by this kernel.