<img src="https://github.com/akensert/molgraph/blob/main/docs/source/_static/molgraph-logo-pixel.png" alt="molgraph-title" width="90%">
**Graph Neural Networks** with **TensorFlow** and **Keras**. Focused on **Molecular Machine Learning**.
> Currently, Keras 3 does not support extension types. As soon as it does, it is hoped that MolGraph will migrate to Keras 3.
## Highlights
Build a Graph Neural Network with Keras' [Sequential](https://www.tensorflow.org/api_docs/python/tf/keras/Sequential) API:
```python
from molgraph import GraphTensor
from molgraph import layers
from tensorflow import keras
g = GraphTensor(node_feature=[[4.], [2.]], edge_src=[0], edge_dst=[1])
model = keras.Sequential([
layers.GNNInput(type_spec=g.spec),
layers.GATv2Conv(units=32),
layers.GATv2Conv(units=32),
layers.Readout(),
keras.layers.Dense(units=1),
])
pred = model(g)
# Save and load Keras model
model.save('/tmp/gatv2_model.keras')
loaded_model = keras.models.load_model('/tmp/gatv2_model.keras')
loaded_pred = loaded_model(g)
assert pred == loaded_pred
```
Combine outputs of GNN layers to improve predictive performance:
```python
model = keras.Sequential([
layers.GNNInput(type_spec=g.spec),
layers.GNN([
layers.FeatureProjection(units=32),
layers.GINConv(units=32),
layers.GINConv(units=32),
layers.GINConv(units=32),
]),
layers.Readout(),
keras.layers.Dense(units=128),
keras.layers.Dense(units=1),
])
model.summary()
```
## Installation
For **CPU** users:
<pre>
pip install molgraph
</pre>
For **GPU** users:
<pre>
pip install molgraph[gpu]
</pre>
## Implementations
- **Tensors**
- [Graph tensor](http://github.com/akensert/molgraph/tree/main/molgraph/tensors/graph_tensor.py)
- A composite tensor holding graph data; compatible with `tf.data.Dataset`, `keras.Sequential` and much more.
- **Layers**
- [Graph convolutional layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/convolutional/)
- [Graph attentional layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/attentional/)
- [Graph message passing layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/message_passing/)
- [Graph readout layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/readout/)
- [Preprocessing layers](https://github.com/akensert/molgraph/tree/main/molgraph/layers/preprocessing/)
- [Postprocessing layers](https://github.com/akensert/molgraph/tree/main/molgraph/layers/postprocessing/)
- [Positional encoding layers](https://github.com/akensert/molgraph/tree/main/molgraph/layers/positional_encoding)
- **Models**
- [Graph neural networks](https://github.com/akensert/molgraph/tree/main/molgraph/models/)
- [Saliency mapping](https://github.com/akensert/molgraph/tree/main/molgraph/models/interpretability/)
## Overview
<img src="https://github.com/akensert/molgraph/blob/main/docs/source/_static/molgraph-overview.png" alt="molgraph-overview" width="90%">
## Documentation
See [readthedocs](https://molgraph.readthedocs.io/en/latest/)
## Papers
- [MolGraph: a Python package for the implementation of molecular graphs and graph neural networks with TensorFlow and Keras](https://doi.org/10.48550/arXiv.2208.09944)
- [A hands-on tutorial on quantitative structure-activity relationships using fully expressive graph neural networks](https://doi.org/10.1016/j.aca.2024.343046)
## Requirements
- **Python** (version >= 3.10)
- **TensorFlow** (version 2.15.*)
- **RDKit** (version 2023.9.*)
- **Pandas**
- **IPython**
Raw data
{
"_id": null,
"home_page": "https://github.com/akensert/molgraph",
"name": "molgraph",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "machine-learning, deep-learning, graph-neural-networks, graphs, molecular-machine-learning, molecular-graphs, cheminformatics, chemometrics, bioinformatics, chemistry, biology, biochemistry",
"author": "Alexander Kensert",
"author_email": "alexander.kensert@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a2/d1/0049597b8528e1011f550ffd98cae1962453c2822ac92bc14fafaf1dc06b/molgraph-0.7.8.tar.gz",
"platform": null,
"description": "<img src=\"https://github.com/akensert/molgraph/blob/main/docs/source/_static/molgraph-logo-pixel.png\" alt=\"molgraph-title\" width=\"90%\">\n\n**Graph Neural Networks** with **TensorFlow** and **Keras**. Focused on **Molecular Machine Learning**.\n\n> Currently, Keras 3 does not support extension types. As soon as it does, it is hoped that MolGraph will migrate to Keras 3.\n\n\n## Highlights\nBuild a Graph Neural Network with Keras' [Sequential](https://www.tensorflow.org/api_docs/python/tf/keras/Sequential) API:\n\n```python\nfrom molgraph import GraphTensor\nfrom molgraph import layers\nfrom tensorflow import keras\n\ng = GraphTensor(node_feature=[[4.], [2.]], edge_src=[0], edge_dst=[1])\n\nmodel = keras.Sequential([\n layers.GNNInput(type_spec=g.spec),\n layers.GATv2Conv(units=32),\n layers.GATv2Conv(units=32),\n layers.Readout(),\n keras.layers.Dense(units=1),\n])\n\npred = model(g)\n\n# Save and load Keras model\nmodel.save('/tmp/gatv2_model.keras')\nloaded_model = keras.models.load_model('/tmp/gatv2_model.keras')\nloaded_pred = loaded_model(g)\nassert pred == loaded_pred\n```\n\nCombine outputs of GNN layers to improve predictive performance:\n\n```python\nmodel = keras.Sequential([\n layers.GNNInput(type_spec=g.spec),\n layers.GNN([\n layers.FeatureProjection(units=32),\n layers.GINConv(units=32),\n layers.GINConv(units=32),\n layers.GINConv(units=32),\n ]),\n layers.Readout(),\n keras.layers.Dense(units=128),\n keras.layers.Dense(units=1),\n])\n\nmodel.summary()\n```\n\n## Installation\nFor **CPU** users:\n<pre>\npip install molgraph\n</pre>\nFor **GPU** users:\n<pre>\npip install molgraph[gpu]\n</pre>\n\n## Implementations\n- **Tensors**\n - [Graph tensor](http://github.com/akensert/molgraph/tree/main/molgraph/tensors/graph_tensor.py)\n - A composite tensor holding graph data; compatible with `tf.data.Dataset`, `keras.Sequential` and much more.\n- **Layers**\n - [Graph convolutional layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/convolutional/)\n - [Graph attentional layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/attentional/)\n - [Graph message passing layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/message_passing/)\n - [Graph readout layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/readout/)\n - [Preprocessing layers](https://github.com/akensert/molgraph/tree/main/molgraph/layers/preprocessing/)\n - [Postprocessing layers](https://github.com/akensert/molgraph/tree/main/molgraph/layers/postprocessing/)\n - [Positional encoding layers](https://github.com/akensert/molgraph/tree/main/molgraph/layers/positional_encoding)\n- **Models**\n - [Graph neural networks](https://github.com/akensert/molgraph/tree/main/molgraph/models/)\n - [Saliency mapping](https://github.com/akensert/molgraph/tree/main/molgraph/models/interpretability/)\n\n## Overview \n<img src=\"https://github.com/akensert/molgraph/blob/main/docs/source/_static/molgraph-overview.png\" alt=\"molgraph-overview\" width=\"90%\">\n\n## Documentation\nSee [readthedocs](https://molgraph.readthedocs.io/en/latest/)\n\n## Papers\n- [MolGraph: a Python package for the implementation of molecular graphs and graph neural networks with TensorFlow and Keras](https://doi.org/10.48550/arXiv.2208.09944)\n- [A hands-on tutorial on quantitative structure-activity relationships using fully expressive graph neural networks](https://doi.org/10.1016/j.aca.2024.343046)\n\n## Requirements\n- **Python** (version >= 3.10)\n - **TensorFlow** (version 2.15.*)\n - **RDKit** (version 2023.9.*)\n - **Pandas**\n - **IPython**\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Graph Neural Networks for Molecular Machine Learning",
"version": "0.7.8",
"project_urls": {
"Homepage": "https://github.com/akensert/molgraph"
},
"split_keywords": [
"machine-learning",
" deep-learning",
" graph-neural-networks",
" graphs",
" molecular-machine-learning",
" molecular-graphs",
" cheminformatics",
" chemometrics",
" bioinformatics",
" chemistry",
" biology",
" biochemistry"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "45d53ba436d36d805a4909ab2e4349b5df390d7ee7851ed41fcb7c007a83c47b",
"md5": "7398d055394ec2d55a4e842ee0edad75",
"sha256": "bbc660c027904a24536b15b70a05c186a4e66db6ba5abab19002968384bdc9e5"
},
"downloads": -1,
"filename": "molgraph-0.7.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7398d055394ec2d55a4e842ee0edad75",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 211397,
"upload_time": "2024-11-08T12:53:42",
"upload_time_iso_8601": "2024-11-08T12:53:42.522741Z",
"url": "https://files.pythonhosted.org/packages/45/d5/3ba436d36d805a4909ab2e4349b5df390d7ee7851ed41fcb7c007a83c47b/molgraph-0.7.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a2d10049597b8528e1011f550ffd98cae1962453c2822ac92bc14fafaf1dc06b",
"md5": "420d531bc4c478269199a27427bd417c",
"sha256": "38304750b31066dda7f9c4d17fe19d917ac5910dbe90a2d068c423ca95e3374f"
},
"downloads": -1,
"filename": "molgraph-0.7.8.tar.gz",
"has_sig": false,
"md5_digest": "420d531bc4c478269199a27427bd417c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 114704,
"upload_time": "2024-11-08T12:53:45",
"upload_time_iso_8601": "2024-11-08T12:53:45.238448Z",
"url": "https://files.pythonhosted.org/packages/a2/d1/0049597b8528e1011f550ffd98cae1962453c2822ac92bc14fafaf1dc06b/molgraph-0.7.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-08 12:53:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "akensert",
"github_project": "molgraph",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "molgraph"
}