Skip to main content
molgraph-title

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.GraphLayer and tensors.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

Overview

molgraph-overview

Documentation

See readthedocs

Papers

Metadata

Release files for molgraph 0.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for molgraph 0.10.1
File Size Uploaded
molgraph-0.10.1.tar.gz 114.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for molgraph 0.10.1
File Interpreter ABI Platform
molgraph-0.10.1-py3-none-any.whl Python 3 none any Details

Total release size: 288.0 kB

Release files / molgraph-0.10.1.tar.gz

Download URL molgraph-0.10.1.tar.gz
Size 114.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9a999f34e0525f1709859cfa69bd32ee01b1633e4b0f6532dcc4ac3f25dcba83
BLAKE2b-256 checksum
How to use checksums
1850850010063367ff4fc73323349fab60d0ab685f69638a5890a7119ef9cd10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / molgraph-0.10.1-py3-none-any.whl

Download URL molgraph-0.10.1-py3-none-any.whl
Size 173.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14f718f6c816358eafa90cba55973ff2de23bcb0149fabf3a713a818b13638fd
BLAKE2b-256 checksum
How to use checksums
9d48786b0f59465c6f1217e1538d1a225457059cb8c05dcadd8e3709321a6624
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.10.1 This release

2 release files

0.10.0

2 release files

0.8.0

2 release files

0.7.11

2 release files

0.7.10

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.11

2 release files

0.6.10

2 release files

0.6.9

2 release files

0.6.8

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.3.12

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page