Dist.biject_parameters()

Dist.biject_parameters()#

Dist.biject_parameters(bijectors='auto', inference=None)[source]#

Transforms distribution parameters using bijectors with eager evaluation.

This method applies bijectors to the distribution’s parameters immediately. Only strong Var parameters (with parameter=True and not weak) will be transformed. Variable-level bijectors always take precedence over distribution-level bijectors.

Parameters:

bijectors (Literal['auto'] | dict[str, TypeAliasType | Literal['auto'] | None] | Sequence[TypeAliasType | Literal['auto'] | None], default: 'auto') – Bijector specification. Options: - "auto": Use default parameter bijectors from the distribution’s parameter_properties(). Parameters without a default bijector (e.g., Wishart’s df parameter) are skipped. - dict: Map parameter names to bijectors. Use "auto" for default, None to skip, or provide an explicit bijector instance/class. - Sequence: Bijectors for positional parameters in the order they appear in the distribution’s __init__ signature. inference Inference information for transformed variables. If "drop", inference information is removed from original parameters. If None, an error will be raised if inference is present for any parameter that is selected for bijection.

Return type:

Self

Returns:

Self

Notes

A default bijector’s forward is expected to map from unconstrained to constrained space. Consequently, its inverse is expected to map from constrained to unconstrained space.

For custom TensorFlow Probability distributions, parameter_properties() must return a dictionary with parameter names as keys and ParameterProperties instances as values. The dict order must match the distribution’s __init__ signature order.

See also

Var.biject

Method for transforming individual variables.

Examples

>>> scale = lsl.Var.new_param(1.0, name="scale")
>>> rate = lsl.Var.new_param(1.0, name="rate")

Auto-transform all parameters:

>>> dist = lsl.Dist(tfd.Gamma, concentration=scale, rate=rate, bijectors="auto")
>>> scale.weak  # Now weak, transformed
True

Transform only specific parameters:

>>> scale = lsl.Var.new_param(1.0, name="scale")
>>> rate = lsl.Var.new_param(1.0, name="rate")
>>> dist = lsl.Dist(
...     tfd.Normal,
...     loc=0.0,
...     scale=scale,
...     bijectors={"scale": "auto", "loc": None},
... )