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

Uploaded Source

Built Distribution

molgraph-0.7.8-py3-none-any.whl (211.4 kB view details)

Uploaded Python 3

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

Hashes for molgraph-0.7.8.tar.gz
Algorithm Hash digest
SHA256 38304750b31066dda7f9c4d17fe19d917ac5910dbe90a2d068c423ca95e3374f
MD5 420d531bc4c478269199a27427bd417c
BLAKE2b-256 a2d10049597b8528e1011f550ffd98cae1962453c2822ac92bc14fafaf1dc06b

See more details on using hashes here.

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

Hashes for molgraph-0.7.8-py3-none-any.whl
Algorithm Hash digest
SHA256 bbc660c027904a24536b15b70a05c186a4e66db6ba5abab19002968384bdc9e5
MD5 7398d055394ec2d55a4e842ee0edad75
BLAKE2b-256 45d53ba436d36d805a4909ab2e4349b5df390d7ee7851ed41fcb7c007a83c47b

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