sequince.steps.transformations#
Attributes#
Classes#
Transformation between successive SMC targets. |
|
Same-space transformation that only updates metadata. |
|
Apply a general SMC transformation and expose it to later steps. |
|
Apply an SMC transformation that increases the particle dimension. |
Module Contents#
- sequince.steps.transformations.logger#
- sequince.steps.transformations.MetadataUpdateFn#
- class sequince.steps.transformations.SMCTransformation[source]#
Transformation between successive SMC targets.
- forward(state, context, rng)[source]#
- Parameters:
state (sequince.state.ParticleState)
context (sequince.steps.context.StepContext)
rng (orng.RandomGenerator)
- Return type:
- forward_with_context(state, context, rng)[source]#
Apply the transformation and return its context explicitly.
- Parameters:
state (sequince.state.ParticleState)
context (sequince.steps.context.StepContext)
rng (orng.RandomGenerator)
- Return type:
tuple[sequince.state.ParticleState, sequince.steps.context.StepContext]
- inverse(particles, context)[source]#
- Parameters:
particles (sequince.typing.Array)
context (sequince.steps.context.StepContext)
- Return type:
sequince.typing.Array
- log_auxiliary_density(particles, context)[source]#
- Parameters:
particles (sequince.typing.Array)
context (sequince.steps.context.StepContext)
- Return type:
Array | float
- log_jacobian(particles, context)[source]#
- Parameters:
particles (sequince.typing.Array)
context (sequince.steps.context.StepContext)
- Return type:
Array | float
- make_log_proposal(base_log_proposal, context)[source]#
Return a log proposal function corresponding to the new proposal distribution after applying this transformation.
- Parameters:
base_log_proposal (Callable[..., Array | float]) – The log proposal function before applying the transformation.
context (sequince.steps.context.StepContext) – The step context, which may contain metadata needed to define the new log proposal.
- Return type:
Callable[…, Array | float]
- class sequince.steps.transformations.MetadataTransformation[source]#
Bases:
SMCTransformationSame-space transformation that only updates metadata.
- forward_with_context(state, context, rng)[source]#
Apply the transformation and return its context explicitly.
- Parameters:
state (sequince.state.ParticleState)
context (sequince.steps.context.StepContext)
rng (orng.RandomGenerator)
- Return type:
tuple[sequince.state.ParticleState, sequince.steps.context.StepContext]
- class sequince.steps.transformations.TransformationStep(transformation, *, posterior=None, transformation_key=SMC_TRANSFORMATION_KEY)[source]#
Bases:
sequince.steps.base.SMCStepApply a general SMC transformation and expose it to later steps.
- Parameters:
transformation (SMCTransformation)
posterior (TemperedPosterior | None)
transformation_key (str)
- apply(state, context, rng)[source]#
- Parameters:
state (sequince.state.ParticleState)
context (sequince.steps.context.StepContext)
rng (orng.RandomGenerator)
- Return type:
tuple[sequince.state.ParticleState, sequince.steps.context.StepContext, dict[str, Any]]
- class sequince.steps.transformations.ExpandDimensions(transformation, *, expected_block_size=None, metadata_key='dimensions', added_dimensions_key='added_dimensions', dimension_delta_key='last_dimension_delta', posterior=None, transformation_key=SMC_TRANSFORMATION_KEY)[source]#
Bases:
TransformationStepApply an SMC transformation that increases the particle dimension.
- Parameters:
transformation (SMCTransformation)
expected_block_size (int | None)
metadata_key (str)
added_dimensions_key (str)
dimension_delta_key (str)
posterior (TemperedPosterior | None)
transformation_key (str)
- apply(state, context, rng)[source]#
- Parameters:
state (sequince.state.ParticleState)
context (sequince.steps.context.StepContext)
rng (orng.RandomGenerator)
- Return type:
tuple[sequince.state.ParticleState, sequince.steps.context.StepContext, dict[str, Any]]