Skip to main content

Graph Neural Networks for Molecular Machine Learning

Project description

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

Project details


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.10.0.tar.gz (114.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

molgraph-0.10.0-py3-none-any.whl (173.7 kB view details)

Uploaded Python 3

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

Hashes for molgraph-0.10.0.tar.gz
Algorithm Hash digest
SHA256 223a9ac9be5a68b518bf11c12f033183463b3a1e21e52e9874e54d7567c09eb5
MD5 2925172a54f310e41fdc30d5a19ee36a
BLAKE2b-256 a83107f3576dc8fbb77b3ede554e3e0357221baf54a8e8a3123b3c5ac9de4d24

See more details on using hashes here.

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

Hashes for molgraph-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12e6b10efae0ae7e0c5a87cf3468ba4af79e357622cf810965a674037e88b56c
MD5 d22cd642ed8bfb9cd3738aaa6cdfc733
BLAKE2b-256 4e32f925e6925f4979abb7a2269d92d5c0b4108c9856b7aa6903dc1439b5acd6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page