sequince.steps.mutation.adaptive.de#
Adapt a DE scale mixture only between outer SMC iterations.
Classes#
Replace immutable DE weights at the next outer iteration (eager only). |
Module Contents#
- class sequince.steps.mutation.adaptive.de.AdaptDEScaleWeights(mutation, policy=None)[source]#
Bases:
sequince.steps.mutation.adaptive.base.AdaptiveMutationStepReplace immutable DE weights at the next outer iteration (eager only).
- Parameters:
mutation (RedBlueMetropolisHastingsMutation or RepeatedMutationStep) – DE mutation or a complete repeated block whose leaf uses a DifferentialEvolutionKernel. Wrap the complete block so weights stay fixed across all rounds. Place conditional execution outside.
policy (DEScaleWeightPolicy or None) – Policy selecting weights from completed metrics. Defaults to ESJDScaleWeightPolicy. The multiplier bank and unit-move probability remain unchanged.
Notes
Compose as
AdaptMutationSteps(AdaptDEScaleWeights(mutation), ...)to adapt both budgets and weights. Repeated calls at the same context iteration reuse frozen weights and consult the policy only once. The next weights are installed on entering the next iteration, never midway through a block. The wrapped kernel configuration is owned by this wrapper; do not share the mutation with another adapter or replace its kernel.Required DEScaleMetrics are configured once on the leaf, preserving user metrics. An existing de_scales metric must match the configured scale bank.
Completed metrics gain a
de_scale_adaptationentry containingweightsused for this block andnext_weights. Checkpoints retain both decisions and nested child/policy state. Reconstruct the same bank, kernel parameters and policy configuration before loading a checkpoint.- policy#
- property current_weights: tuple[float, ...] | None#
Weights frozen for the current or most recent outer iteration.
- apply_with_n_steps(state, context, rng, *, n_steps)[source]#
Run a complete block with a budget supplied by an outer adapter.
- Parameters:
state (sequince.state.ParticleState)
context (sequince.steps.context.StepContext)
rng (orng.RandomGenerator)
n_steps (int)
- Return type:
tuple[sequince.state.ParticleState, sequince.steps.context.StepContext, Any]
- load_state_dict(state)[source]#
Restore decisions without rerunning the policy.
- Parameters:
state (collections.abc.Mapping[str, Any])
- Return type:
None