probcomp / Gen.jl

A general-purpose probabilistic programming system with programmable inference
https://gen.dev
Apache License 2.0
1.79k stars 160 forks source link

feat: add dirichlet distribution #495

Closed chentoast closed 1 year ago

chentoast commented 1 year ago

I found it actually kind of nontrivial to test gradients of the dirichlet with finite differences, since the simplex condition means that it's impossible to perturb one element of the simplex vector without having to adjust all of the others. So I just manually checked for a couple of values against pytorch, but better ideas would be very welcome.

chentoast commented 1 year ago

Lmk if there are any more things that I should do! Otherwise, I can squash when it's ready

chentoast commented 1 year ago

@ztangent I think it should be ready! Feel free to merge whenever :)