As implemented, link is not bijective for Dirichlet distributions:
julia> dist = Dirichlet([1,1])
Dirichlet{Float64}(alpha=[1.0, 1.0])
julia> link(dist, [0.5,0.5])
2-element Array{Float64,1}:
0.0
0.0
julia> invlink(dist,[0.0,0.0])
2-element Array{Float64,1}:
0.5
0.5
julia> invlink(dist,[0.0,1.0])
2-element Array{Float64,1}:
0.5
0.5
Because values must add to one, a Dirichlet with n values only has n-1 degrees of freedom, so the bijection needs to be to ℝⁿ⁻¹. There's an implementation in TransformVariables.jl that seems to work correctly.
It seems likely this is behind the troubles described in TuringLang/Turing.jl#935
As implemented,
linkis not bijective for Dirichlet distributions:Because values must add to one, a Dirichlet with n values only has n-1 degrees of freedom, so the bijection needs to be to ℝⁿ⁻¹. There's an implementation in TransformVariables.jl that seems to work correctly.
It seems likely this is behind the troubles described in TuringLang/Turing.jl#935