This is the code used for the paper:
Automatic chemical design using a data-driven continuous representation of molecules
Abstract: We develop a molecular autoencoder, which converts discrete representations of molecules to and from a vector representation. This allows efficient gradient-based optimization through open-ended spaces of chemical compounds. Continuous representations also allow us to automatically generate novel chemical structures by performing simple operations in the latent space, such as interpolating between molecules.
By
- Rafa Gómez-Bombarelli,
- David Duvenaud,
- José Miguel Hernández-Lobato,
- Jorge Aguilera-Iparraguirre,
- Timothy Hirzel,
- Ryan P. Adams,
- Alán Aspuru-Guzik
This code requires a fork of Keras that forked from the dev version around approximately version 0.3.2 and Theano > 0.8.2. (Recently, to test on OS X 10.12.2, we are running Theano 0.9.0 dev4) We want to point you to the work of Max Hodak who re-implemented this tool based on the paper. For beginning your own project, you may have greater success starting there. https://github.com/maxhodak/keras-molecules
python sample_autoencoder.py \
../data/best_vae_model.json \
../data/best_vae_annealed_weights.h5 \
../data/250k_rndm_zinc_drugs_clean.smi \
../data/zinc_char_list.json \
-l5000
Which should result is something close to this (values will range from random selection of 5000 samples from test file)
Using Theano backend.
('Training set size is', 5000)
Training set size is 5000, after filtering to max length of 120
('total chars:', 35)
Loss: 0.834809958935, Accuracy: 0.948206666667
python train_autoencoder.py \
../data/250k_rndm_zinc_drugs_clean.smi \
../data/zinc_char_list.json \
-l5000