pydgn


Namepydgn JSON
Version 1.5.6 PyPI version JSON
download
home_pageNone
SummaryA Python Package for Deep Graph Networks
upload_time2024-04-24 10:42:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords deep-graph-networks evaluation-framework deep-learning-for-graphs
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <img src="https://github.com/diningphil/PyDGN/blob/main/docs/_static/pydgn-logo.png"  width="300"/>
</p>

# PyDGN: a research library for Deep Graph Networks 
[![License](https://img.shields.io/badge/License-BSD_3--Clause-gray.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Documentation Status](https://readthedocs.org/projects/pydgn/badge/?version=latest)](https://pydgn.readthedocs.io/en/latest/?badge=latest)
[![Python Package](https://github.com/diningphil/PyDGN/actions/workflows/python-publish.yml/badge.svg)](https://github.com/diningphil/PyDGN/actions/workflows/python-publish.yml)
[![Downloads](https://static.pepy.tech/personalized-badge/pydgn?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/pydgn)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Interrogate](https://github.com/diningphil/PyDGN/blob/main/.badges/interrogate_badge.svg)](https://interrogate.readthedocs.io/en/latest/)
[![Coverage](https://github.com/diningphil/PyDGN/blob/main/.badges/coverage_badge.svg)]()
[![DOI](https://joss.theoj.org/papers/10.21105/joss.05713/status.svg)](https://doi.org/10.21105/joss.05713)

## [Documentation](https://pydgn.readthedocs.io/en/latest/index.html)

This is a Python library to easily experiment
with [Deep Graph Networks](https://www.sciencedirect.com/science/article/pii/S0893608020302197) (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!

<p align="center">
  <img src="https://github.com/diningphil/PyDGN/blob/main/docs/_static/exp_gui.png"  width="600"/>
</p>

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](https://pydgn.readthedocs.io/en/latest/tutorial.html)):

    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)](https://github.com/diningphil/iCGMM)
- [Graph Mixture Density Networks (ICML 2021)](https://github.com/diningphil/graph-mixture-density-networks)
- [Contextual Graph Markov Model (ICML 2018, JMLR 2020)](https://github.com/diningphil/CGMM)
- [Extended Contextual Graph Markov Model (IJCNN 2021)](https://github.com/diningphil/E-CGMM)
- [Continual Learning Benchmark for Graphs (WWW Workshop 2021, spotlight)](https://github.com/diningphil/continual_learning_for_graphs)


## 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*](https://openreview.net/pdf?id=HygDF6NFPB). *8th International Conference on Learning
Representations (ICLR 2020).* [Code](https://github.com/diningphil/gnn-comparison)

in the `examples/DATA_SPLITS` folder.

## License:

PyDGN >= 1.0.0 is `BSD 3-Clause` licensed, as written in the `LICENSE` file.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pydgn",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "deep-graph-networks, evaluation-framework, deep-learning-for-graphs",
    "author": null,
    "author_email": "Federico Errica <f.errica@protonmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ad/8a/1ae1b0d554d80f2fdc0b35e84a38732d1875e43f654a901e413b827d68c4/pydgn-1.5.6.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <img src=\"https://github.com/diningphil/PyDGN/blob/main/docs/_static/pydgn-logo.png\"  width=\"300\"/>\n</p>\n\n# PyDGN: a research library for Deep Graph Networks \n[![License](https://img.shields.io/badge/License-BSD_3--Clause-gray.svg)](https://opensource.org/licenses/BSD-3-Clause)\n[![Documentation Status](https://readthedocs.org/projects/pydgn/badge/?version=latest)](https://pydgn.readthedocs.io/en/latest/?badge=latest)\n[![Python Package](https://github.com/diningphil/PyDGN/actions/workflows/python-publish.yml/badge.svg)](https://github.com/diningphil/PyDGN/actions/workflows/python-publish.yml)\n[![Downloads](https://static.pepy.tech/personalized-badge/pydgn?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/pydgn)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Interrogate](https://github.com/diningphil/PyDGN/blob/main/.badges/interrogate_badge.svg)](https://interrogate.readthedocs.io/en/latest/)\n[![Coverage](https://github.com/diningphil/PyDGN/blob/main/.badges/coverage_badge.svg)]()\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.05713/status.svg)](https://doi.org/10.21105/joss.05713)\n\n## [Documentation](https://pydgn.readthedocs.io/en/latest/index.html)\n\nThis is a Python library to easily experiment\nwith [Deep Graph Networks](https://www.sciencedirect.com/science/article/pii/S0893608020302197) (DGNs). It provides\nautomatic management of data splitting, loading and common experimental settings. It also handles both model\nselection and risk assessment procedures, by trying many different configurations in parallel (CPU or GPU).\n\n## Citing this work\n\nIf you used this library for your project, please consider citing us:\n\n    @article{pydgn,\n      author = {Errica, Federico and Bacciu, Davide and Micheli, Alessio},\n      doi = {10.21105/joss.05713},\n      journal = {Journal of Open Source Software},\n      month = oct,\n      number = {90},\n      pages = {5713},\n      title = {{PyDGN: a Python Library for Flexible and Reproducible Research on Deep Learning for Graphs}},\n      url = {https://joss.theoj.org/papers/10.21105/joss.05713},\n      volume = {8},\n      year = {2023}\n    }\n\n## Installation:\n\nAutomated tests passing on Windows, Linux, and MacOS. Requires at least Python 3.8.\nSimply run\n    \n    pip install pydgn\n\n## Quickstart:\n\n#### Build dataset and data splits\n\n    pydgn-dataset --config-file examples/DATA_CONFIGS/config_NCI1.yml\n\n#### Train\n\n    pydgn-train  --config-file examples/MODEL_CONFIGS/config_SupToyDGN.yml \n\nAnd we are up and running!\n\n<p align=\"center\">\n  <img src=\"https://github.com/diningphil/PyDGN/blob/main/docs/_static/exp_gui.png\"  width=\"600\"/>\n</p>\n\nTo debug your code you can add `--debug` to the command above, but the \"GUI\" will be disabled.\n\nTo stop the computation, use ``CTRL-C`` to send a ``SIGINT`` signal, and consider using the command ``ray stop`` to stop\nall Ray processes. **Warning:** ``ray stop`` stops **all** ray processes you have launched, including those of other\nexperiments in progress, if any.\n\n### Using the Trained Models\n\nIt's very easy to load the model from the experiments (see also the [Tutorial](https://pydgn.readthedocs.io/en/latest/tutorial.html)):\n\n    from pydgn.evaluation.util import *\n\n    config = retrieve_best_configuration('RESULTS/supervised_grid_search_toy_NCI1/MODEL_ASSESSMENT/OUTER_FOLD_1/MODEL_SELECTION/')\n    splits_filepath = 'examples/DATA_SPLITS/CHEMICAL/NCI1/NCI1_outer10_inner1.splits'\n    device = 'cpu'\n\n    # instantiate dataset\n    dataset = instantiate_dataset_from_config(config)\n\n    # instantiate model\n    model = instantiate_model_from_config(config, dataset, config_type=\"supervised_config\")\n\n    # load model's checkpoint, assuming the best configuration has been loaded\n    checkpoint_location = 'RESULTS/supervised_grid_search_toy_NCI1/MODEL_ASSESSMENT/OUTER_FOLD_1/final_run1/best_checkpoint.pth'\n    load_checkpoint(checkpoint_location, model, device=device)\n\n    # you can now call the forward method of your model\n    y, embeddings = model(dataset[0])\n\n\n## Projects using PyDGN\n\n- [Infinite Contextual Graph Markov Model (ICML 2022)](https://github.com/diningphil/iCGMM)\n- [Graph Mixture Density Networks (ICML 2021)](https://github.com/diningphil/graph-mixture-density-networks)\n- [Contextual Graph Markov Model (ICML 2018, JMLR 2020)](https://github.com/diningphil/CGMM)\n- [Extended Contextual Graph Markov Model (IJCNN 2021)](https://github.com/diningphil/E-CGMM)\n- [Continual Learning Benchmark for Graphs (WWW Workshop 2021, spotlight)](https://github.com/diningphil/continual_learning_for_graphs)\n\n\n## Data Splits\n\nWe provide the data splits taken from\n\n[Errica Federico, Podda Marco, Bacciu Davide, Micheli Alessio: *A Fair Comparison of Graph Neural Networks for Graph\nClassification*](https://openreview.net/pdf?id=HygDF6NFPB). *8th International Conference on Learning\nRepresentations (ICLR 2020).* [Code](https://github.com/diningphil/gnn-comparison)\n\nin the `examples/DATA_SPLITS` folder.\n\n## License:\n\nPyDGN >= 1.0.0 is `BSD 3-Clause` licensed, as written in the `LICENSE` file.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python Package for Deep Graph Networks",
    "version": "1.5.6",
    "project_urls": {
        "Homepage": "https://pydgn.readthedocs.io/en/latest/"
    },
    "split_keywords": [
        "deep-graph-networks",
        " evaluation-framework",
        " deep-learning-for-graphs"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c381e6f38d357e5f418cd28b73ee8d5b43ed976c278f5e37b5c4cf6b60fece9",
                "md5": "9b646d96a22f0dfb8ca9220f18be2ddc",
                "sha256": "2b565d5933dc25542e7f60e6507a4a9a497dceac117966f428895a26c0623aa1"
            },
            "downloads": -1,
            "filename": "pydgn-1.5.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9b646d96a22f0dfb8ca9220f18be2ddc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 94720,
            "upload_time": "2024-04-24T10:42:51",
            "upload_time_iso_8601": "2024-04-24T10:42:51.729744Z",
            "url": "https://files.pythonhosted.org/packages/1c/38/1e6f38d357e5f418cd28b73ee8d5b43ed976c278f5e37b5c4cf6b60fece9/pydgn-1.5.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad8a1ae1b0d554d80f2fdc0b35e84a38732d1875e43f654a901e413b827d68c4",
                "md5": "c1b6494a2406f7a7dfbe27b345f86a85",
                "sha256": "91ee4795287f027e4775b357c93eb969701f1da33607888999993c8dfd016191"
            },
            "downloads": -1,
            "filename": "pydgn-1.5.6.tar.gz",
            "has_sig": false,
            "md5_digest": "c1b6494a2406f7a7dfbe27b345f86a85",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 80066,
            "upload_time": "2024-04-24T10:42:54",
            "upload_time_iso_8601": "2024-04-24T10:42:54.247662Z",
            "url": "https://files.pythonhosted.org/packages/ad/8a/1ae1b0d554d80f2fdc0b35e84a38732d1875e43f654a901e413b827d68c4/pydgn-1.5.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-24 10:42:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pydgn"
}
        
Elapsed time: 0.24444s