-
Docker support is now available (see instructions below).
-
Bugs fixed and results are now reproducible.
-
🎉 Accepted as a spotlight paper at ICLR 2024.
-
We public the code. Here is the structure of this project repo:
MMD-Graph-Kernel/
├── mmdgk/ # Core module package
│ ├── __init__.py
│ ├── kernels.py # MMD kernels
│ ├── loss.py # Loss functions used in training
│ ├── models.py # GCN Model architecture
│ └── utils/
│ ├── __init__.py
│ ├── arguments.py # Argument parser
│ ├── evaluation.py # Evaluation metrics and functions
│ └── get_data.py # Dataset loading and preprocessing
├── main.py # Main training/testing script
├── run_demo.py
- We introduce a class of maximum mean discrepancy (MMD)-based graph kernels, called MMD-GK, which apply MMD to node representations propagated via message passing.
- Building on this, we propose a class of deep MMD-GKs that can adaptively learn implicit graph features in an unsupervised manner.
- Additionally, we present supervised deep MMD-GKs, which incorporate graph labels to learn more discriminative metrics.
First, install dependencies:
pip install -r requirements.txtThe data/ folder contains a sample dataset (MUTAG). Configure settings in utils/arguments.py.
To run the vanilla version (MMDGK):
python main.py --model 'vanilla' --dis_gamma 1e0 --bandwidth "[1e0, 1e1]"To run the deep version (Deep MMDGK):
python main.py --model 'deep' --dataname 'MUTAG' --epochs 10 From the project root:
docker build -t mmdgk-image .To run the project in the container. This executes bash run_demo.sh by default.
docker run --rm mmdgk-imageTo open an interactive shell in the container. From there, you can run bash run_demo.sh or directly execute main.py.
docker run -it --rm mmdgk-image /bin/bashIf you have an NVIDIA GPU and the NVIDIA Container Toolkit installed:
docker run --rm --gpus all mmdgk-imageTo save logs or outputs to your local machine. This maps the container's /workspace/runs directory to your local ./logs folder.
docker run --rm -v $(pwd)/logs:/workspace/runs mmdgk-imageIf you use this code, please cite:
@inproceedings{sun2023mmd,
title={MMD Graph Kernel: Effective Metric Learning for Graphs via Maximum Mean Discrepancy},
author={Sun, Yan and Fan, Jicong},
booktitle={The Twelfth International Conference on Learning Representations},
year={2023}
}