Kernel#

class liesel.goose.types.Kernel(*args, **kwargs)[source]#

Bases: Protocol[liesel.goose.types.TKernelState, liesel.goose.types.TTransitionInfo, liesel.goose.types.TTuningInfo]

Protocol for a transition kernel.

Methods

end_epoch(prng_key, kernel_state, ...)

Called at the end of an epoch.

end_warmup(prng_key, kernel_state, ...)

Asks the kernel to inspect the warmup history and react to it.

has_model()

Whether the model interface is set.

init_state(prng_key, model_state)

Creates the initial kernel state.

set_model(model)

Sets the model interface.

start_epoch(prng_key, kernel_state, ...)

Called at the beginning of an epoch.

transition(prng_key, kernel_state, ...)

Handles one transition.

tune(prng_key, kernel_state, model_state, ...)

The method can perform automatic tuning of the kernel and is called after each adaptation epoch.

Attributes

identifier

An identifier for the kernel object that is set by the EngineBuilder if it is an empty string.

needs_history

Is set to true if the kernel expects the history for tuning.

error_book

Maps error codes to error messages.

position_keys

Keys for which the kernel handles the transition.