Skip to content

Latest commit

 

History

History
 
 

gnn_explainer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

DGL Implementation of GNNExplainer

This is a DGL example for GNNExplainer: Generating Explanations for Graph Neural Networks. For the authors' original implementation, see here.

Contributors:

Datasets

Four built-in synthetic datasets are used in this example.

Usage

First, train a GNN model on a dataset.

python train_main.py  --dataset $DATASET

Valid options for $DATASET: BAShape, BACommunity, TreeCycle, TreeGrid

The trained model weights will be saved to model_{dataset}.pth

Second, install GNNLens2 with

pip install -U flask-cors
pip install Flask==2.0.3
pip install gnnlens

Third, explain the trained model with the same dataset

python explain_main.py --dataset $DATASET

Finally, launch GNNLens2 to visualize the explanations

gnnlens --logdir gnn_subgraph

By entering localhost:7777 in your web browser address bar, you can see the GNNLens2 interface. 7777 is the default port GNNLens2 uses. You can specify an alternative one by adding --port xxxx after the command line and change the address in the web browser accordingly.

A sample visualization is available below. For more details of using GNNLens2, check its tutorials.


Figure: Explanation for node 41 of BAShape