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.

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

Overview

molgraph-overview

Documentation

See readthedocs

Papers

Requirements

  • Python (version >= 3.10)
    • TensorFlow (version 2.15.*)
    • RDKit (version 2023.9.*)
    • Pandas
    • IPython

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

Uploaded Source

Built Distribution

molgraph-0.7.4-py3-none-any.whl (209.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: molgraph-0.7.4.tar.gz
  • Upload date:
  • Size: 114.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for molgraph-0.7.4.tar.gz
Algorithm Hash digest
SHA256 e0d509fd03684305e3412c5a45711026204f27325b9ffa2ee6257c06645f87d6
MD5 7452a83ee17e340e780fbb13673d01b0
BLAKE2b-256 a1312817dc83f59449362561c7cbc42424570fb898692fc27ad49126903a11da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: molgraph-0.7.4-py3-none-any.whl
  • Upload date:
  • Size: 209.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for molgraph-0.7.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1afecc6d63b85a8fc38c30876bce1c40de565c07e5564134564407f6090afefd
MD5 d4a09256c872407bfea70c6ffd8fe616
BLAKE2b-256 8a9ef955fd3ce8ec1d57453365dbaa8950cdae80beb17493c88222a8c54a1a7f

See more details on using hashes here.

Supported by

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