Code Monkey home page Code Monkey logo

constrained-graph-variational-autoencoder's Introduction

Constrained Graph Variational Autoencoders for Molecule Design

This repository contains our implementation of Constrained Graph Variational Autoencoders for Molecule Design (CGVAE).

@article{liu2018constrained,
  title={Constrained Graph Variational Autoencoders for Molecule Design},
  author={Liu, Qi and Allamanis, Miltiadis and Brockschmidt, Marc and Gaunt, Alexander L.},
  journal={The Thirty-second Conference on Neural Information Processing Systems},
  year={2018}
}

Requirements

This code was tested in Python 3.5 with Tensorflow 1.3. conda, docopt and rdkit are also necessary. A Bash script is provided to install all these requirements.

source ./install.sh

To evaluate SAS scores, use get_sascorer.sh to download the SAS implementation from rdkit

Data Extraction

Three datasets (QM9, ZINC and CEPDB) are in use. For downloading CEPDB, please refer to CEPDB.

For downloading QM9 and ZINC, please go to data directory and run get_qm9.py and get_zinc.py, respectively.

python get_qm9.py

python get_zinc.py

Running CGVAE

We provide two settings of CGVAE. The first setting samples one breadth first search path for each molecule. The second setting samples transitions from multiple breadth first search paths for each molecule.

To train and generate molecules using the first setting, use

python CGVAE.py --dataset qm9|zinc|cep

To avoid training and generate molecules with a pretrained model, use

python CGVAE.py --dataset qm9|zinc|cep --restore pretrained_model --config '{"generation": true}'

To train and generate molecules using the second setting, use

python CGVAE.py --dataset qm9|zinc|cep --config '{"sample_transition": true, "multi_bfs_path": true, "path_random_order": true}'

To use optimization in the latent space, set optimization_step to a positive number

python CGVAE.py --dataset qm9|zinc|cep --restore pretrained_model --config '{"generation": true, "optimization_step": 50}'

More configurations can be found at function default_params in CGVAE.py

Evaluation

To evaluate the generated molecules, use

python evaluate.py --dataset qm9|zinc|cep

Pretrained Models and Generated Molecules

Generated molecules can be obtained upon request.

A program in folder molecules is provided to read and visualize the molecules

python visualize.py molecule_file output_file

Questions/Bugs

Please submit a Github issue or contact [email protected].

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

constrained-graph-variational-autoencoder's People

Contributors

51alg avatar leuchine avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

constrained-graph-variational-autoencoder's Issues

Use Constrained GVAE for Non-Molecular Data?

Hi Team! Excellent work!

This model is exactly what I've been looking for, but I'm not working with molecular data. I'm working with motion data. Is it possible to use this work for data other than generating molecules?

Thank you!

PyTorch Implementation

Hello team,

thank you for this great paper and great implementation! As PyTorch has become the standard library for deep learning, I was wondering if you by any chance reimplemented this model in PyTorch as well?

Blas xGEMMBatched launch failed

Hi, after I run python CGVAE.py --dataset qm9, the program failed, the error is

InternalError (see above for traceback): Blas xGEMMBatched launch failed : a.shape=[64,10,10], b.shape=[64,10,100], m=10, n=100, k=10, batch_size=64
         [[Node: graph_model/gru_scope_encoder0_1/MatMul_1 = BatchMatMul[T=DT_FLOAT, adj_x=false, adj_y=false, _device="/job:localhost/replica:0/task:0/device:GPU:0"](graph_model/gru_scope_encoder11_1/strided_slice_2, graph_model/gru_scope_encoder0_1/Reshape)]]
         [[Node: clip_by_norm_197/_195 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_24896_clip_by_norm_197", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

Any suggestions? Thanks!

baseline

Hi Team,

Thank you so much for your work.
Just wondering would it be possible to also share the code for the baseline, for example the GraphVAE?

Tensorflow2 implementation

Hello, thank you for this great paper and great implementation! As Tensorflow has upgraded to version 2, I was wondering if you by any chance changed this model to Tensorflow2 as well?

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.