Code for ICDM2021 paper GNES: Learning to Explain Graph Neural Networks
This codebase proivdes the necessary running environment (including the human explanation label) to train and evaluate the proposed GNES model on the BBBP molecular datasets.
Python pakage requirement:
- python==3.7.9
- keras==2.2.4
- deepchem==2.3.0
- chainer_chemistry
- Download the BBBP dataset and place it in 'data/':
- Download our human explanation labels for BBBP dataset and place them in 'human_mask/':
- human explanation labels: https://drive.google.com/file/d/1RD-qs3VWZuRC4TFBHocto0kPtv4s1ha2/view?usp=sharing
Run the following scripts to replicate the results:
- Train and evaluate GNES
python 1_gcn_train_eval.py
You will get the model performance from the output, and the final model will be saved to 'saved_models/'
- Explain and visualize:
python 2_explain_save_masks.py
You will find the following results once done:
-
Explanation data (in json format): will be saved to 'results/masks/'
-
Explanation visualization (figures): will be saved to 'figs/'
Below are some sample explanations from GNES (the importance is marked by the darkness of blue circles on nodes and blue lines on edges. Darker color means more importance is given.):
Orignial | GNES explanation |
---|---|
Please refer to the 'config.py' file first, as it stores major settings of the GNES framework, including:
- Backbone GCN model settings
- Whether to enable human explanation label supervision
- Whether to use the proposed explanation regularazation(s): inlcuding ['sparsity', 'consistency']
If any further questions, please reach out to me via email [email protected]
And if you find this repo useful in your research, please consider cite our paper:
@InProceedings{gao2021gnes,
title={GNES: Learning to Explain Graph Neural Networks},
author={Gao, Yuyang and Sun, Tong and Bhatt, Rishab and Yu, Dazhou and Hong, Sungsoo and Zhao, Liang},
booktitle = {2021 IEEE International Conference on Data Mining (ICDM)},
month = {December},
year = {2021},
organization={IEEE}
}