vislearn / FrEIA

Framework for Easily Invertible Architectures
MIT License
765 stars 112 forks source link

Example for GaussianMixtureModel #108

Open kaechb opened 2 years ago

kaechb commented 2 years ago

Hi, Could you add an example for the GaussianMixtureModel and how you integrate that into the GraphINN or just refer me to a code snippet where you used the GaussianMixtureModel? From the documentation it is very unclear to me how this can be done - is there a reason that the subnet is not given similarly as an constructor in the case of the affine coupling layer? I've read the https://arxiv.org/pdf/2003.05739.pdf, which made the algorithmic aspect a lot more understandable but I do not see how it can be implemented. Cheers

wapu commented 2 years ago

Hi kaechb, And sorry for taking that long to get back to you! I wrote that report and I've implemented the GMM module in FrEIA, and I agree that it is not clear enough how it would be used.

In the attached file, you can see how it is supposed to work - setting up the invertible and conditioning networks, using the loss function and sampling from the trained GMM. The code is just an incomplete minimal example. I have not, in fact, tested this module for actual data, since my own GMM experiments were done with older and even more irritating code. I would therefore be very thankful for feedback on whether this works as expected or if you run into any problems!

Best, Jakob

gmm_example.txt

wapu commented 2 years ago

As for the subnet constructor question: The GMM module does not contain any networks itself, the way it is implemented. The entire parameterization comes from outside via the conditional inputs, which hopefully gives you more flexibility in how you come up with the GMM parameters.