Authors: Ksenia Korovina, Lingxiao Zhao, Mark Cheung, Wenwen Si
graphical_models
directory contains definitions ofGraphicalModel
class (objects abbreviated as "graphs");graphical_models/datasets
contains labeled data. Labeled graphs are stored as.npy
files in the following directory structure:
graphical_models/datasets/{train/val/test}
|-- star/
| |- 9/<file1.npy>, <file2.npy> ...
| |- 10/
|- 11/
... ...
inference
directory contains all methods for performing inference on aGraphicalModel
, including BP and GNN-based methods;inference/pretrained
contains pretrained GNN inference procedures.experiments
directory contains specification for loading data (combinations of graph structures and sizes to compose training and testing) and inference experiments. If an experiment uses GNN inference, it first checks if an appropriate pretrained model exists (usingtrain.py
) by matching model postfix andtrain_set_name
in experiment.create_data.py
generates graphs from user-specified arguments and saves tographical_models/datasets
by default.train.py
uses one of generated datasets to train a GNN inference procedure (such as GatedGNN).
The following command will install several python packages for graphs, numerical computations and deep learning:
pip install -r requirements.txt
Installation of igraph
may fail under MacOS and anaconda. In this case, try setting MACOSX_DEPLOYMENT_TARGET
:
MACOSX_DEPLOYMENT_TARGET=10.9 pip install graphkernels
For imports to work correctly, add root of the repository to PYTHONPATH
by running
source setup.sh
To generate data to reproduce experiments, run
bash prepare_tree_experiment.sh # for main experiment 1
To train the GNN inference, use train.py
. Finally, use ./experiments/run_exps.py
to specify the way to compare a trained GNN with other inference methods.