Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimplexBijector tests fails on boundary #232

Open
torfjelde opened this issue Oct 6, 2022 · 0 comments
Open

SimplexBijector tests fails on boundary #232

torfjelde opened this issue Oct 6, 2022 · 0 comments

Comments

@torfjelde
Copy link
Member

b = Bijectors.SimplexBijector{1, false}()
x = rand(dist)
y = b(x)
@test b(param(x)) isa TrackedArray
@test log(abs(det(ForwardDiff.jacobian(b, x)))) logabsdetjac(b, x)

causes issues because

julia> using Bijectors, ForwardDiff

julia> b = Bijectors.SimplexBijector{false}();

julia> x = [1.0, 0.0];

julia> logabsdetjac(b, x)
36.04365338911715
julia> log(abs(det(ForwardDiff.jacobian(b, x))))  # (✓) Same!
36.04365338911715

julia> x = [0.9999999999999999, 0.0];

julia> logabsdetjac(b, x)
36.04365338911715

julia> log(abs(det(ForwardDiff.jacobian(b, x))))  # (×) Different
35.63818828100899

And [0.9999999999999999, 0.0] is indeed a possible realization from Dirichlet even though it's technically not in the support:

julia> using StableRNGs

julia> dist = Dirichlet([1000 * one(Float64), eps(Float64)]);

julia> rand(StableRNG(2), dist)
2-element Vector{Float64}:
 0.9999999999999999
 0.0
 
julia> insupport(dist, [0.9999999999999999, 0.0])
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant