<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**.
## Quick start
Benchmark the performance of MolGraph [here](https://github.com/akensert/molgraph/blob/main/examples/GNN-Benchmarking.ipynb), and implement a complete model pipeline with MolGraph [here](https://github.com/akensert/molgraph/blob/main/examples/QSAR-GNN-Tutorial.ipynb).
## 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)
Raw data
{
"_id": null,
"home_page": null,
"name": "molgraph",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "machine-learning, deep-learning, graph-neural-networks, molecular-machine-learning, molecular-graphs, computational-chemistry, computational-biology",
"author": null,
"author_email": "Alexander Kensert <alexander.kensert@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/7e/c1/b1a37495b0c145e94fc67ef66aded745cb777bc6c16a2e2684813f230dee/molgraph-0.8.0.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## Quick start\nBenchmark the performance of MolGraph [here](https://github.com/akensert/molgraph/blob/main/examples/GNN-Benchmarking.ipynb), and implement a complete model pipeline with MolGraph [here](https://github.com/akensert/molgraph/blob/main/examples/QSAR-GNN-Tutorial.ipynb). \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",
"bugtrack_url": null,
"license": "MIT",
"summary": "Graph Neural Networks for Molecular Machine Learning",
"version": "0.8.0",
"project_urls": {
"Homepage": "https://github.com/akensert/molgraph"
},
"split_keywords": [
"machine-learning",
" deep-learning",
" graph-neural-networks",
" molecular-machine-learning",
" molecular-graphs",
" computational-chemistry",
" computational-biology"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "5bc70310499b5ddf7fbf17b9c32ba892d4c0ae6752fa387e2e6888ac85ccbd93",
"md5": "e7a0335937f5700d04408eaabb4280a5",
"sha256": "9636ebe1e45f1763a4fdfe79255b0bfbc99472d9682d07c4ef00ba15d05cdd85"
},
"downloads": -1,
"filename": "molgraph-0.8.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e7a0335937f5700d04408eaabb4280a5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 173570,
"upload_time": "2025-02-11T13:40:34",
"upload_time_iso_8601": "2025-02-11T13:40:34.788709Z",
"url": "https://files.pythonhosted.org/packages/5b/c7/0310499b5ddf7fbf17b9c32ba892d4c0ae6752fa387e2e6888ac85ccbd93/molgraph-0.8.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7ec1b1a37495b0c145e94fc67ef66aded745cb777bc6c16a2e2684813f230dee",
"md5": "123ef04fed8cc0f020cf8552f314845a",
"sha256": "313f4f585ddc7547efa6fa9fa8731ede3aa04233d9c0bdf2644b624dd562afde"
},
"downloads": -1,
"filename": "molgraph-0.8.0.tar.gz",
"has_sig": false,
"md5_digest": "123ef04fed8cc0f020cf8552f314845a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 114184,
"upload_time": "2025-02-11T13:40:37",
"upload_time_iso_8601": "2025-02-11T13:40:37.011573Z",
"url": "https://files.pythonhosted.org/packages/7e/c1/b1a37495b0c145e94fc67ef66aded745cb777bc6c16a2e2684813f230dee/molgraph-0.8.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-11 13:40:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "akensert",
"github_project": "molgraph",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "molgraph"
}