TransformationDist#

class liesel_ptm.TransformationDist(coef, bspline, parametric_distribution=None, reference_distribution=None, validate_args=False, allow_nan_stats=True, name='TransformationDist', centered=False, scaled=False, batched=True, **parametric_distribution_kwargs)[source]#

Bases: Distribution

Transformation distribution using a spline and optional parametric component.

This combines a spline-based monotonically increasing transformation with a parametric distribution, using a reference distribution (default: standard normal) for mapping and likelihoods.

Parameters:
  • coef (Any) – Coefficients for the spline basis.

  • bspline (PTMSpline | OnionSpline) – Spline object providing transformation and its inverse/derivative.

  • parametric_distribution (type[Distribution] | None) – Parametric distribution class to include in the model. (default: None)

  • reference_distribution (Distribution | None) – Reference distribution used for transformations; defaults to Normal(0, 1). (default: None)

  • validate_args (bool) – Whether to validate input arguments. (default: False)

  • allow_nan_stats (bool) – Whether to allow NaN statistics. (default: True)

  • name (str) – Name of the distribution. (default: 'TransformationDist')

  • centered (bool) – If True, the transformation is centered such that any side-effect the spline transformation might have on the location of the distribution is negated. (default: False)

  • scaled (bool) – If True, the transformation is scaled such that any side-effect the spline transformation might have on the scale of the distribution is negated. (default: False)

  • batched (bool) – If True, allow for batched computations (might be slightly less efficient in the scalar case). (default: True)

  • **parametric_distribution_kwargs – Additional keyword arguments passed to the parametric distribution.

coef#

Coefficients for the spline basis.

bspline#

Spline object used for transformations.

reference_distribution#

Reference distribution used for mapping and likelihoods.

parametric_distribution#

Instantiated parametric distribution if provided, else None.

parametric_distribution_kwargs#

Keyword arguments used to construct the parametric distribution.

centered#

Indicates whether centering is applied.

scaled#

Indicates whether scaling is applied.

Methods

cdf_spline

CDF under the spline-only transformation.

inverse_transformation

Inverse transformation combining parametric and spline parts.

inverse_transformation_parametric

Inverse of the parametric transformation.

inverse_transformation_spline

Inverse of the spline transformation.

log_prob_spline

Log probability under the spline-only transformation.

prob_spline

Probability under the spline-only transformation.

quantile_spline

Quantile function using only the spline transformation.

transformation_and_logdet

Apply parametric then spline transforms; return value and logdet.

transformation_and_logdet_parametric

Apply the parametric transformation and its log determinant.

transformation_and_logdet_spline

Apply spline transformation with centering/scaling and compute logdet.

transformation_spline_mean

Expected value under the spline transformation.

transformation_spline_variance

Variance under the spline transformation.

Attributes