HypercubeTransform

Documentation for HypercubeTransform.

HypercubeTransform.NamedDistMethod
NamedDist(d::NamedTuple{N})
NamedDist(;dists...)

A Distribution with names N. This is useful to construct a set of random variables with a set of names attached to them.

julia> d = NamedDist((a=Normal(), b = Uniform(), c = MvNormal(randn(2), rand(2))))
julia> x = rand(d)
(a = 0.13789342, b = 0.2347895, c = [2.023984392, -3.09023840923])
julia> logpdf(d, x)

Note that NamedDist values passed to NamedDist can also be abstract collections of distributions as well

julia> d = NamedDist(a = Normal(),
                     b = MvNormal(ones(2)),
                     c = (Uniform(), InverseGamma())
                     d = (a = Normal(), Beta)
                    )

How this is done internally is considered an implementation detail and is not part of the public interface.

source
HypercubeTransform.TupleDistType
TupleDist(d::NTuple{N, <:Dists.Distribution})

Creates a multivariate distribution whose backing is a tuple. This is useful for small inhomogenous distributions.

source
HypercubeTransform.ascubeFunction
`ascube(c)

Constructs the object that contains the necessary information to move from the unit hypercube to the distribution space. This is the usual function to use when construct the transformation.

There are a few different behaviors depending on the type of the object.

  • If c::Distribution then this will store the distributions.
  • If c::Tuple{AbstractHypercubeTransform} then this will store the tuple

Examples

ascube(Normal())
ascube(MultivariateNormal())
ascube((Normal(), Normal(2.0)))
ascube( (α = Uniform(), β = Normal()) )
source
HypercubeTransform.asflatFunction
asflat(d::Distribution)

Computes the transformation of the support of the distribution d such that the variables live on ℝⁿ where n is the dimension of the problem. This is essentially what Turing and Stan do when reparameterizing the model.

The returned object is a TransformVariables.AbstractTransform object and follows that interface. Please see the TransformVariable docs for more information.

source
TransformVariables.inverseMethod
`inverse(c::AbstractHypercubeTransform, p)`

Transforms from the parameter space p, to the unit hypercube defined by the transformation c.

The behavior of this function depends on the nature of c.

  • If c is a <: Distributions.Distributions and has a cdf method

this will just call the cdf function. If no cdf function is defined then a custom transformation depending on the type of c will be called. If no custom transformation exists then an error will be raised.

  • If c is a Tuple of transformations then inverse will iterate through the

tuple using a similar method to the TransformVariables.jl method.

source
TransformVariables.transformFunction
transform(c::AbstractHypercubeTransform, p)

Transforms from the hypercube with coordinates p, to the parameter space defined by the transformation c.

The behavior of this function depends on the nature of c.

  • If c is a <: Distributions.Distributions and has a quantile method

this will just call the quantile function. If no quantile function is defined then a custom transformation depending on the type of c will be called. If no custom transformation exists then an error will be raised.

  • If c is a Tuple of transformations then transform will iterate through the

tuple using a similar method to the TransformVariables.jl method.

source