Giter VIP home page Giter VIP logo

clustergan's Introduction

ClusterGAN

Code for reproducing key results in the paper ClusterGAN : Latent Space Clustering in Generative Adversarial Networks by Sudipto Mukherjee, Himanshu Asnani, Eugene Lin and Sreeram Kannan. If you use the code, please cite our paper.

Dependencies

The code has been tested with the following versions of packages.

  • Python 2.7.12
  • Tensorflow 1.4.0
  • Numpy 1.14.2

Datasets

The datasets used in the paper can be downloaded from the Google Drive link (https://drive.google.com/open?id=1XnGkSamF5DiwnpHFG0OexmoqAwe27ucR). Unzip the folder so that the path is : ./ClusterGAN/data/<dataset_name>

Training

You can either train your own models on the datasets or use pre-trained models. Even though we have used a fixed seed using tf.random.seed(0), there will still be randomness introduced by CUDA. So, to reproduce the results, train 5 models and compare the Validation purity in the logs directory. Each model can be trained as follows :

$ python Image_Cluster.py --data mnist --K 10 --dz 30 --beta_n 10 --beta_c 10 --train True 

This will save the model along with timestamp in checkpoint-dir/<dataset_name>. Also, the Validation set performance will be written to logs/Res_<dataset_name>_<model_name>.txt. Then run the best model (with highest Validation Purity) on the Test set.

$ python Image_ClusterGAN.py --data mnist --K 10 --dz 30 --beta_n 10 --beta_c 10 --timestamp <best_timestamp>

Training the models for other datasets has a similar format.

Fashion-10 :

$ python Image_ClusterGAN.py --data fashion --K 10 --dz 40 --beta_n 0 --beta_c 10 --train True 

Fashion-5 :

$ python Image_ClusterGAN.py --data fashion --K 5 --dz 40 --beta_n 0 --beta_c 10 --train True 

Single Cell 10x genomics :

$ python Gene_ClusterGAN.py --data 10x_73k --K 8 --dz 30 --beta_n 10 --beta_c 10 --train True 

Pendigits :

$ python pen_ClusterGAN.py --data pendigit --K 10 --dz 5 --beta_n 10 --beta_c 10 --train True 

Provide the timestamp of best saved model to obtain the Test set clustering performance on all the datasets (similar to MNIST above).

Pre-trained models

Additionally, you can also download the pre-trained models from the Google drive link (https://drive.google.com/open?id=1l9Lwq0amAaA3qHzNCiw7BrivSAFoP0em). Unzip the file in ./ClusterGAN. It should lead to the folder ./ClusterGAN/pre_trained_models

Run the following code :

$ python Image_ClusterGAN.py --data mnist --K 10 --dz 30 --beta_n 10 --beta_c 10 

Similarly for the other datasets.

Clustering Performance

Table shows the mean +- standard deviation of 10 runs of ClusterGAN (with the reported hyperparameter settings in the paper) for various datasets.

Dataset ACC NMI ARI
MNIST 0.9097 +- 0.0398 0.8544 +- 0.0361 0.8290 +- 0.0621
Fashion-10 0.6119 +- 0.0230 0.6157 +- 0.0112 0.4617 +- 0.0226
Fashion-5 0.7218 +- 0.0089 0.6163 +- 0.0243 0.5035 +- 0.0228
10x_73k 0.8172 +- 0.0262 0.7272 +- 0.0322 0.6786 +- 0.0369
Pendigits 0.7638 +- 0.0120 0.7343 +- 0.0120 0.6336 +- 0.0177

Feedback

Please feel free to provide any feedback about the code to [email protected].

clustergan's People

Contributors

sudiptodip15 avatar

Watchers

 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.