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

Add a dirichlet distribution! #141

Open
serenabooth opened this issue Oct 30, 2019 · 4 comments
Open

Add a dirichlet distribution! #141

serenabooth opened this issue Oct 30, 2019 · 4 comments

Comments

@serenabooth
Copy link

@serenabooth serenabooth commented Oct 30, 2019

Ankit Shah and I are trying to use Gen to support a project and would love the addition of a dirichlet distribution

@marcoct
Copy link
Contributor

@marcoct marcoct commented Oct 31, 2019

Thanks for using Gen! :)

This should be pretty straightforward. Some notes:

  • Distributions.jl has a Dirichlet distribution, from which we can use sampling (for Gen.random) and logpdf (for Gen.logpdf).
  • Gen.logpdf_grad could support gradient with respect to concentration vector.
  • Gen.logpdf_grad could also support gradient with respect to the probability vector, although some care would be required when using these gradients, since the output is constrained to the simplex. This is an example of a random choice with a non-standard base measure, and it might make sense to introduce a Simplex data type to make that explicit. (However, making automatic differentiation interact well with custom data types requires more work, and might wait until the AD refactoring mentioned in #128.)
@dpmerrell
Copy link

@dpmerrell dpmerrell commented Oct 31, 2019

What do people think about using an unconstrained parameterization?

The unconstrained parameter may be less intuitive, but probably more practical for gradient-based inference techniques.

@xukai92
Copy link

@xukai92 xukai92 commented Dec 12, 2019

Sounds like using Distributions.jl together with Bijectors.jl could work.

@ztangent
Copy link
Contributor

@ztangent ztangent commented Apr 7, 2020

Looks like someone is doing this in #225!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.