Closed theogf closed 8 months ago
So I don't think this is an issue with the RadialFlow
:
d = MvNormal(zeros(2), I(2))
b = inverse(bijector(Dirichlet(ones(3))))
# RadialLayer
z_0 = zeros(length(d))
α = 0
β = 1
r = RadialLayer(α, β, z_0)
# Without simplex.
xs = eachcol(rand(transformed(d, r), 10000))
histogram2d(first.(xs), Base.Fix2(getindex, 2).(xs), nbins=50)
results in
So it's indeed symmetric.
The "issue" I guess is that the simplex bijector is not. The transformation is described here: https://mc-stan.org/docs/reference-manual/simplex-transform.html
It's not immediately obvious to me why this would be symmetric, though the resulting distribution indeed looks symmetric if you use a zero-mean isotropic Gaussian as the base.
I think @sethaxen might be the best guy to answer this:)
All stick-breaking transforms are indeed not symmetric. There are symmetric transforms on the simplex though (in particular, several softmax-based transforms, e.g. the additive log ratio transform from compositional data analysis), though some are better for MCMC than others. How important is this symmetry to you?
@sethaxen Quite crucial, my general goal is to have some kind of circular prior in the simplex, but all components should have equal chances. Since the bijection aspect is not so important to me, I could try using the softmax
approach.
Since it's not a bug but just a specificity of the model used I will close this issue
Cool, just don't use softmax
directly, as it's not bijective. You might want to try out "NormalizedExponential" or "AugmentedSoftmax" here: https://github.com/mjhajharia/transforms/tree/main/transforms/simplex . Both are bijective by augmenting softmax with logsumexp, but they do different things to the inputs to softmax to try to improve the geometry, and they use different priors for the discarded parameter (the output of logsumexp).
Hey!
I tried to make a "radial flow in a simplex" with the following code:
Which results in the following plot:![image](https://github.com/TuringLang/Bijectors.jl/assets/11480067/30ab2352-23ef-4a01-93ba-c4585b3ced4e)
Which is more or less what I want, however I am a bit surprised by the asymmetry of it. Should this be expected?