Open dustinvtran opened 7 years ago
The problem is that while most flows (especially for those in the paper by Rezende & Mohammed) are invertible, programming the inverse is impossible; that's because invertibility does not imply an "inverse that can be easily written down with our typical analytical operators". :|
I think the only flows currently published for which the flow and its inverse are straightforward to implement are from Laurent's NICE and RVP papers. The only way out to do the others is to track z_0
. This would require an API of the form log_prob(x, z0, z)
or so.
Actually, Durk Kingma's IAF is also invertible. But it is expensive, IIRC.
Oh right. So basically what we'd like from TensorFlow's side is to be able to define TransformedDistribution
without having to specify the inverse transformation.
Not quite. To evaluate the log probability of a sample z_K
generated by application of a flow with K
steps, you will need to have access to all intermediate values z_{0:K-1}
. Check equation (13) of [1]. But the API currently is some_rv.log_prob(z_sample)
, and not something like some_rv.log_prob(z0_sample, z1_sample, z2_sample, ...)
.
I think it will get more ugly than what you proposed, especially due to quite a bit of bookkeping.
@dustinvtran Hi Dustin, is there a working toy example implementing any of the aforementioned flows in Edward?
not yet. this was waiting on some internal details behind the Bijector class, which now supports much needed caching. i think most of those are in now, so i can look into it again.
I just heard about normalizing flows at PyData London and was interested in trying them out. Is this something that is working or in progress now? I'm not sure how much contribution I can make since I'm still learning some of this, but also happy to help out if possible.
this is easy in Edward: take any model already in Edward. define the variational family using
TransformedDistribution
. Runed.KLqp
(or most explicitly, runed. ReparameterizationKLqp
).the majority of the labor goes in defining the flows and the log determinant of their Jacobian's.