Giter Site home page Giter Site logo

interpretablegcn's Introduction

InterpretableGCN

The code provides us with the interpretation of its predictions in addition to developing a Graph Convolutional Network (GCN) model for drug discovery and materials informatics. Integrated Gradients was implemented to interpret the deep learning model. This method requires no modification to the original network and is extremely simple to implement; it just needs a few calls to the standard gradient operator. As shown below, a red to blue color map will be displayed on the chemical structure.

toppage

Directory

.
├── data
│     └── smiles_cas_N6512.smi
├── figure
├── images
├── model
│     ├── checkpoint_model.pth
│     └── config.ini
├── src
│     ├── mol2graph.py
│     ├── callbacks.py
│     ├── network.py
│     ├── integrated_gradients.py
│     └── train.py
├── install_packages.sh
├── train.sh
├── visualize.sh
└── README.md

Installation of packages

These packages are dependent on PyTorch version 1.9.* .

conda create -n InterpretableGCN python=3.8.1 -y
source activate InterpretableGCN
bash install_packages.sh

Confirm that the installation has completed successfully. The version of pytorch and pytorch geometric are showed your terminal.

python -c "import torch; print(torch.__version__)"
python -c "import torch_geometric; print(torch_geometric.__version__)"

Training

bash start_train.sh

demo learning_curve When the training is completed, configure file with training parameters is saved in model folder.

If you want to train model with other patameters, you can edit training parameters in start_train.sh.

data=../data/smiles_cas_N6512.smi
batch_size=128
dim=64
n_conv_hidden=4
n_mlp_hidden=1
dropout=0.1
lr=1e-4
n_epochs=1000
patience=1
model_path=../model/checkpoint_model.pth

python ./src/train.py $data $batch_size $dim $n_conv_hidden $n_mlp_hidden $dropout $lr $n_epochs $patience $model_path

Visualization

To work visualization of the prediction basis of GCN, you have to specify SMILES you want to predict and the configure file which was generated after training. When you have completed the ptrediction and visualization of the prediction basis, output file with name of predicted classs is saved in firuge folder.
Please edit visualize.sh as following.

config=../model/config.ini
smiles='OC(=O)c1ccccc1' # You can edit it yourself !

python ./src/visualize.py $config $smiles

To visualize, run the following command

bash visualize.sh

interpretablegcn's People

Contributors

teddyglass avatar

Stargazers

 avatar  avatar  avatar  avatar  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.