A Python Package for Deep Graph Networks
Project description
PyDGN: a research library for Deep Graph Networks
Documentation
This is a Python library to easily experiment with Deep Graph Networks (DGNs). It provides automatic management of data splitting, loading and common experimental settings. It also handles both model selection and risk assessment procedures, by trying many different configurations in parallel (CPU or GPU).
Citing this work
If you used this library for your project, please consider citing us:
@article{pydgn,
author = {Errica, Federico and Bacciu, Davide and Micheli, Alessio},
doi = {10.21105/joss.05713},
journal = {Journal of Open Source Software},
month = oct,
number = {90},
pages = {5713},
title = {{PyDGN: a Python Library for Flexible and Reproducible Research on Deep Learning for Graphs}},
url = {https://joss.theoj.org/papers/10.21105/joss.05713},
volume = {8},
year = {2023}
}
Installation:
Automated tests passing on Windows, Linux, and MacOS. Requires at least Python 3.8. Simply run
pip install pydgn
Quickstart:
Build dataset and data splits
pydgn-dataset --config-file examples/DATA_CONFIGS/config_NCI1.yml
Train
pydgn-train --config-file examples/MODEL_CONFIGS/config_SupToyDGN.yml
And we are up and running!
To debug your code you can add --debug
to the command above, but the "GUI" will be disabled.
To stop the computation, use CTRL-C
to send a SIGINT
signal, and consider using the command ray stop
to stop
all Ray processes. Warning: ray stop
stops all ray processes you have launched, including those of other
experiments in progress, if any.
Using the Trained Models
It's very easy to load the model from the experiments (see also the Tutorial):
from pydgn.evaluation.util import *
config = retrieve_best_configuration('RESULTS/supervised_grid_search_toy_NCI1/MODEL_ASSESSMENT/OUTER_FOLD_1/MODEL_SELECTION/')
splits_filepath = 'examples/DATA_SPLITS/CHEMICAL/NCI1/NCI1_outer10_inner1.splits'
device = 'cpu'
# instantiate dataset
dataset = instantiate_dataset_from_config(config)
# instantiate model
model = instantiate_model_from_config(config, dataset, config_type="supervised_config")
# load model's checkpoint, assuming the best configuration has been loaded
checkpoint_location = 'RESULTS/supervised_grid_search_toy_NCI1/MODEL_ASSESSMENT/OUTER_FOLD_1/final_run1/best_checkpoint.pth'
load_checkpoint(checkpoint_location, model, device=device)
# you can now call the forward method of your model
y, embeddings = model(dataset[0])
Projects using PyDGN
- Infinite Contextual Graph Markov Model (ICML 2022)
- Graph Mixture Density Networks (ICML 2021)
- Contextual Graph Markov Model (ICML 2018, JMLR 2020)
- Extended Contextual Graph Markov Model (IJCNN 2021)
- Continual Learning Benchmark for Graphs (WWW Workshop 2021, spotlight)
Data Splits
We provide the data splits taken from
Errica Federico, Podda Marco, Bacciu Davide, Micheli Alessio: A Fair Comparison of Graph Neural Networks for Graph Classification. 8th International Conference on Learning Representations (ICLR 2020). Code
in the examples/DATA_SPLITS
folder.
License:
PyDGN >= 1.0.0 is BSD 3-Clause
licensed, as written in the LICENSE
file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pydgn-1.5.5.tar.gz
.
File metadata
- Download URL: pydgn-1.5.5.tar.gz
- Upload date:
- Size: 79.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2d75fbed62e9677cfb042cdfb764993dbd42f4a60876a5f394b7a23871ca136 |
|
MD5 | 9e781b547f2ea5d0bcb0afdb48f149e1 |
|
BLAKE2b-256 | 471b78014c24cabcbe770922c82e205d8b86d7752c5bc29e6da80b09de1bb01d |
Provenance
File details
Details for the file pydgn-1.5.5-py3-none-any.whl
.
File metadata
- Download URL: pydgn-1.5.5-py3-none-any.whl
- Upload date:
- Size: 94.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0e157c152ddf545a0733acd2db1eee82c45fef1fa6e59d757c33c8c2dec0056 |
|
MD5 | 81abf36dd6526e67d13bac5e2e278074 |
|
BLAKE2b-256 | 4ab4963fb284c71170e0e739b6bfd04064acfc19535d2707cb95c2509cc9abd8 |