Bijectors.jl

This package implements functionality for transforming random variables to Euclidean space (and back).

For example, consider a random variable $X \sim \mathrm{Beta}(2, 2)$, which has support on $(0, 1)$:

using Bijectors

x = rand(Beta(2, 2))
0.7747132135959909

In this case, the logit function is used as the transformation:

\[Y = \mathrm{logit}(X) = \log\left(\frac{X}{1 - X}\right).\]

We can construct this function

b = bijector(Beta(2, 2))
Bijectors.Logit{Float64, Float64}(0.0, 1.0)

and apply it to x:

y = b(x)
1.2351187170726368

You can also obtain the log absolute determinant of the Jacobian of the transformation:

y, ladj = with_logabsdet_jacobian(b, x)
(1.2351187170726368, 1.7456434472446)