Code for the Adversarially Learned Inference paper.
From the repo's root directory,
$ cd papers
$ latexmk --pdf adverarially_learned_inferenceClone the repository, then install with
$ pip install -e aliSet up your ~/.fuelrc file:
$ echo "data_path: \"<MY_DATA_PATH>\"" > ~/.fuelrcGo to <MY_DATA_PATH>:
$ cd <MY_DATA_PATH>Download the CIFAR-10 dataset:
$ fuel-download cifar10
$ fuel-convert cifar10
$ fuel-download cifar10 --clearDownload the SVHN format 2 dataset:
$ fuel-download svhn 2
$ fuel-convert svhn 2
$ fuel-download svhn 2 --clearDownload the CelebA dataset:
$ fuel-download celeba 64
$ fuel-convert celeba 64
$ fuel-download celeba 64 --clearMake sure you're in the repo's root directory.
$ THEANORC=theanorc python experiments/ali_cifar10.py$ THEANORC=theanorc python experiments/ali_svhn.py$ THEANORC=theanorc python experiments/ali_celeba.py$ THEANORC=theanorc python experiments/ali_mixture.py$ THEANORC=theanorc python experiments/gan_mixture.py$ THEANORC=theanorc scripts/sample [main_loop.tar]e.g.
$ THEANORC=theanorc scripts/sample ali_cifar10.tar$ THEANORC=theanorc scripts/interpolate [which_dataset] [main_loop.tar]e.g.
$ THEANORC=theanorc scripts/interpolate celeba ali_celeba.tar$ THEANORC=theanorc scripts/reconstruct [which_dataset] [main_loop.tar]e.g.
$ THEANORC=theanorc scripts/reconstruct cifar10 ali_cifar10.tarFirst, preprocess the SVHN dataset with the learned ALI features:
$ THEANORC=theanorc scripts/preprocess_representations [main_loop.tar] [save_path.hdf5]e.g.
$ THEANORC=theanorc scripts/preprocess_representations ali_svhn.tar ali_svhn_preprocessed.hdf5Then, launch the semi-supervised script:
$ python experiments/semi_supervised_svhn.py ali_svhn.tar [save_path.hdf5]e.g.
$ python experiments/semi_supervised_svhn.py ali_svhn_preprocessed.hdf5
[...]
Validation error rate = ... +- ...
Test error rate = ... +- ...$ THEANORC=theanorc scripts/generate_mixture_plots [ali_main_loop.tar] [gan_main_loop.tar]e.g.
$ THEANORC=theanorc scripts/generate_mixture_plots ali_mixture.tar gan_mixture.tar