conormdurkan / neural-statistician

PyTorch Implementation of Neural Statistician
58 stars 12 forks source link

Neural Statistician

About

This repo contains a PyTorch implementation of the model outlined in Towards a Neural Statistician (Edwards & Storkey, ICLR 2017). All models are close approximations of those listed in the paper and should yield comparable results.

The code was written using Python 3.6, and currently works only with a GPU setup. Package requirements should be easy to handle using Conda and/or pip.

Structure

The four main experiments are each located in their own subdirectory. Each subdirectory contains the following five files:

The spatial, omniglot, and faces directories also contain an additional create.py file used for data preprocessing.

Data

The following data sets are used:

Further preprocessing is needed. This is detailed below.

Usage

The following commands require you to be in the corresponding experiment directories. Checkpoints and figures are saved at intervals to a specified output directory. To save disk space, you can opt to save these only on the final epoch of training.

Synthetic

Spatial MNIST

mnist-data must contain gzipped MNIST files. The above command will pickle two files to mnist-data/spatial.

Omniglot

omniglot-data must contain the file chardata.mat. The above command will pickle a data file to the omniglot-data directory.

The MNIST data directory needs to be specified here for testing of the model on unseen data.

YouTube Faces

faces-data must contain the original uncropped images, with an unaltered directory structure as given by the download. The above command will create another directory faces-data/64, with the same structure, but where images are cropped to 64 x 64. Note that this operation will take significant disk space (about 1GB).

Contact

Please use the issues tracker for questions, problems etc.

License

MIT License

Copyright (c) 2017-2018 Conor Durkan

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.