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.4616797533499711

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)
-0.15358216090672694

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

y, ladj = with_logabsdet_jacobian(b, x)
(-0.15358216090672694, 1.3921854447415325)