Bijectors.jl
This package implements functionality for transforming random variables to Euclidean space (and back).
Note that Turing.jl and DynamicPPL.jl do not use the old interface with e.g. Bijectors.bijector: they instead use the interface in the Bijectors.VectorBijectors module. Please see the documentation for more information.
Example
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.360631845152507In 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.5726228122017133You can also obtain the log absolute determinant of the Jacobian of the transformation:
y, ladj = with_logabsdet_jacobian(b, x)(-0.5726228122017133, 1.4671725088805772)