Wrapped transformations

Wrapped transformations

abstract type TransformationWrapper <: Function

Wrap a transformation to achieve some specialized functionality.

Supports length, get_transformation, and other methods depending on the subtype.

TransformLogLikelihood(ℓ, transformation::Union{Tuple, GroupedTransformation})

TransformLogLikelihood(ℓ, transformations...)

Return a callable that

  1. transforms its vector argument using a grouped transformation to a set of values,

  2. calls (which should return a scalar) with this tuple.

  3. returns the result above corrected by the log Jacobians.

Useful when is a log-likelihood function with a restricted domain, and transformations is used to trasform to this domain from $ℝ^n$.

See also get_transformation, get_distribution, Distributions.logpdf, and logpdf_in_domain.


Return the log likelihood function.

TransformDistribution(distribution, transformation)

Given a transformation and a distribution, create a transformed distribution object that has the distribution of transformation(x) with x ∼ distribution.

The transformation object is callable with the same syntax as transformation. It also supports methods rand, length.

See also logpdf_in_domain and logpdf_in_image.


Return the wrapped distribution.

logpdf_in_domain(t, x)

The log pdf for a transformed distribution at t(x) in image, calculated in the domain without performing the transformation.

The log pdf is adjusted with the log determinant of the Jacobian, ie the following holds:

julia logpdf_in_image(t, t(x)) == logpdf_in_domain(t, x)

See logpdf_in_image.


Typical usage of this function would be drawing some random xs from the contained distribution (possibly also used for some other purpose), and obtaining the log pdfs at t(y) with the same values.

logpdf_in_image(t, y)

The log pdf for a transformed distribution at y in image.

See also logpdf_in_domain.