-
Notifications
You must be signed in to change notification settings - Fork 421
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
Dirichlet + Categorical or Dirichlet + Multinomial toy example ? #106
Comments
My personal opinion is that the reason why we use the Dirichlet distribution as the prior is that it is the conjugate of Multinomial distribution. However currently ZhuSuan does not support detecting the conjugacy and figuring out analytic updating formula of variational inference (but it is under development, see here, so you can wait for some while:) ) Therefore instead of using Dirichlet distribution which is defined on a probability simplex, we first sample from normal distribution (each dimension is independent) and transform it onto the probability simplex by softmax (Latent0 <- |
Hello Thanks you a lot for you reply. I am trying then to do this: observations <- zs.Multinomial(toy_logits, n_experiments) latent0 <- zs.Normal(latent0_mean, latent0_stdev, ngroup_dims=0) I have a piece of code that should be a good start:
Especially I don't know where to use "observations", and if I can do it in this way |
In
My understanding is that your code intends to infer the global latent variable
|
Hello However, I obtain the same kind of problem as in Edward (but in Pyro that works): Constant1 <- tf.constant([..]) but that fails to retrieve correct params so that we could obtain the Latent0 similar to Constant1 and then similar data to the original one (see also https://discourse.edwardlib.org/t/a-little-example-on-dirichlet-multinomial-inference/802 if interested, this is the same thing with Dirichlet instead of Normal). Code:
(I removed n_chains to make it simpler) |
Sorry for the (very) late reply. The problem is at:
And
You can see there should be 'latent0+constant2=tf.log(constant1+constant2)' (up to a difference of an constant), and this does not imply 'latent0=tf.log(constant1)'. |
Hello
Is it possible to add a little example for doing this:
Latent <- zs.distributions.Dirichlet(alpha_parameters)
Observations <- zs.distributions.Multinomial(Latent, n_experiments) ?
And the goal is to retrieve alpha_parameters when we have only Observations, with HMC or variationnal inference.
(My ultimate goal is to do:
Latent1 <- zs.distributions.Dirichlet(alpha_parameters)
Latent2 <- zs.distributions.Dirichlet(alpha_parameters)
Latent3 <- conv2d(Latent1,Latent2)
Observations <- zs.distributions.Multinomial(Latent3, n_experiments)
And retrieve again alpha_parameters. I could manage it with a toy Dirichlet+Cat/Mult example and especially I think that could be helpful for everyone to have such an example.)
Thanks a lot
The text was updated successfully, but these errors were encountered: