Skip to main content

PyDGN: a research library for Deep Graph Networks

License Documentation Status Python Package Downloads Code style: black Interrogate Coverage DOI

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

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.

Metadata

Release files for pydgn 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydgn 1.6.0
File Size Uploaded Provenance Actions
pydgn-1.6.0.tar.gz 80.5 kB Without provenance Details for pydgn-1.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydgn 1.6.0
File Interpreter ABI Platform Actions
pydgn-1.6.0-py3-none-any.whl Python 3 none any Details for pydgn-1.6.0-py3-none-any.whl

Total release size: 175.8 kB

Release files / pydgn-1.6.0.tar.gz

Download URL pydgn-1.6.0.tar.gz
Size 80.5 kB
Tags Source
SHA-256 checksum
How to use checksums
73c788dcfaa4ebacb8b0b881ed7de4a5866f93167f24fa83e71e694c940821d9
BLAKE2b-256 checksum
How to use checksums
49bdbf4d1b49db60b313521801ad75b0565b0d3c1e7dfeb9fc67eeed55d3f8f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / pydgn-1.6.0-py3-none-any.whl

Download URL pydgn-1.6.0-py3-none-any.whl
Size 95.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e756856866e3e2e09fe1053a3b146afc60f277f2c40a9230a506a2a54ebdae37
BLAKE2b-256 checksum
How to use checksums
1419ccd5b4e1c10ee7e1c616d0b0586692a013f8820e77bfa0cdfe99e0869284
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Security for pydgn 1.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page