Forked from AI4UA repository and uses the code from Global Explainability of GNNs via Logic Combination of Learned Concepts repo to implement GLGExplainer.
Repository for the L65 Geometric Deep Learning mini-project completed by Luke Braithwaite and Matthew Hattrup during Lent term 2024.
- pytorch
- pytorch-geometric
- networkx
- numpy
Follow instructions in https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html.
pip install torch_geometric
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-1.13.0+cu117.html
The pipeline consists of the following steps all of which can be performed using the cli
included in main.py
.
They are:
- Generating the lattice dataset.
- Training the GNN to classify the lattice properties you would like.
- Training a local explanation extractor to generate the explanation subgraphs from the input lattices.
- Train GLGExplainer to use the extracted local explanations.
This can be performed by running the file gnn4Uua/datasets/runner
.
Currently the CLI does not support this operation.
Run the following command to train the GNNs on each task
python main.py train-gnns
Run the following to extract the local explanations using GNNExplainer
python main.py extract-motifs --task=Distributive --generalisation_mode=strong --seed=102 --n_epochs=100
Run the following command to train GLGExplainer on a specific task
python main.py train-explainer --task=Distributive --generalisation_mode=strong --seed=102