tf-gnns


Nametf-gnns JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://github.com/mylonasc/tf_gnns.git
SummaryA hackable graphnets library for tensorflow-keras.
upload_time2024-09-10 06:40:55
maintainerNone
docs_urlNone
authorCharilaos Mylonas
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
## Tensorflow versions and `tf_gnns`

|tf   | Tests status |
|-----|----|
|2.13 | ![alt-img](doc/shields/tf2.13.svg) | 
|2.14 | ![alt-img](doc/shields/tf2.14.svg) | 
|2.15 | ![alt-img](doc/shields/tf2.15.svg) | 
|2.17 | ![alt-img](doc/shields/tf2.17.svg) | 

<details>
<summary>Further info</summary>
There are some un-resolved bugs with the latest tensorflow versions, due to the on-going transition from keras 2 to keras 3 some of the problems are already resolved, but there are some flaky parts in the code currently.
Since I develop this single-handedly, I will wait for the dust to settle with keras 3.
At the moment it is recommended to use version `tensorflow==2.15` or earlier. 
</details>

# `tf_gnns` - A Hackable GraphNets library
![alt-img](https://raw.githubusercontent.com/mylonasc/tf_gnns/main/doc/figures/tfgnns_logo2.png)
A library for easy construction of message-passing networks in tensorflow keras.
It is inspired largely by this [DeepMind paper](https://arxiv.org/abs/1806.01261) and the corresponding open-sourced library ([original graph_nets library](https://github.com/deepmind/graph_nets))

The `tf_gnns` library has no external dependencies except tensorflow 2.x (there is no support for tf 1.x graphs/sessions-based computation). 
It implements some alternative design constraints from `graph_nets` taking advantage of some facilities keras provides to make complex models easily and without large drops in performance.

`tf_gnns` is built to support arbitrary node/edge/global attributes and update functions.
A set of convenience functions providing MLP construction with keras are also provided (i.e., handling input/output sizes for valid networks) that replaces sonnet.

The main motivation for this library was the absense of a relatively short and efficient implementation of GNNs that was explicitly created to take advantage of keras's functionalities.
GNN implementations which take advantage of `tensorflow_probability` functionality are to be released in the future (as the one used in \[2\]).

## Installing `tf_gnns`
Currently `tensorflow==2.17` and `tensorflow_probability==0.24` are not supported since there are some bugs introduced which I haven't resolved. 
All tests pass with `tensorflow==2.15` and `tensorflow_probability==0.22`.
Install with `pip`:
```
pip install tensorflow==2.15
pip install tensorflow_probability==0.22
pip install tf_gnns
```
## Use through Docker

You can run build a dockerfile that uses `tf_gnns` with the following command, based on an Ubuntu22 OS:

```
docker build . -t tf_gnns_215 --network host  --build-arg TENSORFLOW_VERSION=2.15
```

The container implements some logic to sort out the necessary dependencies. Namely, 
 * Numpy 1.x is required for tf <= 2.14
 * Keras 2 support needs to be enabled for tf >= 2.16
 * The `tensorflow_probability` version is selected through a mapping given the tensorflow version.


# Examples

## `tf_gnns` basics
You may inspect some basic functionality on the following colab notebook:

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/mylonasc/tf_gnns/blob/main/notebooks/01_tf_gnn_basics.ipynb)


## list sorting example
(Example from the original `deepmind/graph_nets` library)
If you are familiar with the original `graph_nets` library, this example will help you understand how you can transition to `tf_gnns`.

Sort a list of elements.
This notebook and the accompanying code demonstrates how to use the Graph Nets library to learn to sort a list of elements.

A list of elements is treated as a fully connected graph between the elements. 
The network is trained to label the start node, and which (directed) edges correspond to the links to the next largest element, for each node.

After training, the prediction ability is tested by comparing its output to true sorted lists. Then the network's ability to generalise is tested, by using it to sort larger lists.

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/mylonasc/tf_gnns/blob/main/notebooks/02_list_sorting.ipynb)

## Performance
From some initial tests the performance of the `tf_gnns` library seems to be at least as good as `deepmind/graph_nets` when using tensor dictionaries.

# Publications using `tf_gnns`
The library has been used so far in the following publications:

