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.8.tar.gz
(114.7 kB
view details)
Built Distribution
molgraph-0.7.8-py3-none-any.whl
(211.4 kB
view details)
File details
Details for the file molgraph-0.7.8.tar.gz
.
File metadata
- Download URL: molgraph-0.7.8.tar.gz
- Upload date:
- Size: 114.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38304750b31066dda7f9c4d17fe19d917ac5910dbe90a2d068c423ca95e3374f |
|
MD5 | 420d531bc4c478269199a27427bd417c |
|
BLAKE2b-256 | a2d10049597b8528e1011f550ffd98cae1962453c2822ac92bc14fafaf1dc06b |
File details
Details for the file molgraph-0.7.8-py3-none-any.whl
.
File metadata
- Download URL: molgraph-0.7.8-py3-none-any.whl
- Upload date:
- Size: 211.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 | bbc660c027904a24536b15b70a05c186a4e66db6ba5abab19002968384bdc9e5 |
|
MD5 | 7398d055394ec2d55a4e842ee0edad75 |
|
BLAKE2b-256 | 45d53ba436d36d805a4909ab2e4349b5df390d7ee7851ed41fcb7c007a83c47b |