This is a DGL example for GNNExplainer: Generating Explanations for Graph Neural Networks. For the authors' original implementation, see here.
Contributors:
Four built-in synthetic datasets are used in this example.
First, train a GNN model on a dataset.
python train_main.py --dataset $DATASETValid 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 gnnlensThird, explain the trained model with the same dataset
python explain_main.py --dataset $DATASETFinally, launch GNNLens2 to visualize the explanations
gnnlens --logdir gnn_subgraphBy 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.
