Gen.jl icon indicating copy to clipboard operation
Gen.jl copied to clipboard

Initial setup for Dirichlet distribution in Gen

Open Kenta426 opened this issue 5 years ago • 6 comments

I need Dirichlet distribution for my prior and quickly wrote a starter code without logpdf_grad. One way to implement logpdf_grad is to use reparameterization trick (see "Implicit Reparameterization Gradients" Figurnov et al, 2019). This method is used by other PPL, too. Probably need someone's assistance on the implementation.

Kenta426 avatar Apr 01 '20 02:04 Kenta426

You can also try to wrap over Bijectors.jl. It also has the code for gradient in https://github.com/TuringLang/Bijectors.jl/blob/master/src/bijectors/simplex.jl

xukai92 avatar Apr 13 '20 14:04 xukai92

It seems like the build failed during installing SpecialFunctions.jl Could someone take a look and give me suggestions how to fix? Thank you

Kenta426 avatar Apr 21 '20 21:04 Kenta426

Hi @Kenta426, thanks for pointing this out. I think https://github.com/probcomp/Gen/pull/246 fixes this issue in master, after testing it out on this branch in https://github.com/probcomp/Gen/pull/225/commits/6333bb72764ccf3f486fdfedbca2da642012bf22. You should be good to go now -- looks like the unit test you added is producing an error though.

bzinberg avatar Apr 23 '20 14:04 bzinberg

@Kenta426 this is probably not the cause of the CI failures, but you may also want to make sure that your commits match the new directory structure for built-in distributions introduced in #243! Basically all built-in distributions should now be located in src/modeling_library/distributions

ztangent avatar Apr 23 '20 15:04 ztangent

@bzinberg Thank you for the update! @ztangent Yes, I didn't move the new file to src/modeling_library/distributions folder. Thank you for pointing that out

Kenta426 avatar Apr 23 '20 16:04 Kenta426

@Kenta426 I suppose you are working on Gaussian Mixture Models (with Dirichlet process) in Gen? Would it be possible you can share an simple example of it using Gen? I would really appreciate that!

zhixuedu avatar Jun 12 '20 15:06 zhixuedu