Coder Social home page Coder Social logo

implicit-bias-towards-the-kernel-regimecauses-mode-collapse-in-gans's Introduction

Implicit Bias towards the Kernel RegimeCauses Mode Collapse in GANs

This repository is the official implementation of Implicit Bias towards the Kernel RegimeCauses Mode Collapse in GANs.

Requirements

To install requirements:

pip install -r requirements.txt

Synthetic datasets will be automatically generated. And MNIST will be automatically downloaded.

Main Steps

There are 3 main steps of this work: 1) training GANs with different hyperparameters, 2) Compute metrics of interest from the results, and 3) create figures or perform causal analysis on the results. We will introduce accordingly.

Training

To train the model(s) in the paper, we provide example scripts Scripts/example_training_GANs.sh for training Shallow ReLU GANs on 2D mixture of Gaussian datasets Grid and Random (first 2 commands, more datasets avaiable in Synthetic_Dataset.py), and for training DCGANs on MNIST (last 2 commands). The option --alpha_mobility and --alpha_mobility_D modify alpha of the generator and discriminator, respectively. And --lazy implements the lazy training scheme in [1]. These 3 options should be used combined.

python Run_GAN_Training.py --z_dim 2 --z_std 1 --test_data_num 1024 --plot_lim_z 7 --plot_lim_x 2 --mog_std 0.01 --mog_scale 1 --data grid5 --opt_type rmsprop --divergence JS --method simgd --g_lr 0.001 --d_lr 0.001 --d_penalty 0 --g_hessian_reg 1 --d_hessian_reg 1 --iteration 400000 --plot_iter 4000 --seed 0 --arch mlp --g_layers 1 --g_hidden 32 --d_layers 1 --d_hidden 32 --rmsprop_init_1 --gamma 0.8 --save_param

Use --save_param when you want to save the metrics of interest and NN parameters per --plot_iter iterations during training. Otherwise, only the initial and final values will be saved. The saved metrics of interest and NN parameters will be in folder Data if not specified by --save_path.

Computing Metrics

To compute metrics, first move all results to be computed to a folder under Summaries, such as the provided folder GAN_training_results_examples. Then, refer to the command in Scripts/example_computing_metrics.sh. For example, run:

python Data_to_csv.py --task_type 2D --summary_dir Summaries --task_dir GAN_training_results_examples

Then, a file named results.csv with the initial and final values of metrics will appear in this task folder. For values of all available iterations, modify variable only_last_t in Data_to_csv.py to False.

Plotting

To reproduce Fig.1a in paper, run

python Plot_experiments.py

Causal Analysis

To perform causal analysis and reproduce the plots for the distribution of marginal treatment effect (MTE) of each treatment shown in paper Fig. 5, run

python Causal_analysis.py

For retraining the DeepIV model, modify variable load_deepIvEst_3_2 to False. Depending on the initial seed, the results can be slightly different.

References

[1] Chizat, Lénaïc, Edouard Oyallon, and Francis Bach. "On Lazy Training in Differentiable Programming." Advances in Neural Information Processing Systems 32 (2019): 2937-2947.

implicit-bias-towards-the-kernel-regimecauses-mode-collapse-in-gans's People

Contributors

yilongju avatar

Stargazers

Daniel Kwame Amissah avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.