Graph Neural Networks for Molecular Machine Learning
Project description
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 API:
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:
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:
pip install molgraph
For GPU users:
pip install molgraph[gpu]
Implementations
- Tensors
- Graph tensor
- A composite tensor holding graph data; compatible with
tf.data.Dataset
,keras.Sequential
and much more.
- A composite tensor holding graph data; compatible with
- Graph tensor
- Layers
- Models
Overview
Documentation
See readthedocs
Papers
- MolGraph: a Python package for the implementation of molecular graphs and graph neural networks with TensorFlow and Keras
- A hands-on tutorial on quantitative structure-activity relationships using fully expressive graph neural networks
Requirements
- Python (version >= 3.10)
- TensorFlow (version 2.15.*)
- RDKit (version 2023.9.*)
- Pandas
- IPython
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
molgraph-0.7.4.tar.gz
(114.4 kB
view details)
Built Distribution
molgraph-0.7.4-py3-none-any.whl
(209.4 kB
view details)
File details
Details for the file molgraph-0.7.4.tar.gz
.
File metadata
- Download URL: molgraph-0.7.4.tar.gz
- Upload date:
- Size: 114.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0d509fd03684305e3412c5a45711026204f27325b9ffa2ee6257c06645f87d6 |
|
MD5 | 7452a83ee17e340e780fbb13673d01b0 |
|
BLAKE2b-256 | a1312817dc83f59449362561c7cbc42424570fb898692fc27ad49126903a11da |
File details
Details for the file molgraph-0.7.4-py3-none-any.whl
.
File metadata
- Download URL: molgraph-0.7.4-py3-none-any.whl
- Upload date:
- Size: 209.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1afecc6d63b85a8fc38c30876bce1c40de565c07e5564134564407f6090afefd |
|
MD5 | d4a09256c872407bfea70c6ffd8fe616 |
|
BLAKE2b-256 | 8a9ef955fd3ce8ec1d57453365dbaa8950cdae80beb17493c88222a8c54a1a7f |