blei-lab / edward

A probabilistic programming language in TensorFlow. Deep generative models, variational inference.
http://edwardlib.org
Other
4.83k stars 761 forks source link

Edward support for recent extensions of VAE #447

Open rfarouni opened 7 years ago

rfarouni commented 7 years ago

@dustinvtran Hi Dustin,

How hard do you think it is to implement the following models in Edwards using the Tensorflow backend?

Is there a class of models that Edward won't be able to handle in the near future?

Thanks

dustinvtran commented 7 years ago

we designed the library specifically so those examples are as easy to do as possible.

i think in general, there will never be a class of models that Edward won't be able to handle. however, as with all software design, there are always models/inference that are easier or harder to work with. for example, i think bayesian nonparametrics and undirected models are possible in edward—arguably they are best done in edward as there's no other library that captures them—but they will never be as easy as directed graphical models.

rfarouni commented 7 years ago

That's great! So for implementing HVM on tensorflow for example, do you recommend I modify the example here.

dustinvtran commented 7 years ago

as a pro tip, the easiest way to use HVMs is to not write a new algorithm (although this is still in the works, just a low priority for me). rather you can useKLqp on the joint space, where you minimize

KL ( q(z, lambda; theta) || r(lambda | z; phi)p(z | x) ).

here, q(z, lambda; theta) is the hierarchical variational model, and r(lambda | z; phi) is the auxiliary model. this doesn't require a new algorithm and in fact is exactly equivalent to the HVM algorithm (up to choices of Rao-Blackwellization and mixes of reparameterization vs score function gradient).

for example,

# probability model
z = RandomVariable(..)
x = RandomVariable(..)

# (hierarchical) variational model
qlambda = RandomVariable(..)
qz = RandomVariable(..)

# auxiliary model
rlambda = RandomVariable(..)

inference = ed.KLqp({z: qz, rlambda: qlambda}, data={x: x_data})

more details are in the paragraph below Equation 5 in the paper.

rfarouni commented 7 years ago

That helps a lot. Thank you for your help!

yunhuiguo commented 6 years ago

@dustinvtran Hi Dustin,

I am still confused about how to use HVM in Edward. Could you please provide a complete tutorial or an example on this? Thanks!

XinDongol commented 6 years ago

@dustinvtran I am looking for example of HVM (in ICML) too.