Path: blob/master/deprecated/notebooks/gan_mixture_of_gaussians.ipynb
1192 views
This notebook implements a Generative Adversarial Network to fit a synthetic dataset generated from a mixture of Gaussians in 2D.
The code was adapted from the ODEGAN code here: https://github.com/deepmind/deepmind-research/blob/master/ode_gan/odegan_mog16.ipynb. The original notebook was created by Chongli Qin.
Some modifications made by Mihaela Rosca here were also incorporated.
Imports
|████████████████████████████████| 184 kB 10.5 MB/s
|████████████████████████████████| 140 kB 33.7 MB/s
|████████████████████████████████| 72 kB 403 kB/s
Data Generation
Data is generated from a 2D mixture of Gaussians.
Plotting
Models and Training
A multilayer perceptron with the ReLU activation function.
The loss function for the discriminator is:
where , as in the original GAN.
The loss function for the generator is:
where for the non-saturating generator loss.
Perform a training step by first updating the discriminator parameters using the gradient and then updating the generator parameters using the gradient .
Plot Results
Plot the data and the examples generated by the generator.