sequince.steps.transformations#

Attributes#

Classes#

SMCTransformation

Transformation between successive SMC targets.

MetadataTransformation

Same-space transformation that only updates metadata.

TransformationStep

Apply a general SMC transformation and expose it to later steps.

ExpandDimensions

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:
Return type:

sequince.state.ParticleState

forward_with_context(state, context, rng)[source]#

Apply the transformation and return its context explicitly.

Parameters:
Return type:

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

inverse(particles, context)[source]#
Parameters:
Return type:

sequince.typing.Array

log_auxiliary_density(particles, context)[source]#
Parameters:
Return type:

Array | float

log_jacobian(particles, context)[source]#
Parameters:
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: SMCTransformation

Same-space transformation that only updates metadata.

state_metadata_fn: MetadataUpdateFn | None = None#
context_metadata_fn: MetadataUpdateFn | None = None#
forward_with_context(state, context, rng)[source]#

Apply the transformation and return its context explicitly.

Parameters:
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.SMCStep

Apply a general SMC transformation and expose it to later steps.

Parameters:
apply(state, context, rng)[source]#
Parameters:
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: TransformationStep

Apply an SMC transformation that increases the particle dimension.

Parameters:
apply(state, context, rng)[source]#
Parameters:
Return type:

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