Graph Neural Networks for Molecular Machine Learning
Project description
Graph Neural Networks with TensorFlow and Keras. Focused on Molecular Machine Learning.
[!NOTE] For compatability with Keras 3, see the more recent project MolCraft. MolCraft also provides improved featurization of molecules (including the addition of super nodes) and improved modules (including
models.GraphModel,layers.GraphLayerandtensors.GraphTensor).
Quick start
Benchmark the performance of MolGraph here, and implement a complete model pipeline with MolGraph here.
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.Sequentialand much more.
- A composite tensor holding graph data; compatible with
- Graph tensor
- Layers
- Models
Overview
Documentation
See readthedocs
Papers
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file molgraph-0.10.0.tar.gz.
File metadata
- Download URL: molgraph-0.10.0.tar.gz
- Upload date:
- Size: 114.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
223a9ac9be5a68b518bf11c12f033183463b3a1e21e52e9874e54d7567c09eb5
|
|
| MD5 |
2925172a54f310e41fdc30d5a19ee36a
|
|
| BLAKE2b-256 |
a83107f3576dc8fbb77b3ede554e3e0357221baf54a8e8a3123b3c5ac9de4d24
|
File details
Details for the file molgraph-0.10.0-py3-none-any.whl.
File metadata
- Download URL: molgraph-0.10.0-py3-none-any.whl
- Upload date:
- Size: 173.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12e6b10efae0ae7e0c5a87cf3468ba4af79e357622cf810965a674037e88b56c
|
|
| MD5 |
d22cd642ed8bfb9cd3738aaa6cdfc733
|
|
| BLAKE2b-256 |
4e32f925e6925f4979abb7a2269d92d5c0b4108c9856b7aa6903dc1439b5acd6
|