Skip to content

Dirichlet dimensionality off-by-one #51

@cscherrer

Description

@cscherrer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions