Skip to content
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

MADE generative pass, tanh layer for scaling params, moons example #2

Merged
merged 3 commits into from Sep 12, 2018

Conversation

ekrim
Copy link
Contributor

@ekrim ekrim commented Sep 12, 2018

Feel free to incorporate any or none of these fixes/additions. Let me know if you'd like me to break up the PR. Thanks!

  1. Implement the generative pass (mode == 'inverse') for MADE module. This iteratively builds the output of the generative model given the input (e.g. the Gaussian latent data). The shift and scale parameters for the first element are independent of the data, and are determined simply by the bias weights.

  2. Add the HalfTanh module, which applies tanh to the second half of the dimensions of a given tensor. This is used in MADE, since tanh adds stability to the scale parameters.

  3. Add a 2D moon dataset example, including a visualization of generated samples. The command

python main.py --dataset MOONS --flow maf --epochs 50

results in the following plot:

generated

  1. Changing sign of scale parameter in 'inverse' mode to correspond to the MAF paper.

@ikostrikov
Copy link
Owner

ikostrikov commented Sep 12, 2018

Looks good to me!

I'm ready to merge.

One minor thing: there is a dependency between halftanh and the coupling layer. If one of the layers changes, it might break the other. I would prefer to have HalfTanh implemented using .chunk function so the connection with the coupling layer is easier to see in the code. Or even to move tanh to the implementation of MADE (with a flag).

@ekrim
Copy link
Contributor Author

ekrim commented Sep 12, 2018

Ah, that does seem cleaner. I put a use_tanh flag for MADE, to directly apply tanh to the a.

@ikostrikov
Copy link
Owner

Great! Merging now.

@ikostrikov ikostrikov merged commit a162a5f into ikostrikov:master Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants