RexYing/gnn-model-explainer
RexYing/gnn-model-explainer has 1,062 GitHub stars and 191 forks. Star changes are not measured yet. Last checked 2026-11-09 11:18 UTC. Last push 2024-08-30.
gnn explainer
Measured star growth
- in 24h
- Update delayed
- in 7 days
- Update delayed
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Originalgnn-explainer
This repository contains the source code for the paper GNNExplainer: Generating Explanations for Graph Neural Networks by Rex Ying, Dylan Bourgeois, Jiaxuan You, Marinka Zitnik & Jure Leskovec, presented at NeurIPS 2019.
[Arxiv] [BibTex] [Google Scholar]
@misc{ying2019gnnexplainer,
title={GNNExplainer: Generating Explanations for Graph Neural Networks},
author={Rex Ying and Dylan Bourgeois and Jiaxuan You and Marinka Zitnik and Jure Leskovec},
year={2019},
eprint={1903.03894},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
Using the explainer
Installation
See INSTALLATION.md
Replicating the paper's results
Training a GCN model
This is the model that will be explained. We do provide pre-trained models for all of the experiments that are shown in the paper. To re-train these models, run the following:
python train.py --dataset=EXPERIMENT_NAME
where EXPERIMENT_NAME is the experiment you want to replicate.
For a complete list of options in training the GCN models:
python train.py --help
TODO: Explain outputs
Explaining a GCN model
To run the explainer, run the following:
python explainer_main.py --dataset=EXPERIMENT_NAME
where EXPERIMENT_NAME is the experiment you want to replicate.
For a complete list of options provided by the explainer:
python train.py --help
Visualizing the explanations
Tensorboard
The result of the optimization can be visualized through Tensorboard.
tensorboard --logdir log
You should then have access to visualizations served from localhost.
Jupyter Notebook
We provide an example visualization through Jupyter Notebooks in the notebook folder. To try it:
jupyter notebook
The default visualizations are provided in notebook/GNN-Explainer-Viz.ipynb.
Note: For an interactive version, you must enable ipywidgets
jupyter nbextension enable --py widgetsnbextension
You can now play around with the mask threshold in the GNN-Explainer-Viz-interactive.ipynb.
TODO: Explain outputs + visualizations + baselines
D3,js
We provide export functionality so the generated masks can be visualized in other data visualization frameworks, for example d3.js. We provide an example visualization in Observable.
Included experiments
| Name | EXPERIMENT_NAME |
Description |
|---|---|---|
| Synthetic #1 | syn1 |
Random BA graph with House attachments. |
| Synthetic #2 | syn2 |
Random BA graph with community features. |
| Synthetic #3 | syn3 |
Random BA graph with grid attachments. |
| Synthetic #4 | syn4 |
Random Tree with cycle attachments. |
| Synthetic #5 | syn5 |
Random Tree with grid attachments. |
| Enron | enron |
Enron email dataset source. |
| PPI | ppi_essential |
Protein-Protein interaction dataset. |
| Reddit* | REDDIT-BINARY |
Reddit-Binary Graphs (source). |
| Mutagenicity* | Mutagenicity |
Predicting the mutagenicity of molecules (source). |
| Tox 21* | Tox21_AHR |
Predicting a compound's toxicity (source). |
Datasets with a * are passed with the
--bmnameparameter rather than--datasetas they require being downloaded manually.
TODO: Provide all data for experiments packaged so we don't have to split the two.
Using the explainer on other models
A graph attention model is provided. This repo is still being actively developed to support other GNN models in the future.
Changelog
See CHANGELOG.md
Explore related projects
codecrafters-io/build-your-own-x
Master programming by recreating your favorite technologies from scratch.
561,590 starspublic-apis/public-apis
A collective list of free APIs
497,908 starsmorluto/rea
Reverse engineer anything with agents, from app behavior down to native binaries.
449,688 starsopenclaw/openclaw
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞
394,301 stars