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.1.tar.gz (114.2 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.1-py3-none-any.whl (173.8 kB view details)

Uploaded Python 3

File details

Details for the file molgraph-0.10.1.tar.gz.

File metadata

  • Download URL: molgraph-0.10.1.tar.gz
  • Upload date:
  • Size: 114.2 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.1.tar.gz
Algorithm Hash digest
SHA256 9a999f34e0525f1709859cfa69bd32ee01b1633e4b0f6532dcc4ac3f25dcba83
MD5 6656775c9974658f3ee1e1f9f093d5db
BLAKE2b-256 1850850010063367ff4fc73323349fab60d0ab685f69638a5890a7119ef9cd10

See more details on using hashes here.

File details

Details for the file molgraph-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: molgraph-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 173.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14f718f6c816358eafa90cba55973ff2de23bcb0149fabf3a713a818b13638fd
MD5 3d7de0f940a112cd24d4ea3f2b237324
BLAKE2b-256 9d48786b0f59465c6f1217e1538d1a225457059cb8c05dcadd8e3709321a6624

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