astrodeepnet / sbi_experiments

Simulation Based Inference experiments
MIT License
3 stars 3 forks source link

Implement a C^k with k>2 coupling layer with numerical inverse and implicit function theorem. #7

Closed EiffL closed 2 years ago

EiffL commented 2 years ago

I'm opening this issue to discuss an idea from #2 to try to use the implicit function theorem to define the inverse and jacobian of general bijections, in order to have a general way of defining smooth coupling layers.

@b-remy had some examples at some point of how to do that in JAX, before we switched to TF. Do you still have your JAX prototype Benjamin?

b-remy commented 2 years ago

Hi there!

Yes, and I just adapted the example @Justinezgh proposed in #2. It seems to work well and quit fast, and for many k>2!

Some examples with a = 1, b = 1 and c = 0.5:

Capture d’écran 2021-12-12 à 01 36 52 Capture d’écran 2021-12-12 à 01 38 43

Code here: https://colab.research.google.com/drive/1bULsH6McxKy_IqViRpx0IgvCfnnSlwGp?usp=sharing

EiffL commented 2 years ago

giphy (3)

EiffL commented 2 years ago

ok, so.... almost there. I have added the corrercted couplping layer in #10 and it's training \o/ buuuut it's giving me some weird reresuts image

there must be somehiing wrong, maybe in the logdet computationn....

EiffL commented 2 years ago

Ok i think this is done, will be closed as soon as we merge #10.