\[1\] [Bayesian graph neural networks for strain-based crack localization](https://arxiv.org/abs/2012.06791) 

\[2\] [Remaining Useful Life Estimation Under Uncertainty with Causal GraphNets](https://arxiv.org/abs/2011.11740)
\[3\] [Relational VAE: A Continuous Latent Variable Model for Graph Structured Data](https://arxiv.org/abs/2106.16049)





            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mylonasc/tf_gnns.git",
    "name": "tf-gnns",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Charilaos Mylonas",
    "author_email": "mylonas.charilaos@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7c/c0/81f89a2459fceadb27aee235bc5cd5afe7f0e551116430c0eee0d32eadf2/tf-gnns-0.1.6.tar.gz",
    "platform": null,
    "description": "\n## Tensorflow versions and `tf_gnns`\n\n|tf   | Tests status |\n|-----|----|\n|2.13 | ![alt-img](doc/shields/tf2.13.svg) | \n|2.14 | ![alt-img](doc/shields/tf2.14.svg) | \n|2.15 | ![alt-img](doc/shields/tf2.15.svg) | \n|2.17 | ![alt-img](doc/shields/tf2.17.svg) | \n\n<details>\n<summary>Further info</summary>\nThere are some un-resolved bugs with the latest tensorflow versions, due to the on-going transition from keras 2 to keras 3 some of the problems are already resolved, but there are some flaky parts in the code currently.\nSince I develop this single-handedly, I will wait for the dust to settle with keras 3.\nAt the moment it is recommended to use version `tensorflow==2.15` or earlier. \n</details>\n\n# `tf_gnns` - A Hackable GraphNets library\n![alt-img](https://raw.githubusercontent.com/mylonasc/tf_gnns/main/doc/figures/tfgnns_logo2.png)\nA library for easy construction of message-passing networks in tensorflow keras.\nIt is inspired largely by this [DeepMind paper](https://arxiv.org/abs/1806.01261) and the corresponding open-sourced library ([original graph_nets library](https://github.com/deepmind/graph_nets))\n\nThe `tf_gnns` library has no external dependencies except tensorflow 2.x (there is no support for tf 1.x graphs/sessions-based computation). \nIt implements some alternative design constraints from `graph_nets` taking advantage of some facilities keras provides to make complex models easily and without large drops in performance.\n\n`tf_gnns` is built to support arbitrary node/edge/global attributes and update functions.\nA set of convenience functions providing MLP construction with keras are also provided (i.e., handling input/output sizes for valid networks) that replaces sonnet.\n\nThe main motivation for this library was the absense of a relatively short and efficient implementation of GNNs that was explicitly created to take advantage of keras's functionalities.\nGNN implementations which take advantage of `tensorflow_probability` functionality are to be released in the future (as the one used in \\[2\\]).\n\n## Installing `tf_gnns`\nCurrently `tensorflow==2.17` and `tensorflow_probability==0.24` are not supported since there are some bugs introduced which I haven't resolved. \nAll tests pass with `tensorflow==2.15` and `tensorflow_probability==0.22`.\nInstall with `pip`:\n```\npip install tensorflow==2.15\npip install tensorflow_probability==0.22\npip install tf_gnns\n```\n## Use through Docker\n\nYou can run build a dockerfile that uses `tf_gnns` with the following command, based on an Ubuntu22 OS:\n\n```\ndocker build . -t tf_gnns_215 --network host  --build-arg TENSORFLOW_VERSION=2.15\n```\n\nThe container implements some logic to sort out the necessary dependencies. Namely, \n * Numpy 1.x is required for tf <= 2.14\n * Keras 2 support needs to be enabled for tf >= 2.16\n * The `tensorflow_probability` version is selected through a mapping given the tensorflow version.\n\n\n# Examples\n\n## `tf_gnns` basics\nYou may inspect some basic functionality on the following colab notebook:\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/mylonasc/tf_gnns/blob/main/notebooks/01_tf_gnn_basics.ipynb)\n\n\n## list sorting example\n(Example from the original `deepmind/graph_nets` library)\nIf you are familiar with the original `graph_nets` library, this example will help you understand how you can transition to `tf_gnns`.\n\nSort a list of elements.\nThis notebook and the accompanying code demonstrates how to use the Graph Nets library to learn to sort a list of elements.\n\nA list of elements is treated as a fully connected graph between the elements. \nThe network is trained to label the start node, and which (directed) edges correspond to the links to the next largest element, for each node.\n\nAfter training, the prediction ability is tested by comparing its output to true sorted lists. Then the network's ability to generalise is tested, by using it to sort larger lists.\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/mylonasc/tf_gnns/blob/main/notebooks/02_list_sorting.ipynb)\n\n## Performance\nFrom some initial tests the performance of the `tf_gnns` library seems to be at least as good as `deepmind/graph_nets` when using tensor dictionaries.\n\n# Publications using `tf_gnns`\nThe library has been used so far in the following publications:\n\n\\[1\\] [Bayesian graph neural networks for strain-based crack localization](https://arxiv.org/abs/2012.06791) \n\n\\[2\\] [Remaining Useful Life Estimation Under Uncertainty with Causal GraphNets](https://arxiv.org/abs/2011.11740)\n\\[3\\] [Relational VAE: A Continuous Latent Variable Model for Graph Structured Data](https://arxiv.org/abs/2106.16049)\n\n\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A hackable graphnets library for tensorflow-keras.",
    "version": "0.1.6",
    "project_urls": {
        "Homepage": "https://github.com/mylonasc/tf_gnns.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e0b63ce58ed1423cb7c1225d05897b602792527a4ef171d65ca179693b05aa21",
                "md5": "e25cdb8f618ac84f9b8a3de4bba9aad6",
                "sha256": "959f9d6fcabef257bc96f5425bfc40a9b54cf24b9f1909a9fab3d9160f0efeba"
            },
            "downloads": -1,
            "filename": "tf_gnns-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e25cdb8f618ac84f9b8a3de4bba9aad6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 39465,
            "upload_time": "2024-09-10T06:40:53",
            "upload_time_iso_8601": "2024-09-10T06:40:53.435236Z",
            "url": "https://files.pythonhosted.org/packages/e0/b6/3ce58ed1423cb7c1225d05897b602792527a4ef171d65ca179693b05aa21/tf_gnns-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7cc081f89a2459fceadb27aee235bc5cd5afe7f0e551116430c0eee0d32eadf2",
                "md5": "d8fd5fa15c2f1ca91e299e62fc72adb8",
                "sha256": "39f4112df8cb97775bab12379fa3777e364055dc76d635a626c81dc29c323bc7"
            },
            "downloads": -1,
            "filename": "tf-gnns-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "d8fd5fa15c2f1ca91e299e62fc72adb8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 39081,
            "upload_time": "2024-09-10T06:40:55",
            "upload_time_iso_8601": "2024-09-10T06:40:55.002269Z",
            "url": "https://files.pythonhosted.org/packages/7c/c0/81f89a2459fceadb27aee235bc5cd5afe7f0e551116430c0eee0d32eadf2/tf-gnns-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-10 06:40:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mylonasc",
    "github_project": "tf_gnns",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "tf-gnns"
}
        
Elapsed time: 0.35973s