sequince.steps.mutation.adaptive.base#

Shared lifecycle for adaptation after completed mutation blocks.

Classes#

AdaptiveMutationStep

Base for eager adaptation after a complete mutation block.

Module Contents#

class sequince.steps.mutation.adaptive.base.AdaptiveMutationStep(mutation)[source]#

Bases: sequince.steps.base.SMCStep, abc.ABC

Base for eager adaptation after a complete mutation block.

Subclasses prepare context and optionally choose a fixed budget in _prepare_mutation, then consume finalized metrics in _adapt. The base executes the child once, preserves its output, and forwards child checkpoint state. Adaptation cannot interrupt the current mutation block.

Parameters:

mutation (sequince.steps.base.SMCStep | sequince.steps.base.FixedLengthMutation)

mutation: sequince.steps.base.SMCStep | sequince.steps.base.FixedLengthMutation#
apply(state, context, rng)[source]#
Parameters:
Return type:

tuple[sequince.state.ParticleState, sequince.steps.context.StepContext, Any]

abstractmethod apply_functional(state, context, random_state)[source]#

Apply a functional step to particle step.

This returns the updated state, context, next random state, and any additional outputs.

This method is intended for use in functional SMC iterations where the random state is explicitly threaded through the computation.

state_dict()[source]#

Forward the wrapped mutation’s checkpoint state.

Return type:

dict[str, Any]

load_state_dict(state)[source]#

Restore the wrapped mutation’s checkpoint state.

Parameters:

state (collections.abc.Mapping[str, Any])

Return type:

None