Skip to main content

Graph Neural Networks for Molecular Machine Learning

Project description

molcraft-logo

Deep Learning on Molecules: A Minimalistic GNN package for Molecular ML.

[!NOTE]
In progress.

Installation

For CPU users:

pip install --pre molcraft

For GPU users:

pip install --pre molcraft[gpu]

Examples

from molcraft import features
from molcraft import descriptors
from molcraft import featurizers 
from molcraft import layers
from molcraft import models 
import keras

featurizer = featurizers.MolGraphFeaturizer(
    atom_features=[
        features.AtomType(),
        features.NumHydrogens(),
        features.Degree(),
    ],
    bond_features=[
        features.BondType(),
        features.IsRotatable(),
    ],
    super_node=True,
    self_loops=True,
    include_hydrogens=False,
)

graph = featurizer([('N[C@@H](C)C(=O)O', 2.5), ('N[C@@H](CS)C(=O)O', 1.5)])
print(graph)

model = models.GraphModel.from_layers(
    [
        layers.Input(graph.spec),
        layers.NodeEmbedding(dim=128),
        layers.EdgeEmbedding(dim=128),
        layers.GraphConv(units=128),
        layers.GraphConv(units=128),
        layers.GraphConv(units=128),
        layers.GraphConv(units=128),
        layers.Readout(),
        keras.layers.Dense(units=1024, activation='elu'),
        keras.layers.Dense(units=1024, activation='elu'),
        keras.layers.Dense(1)
    ]
)

pred = model(graph)
print(pred)

# featurizers.save_featurizer(featurizer, '/tmp/featurizer.json')
# models.save_model(model, '/tmp/model.keras')

# loaded_featurizer = featurizers.load_featurizer('/tmp/featurizer.json')
# loaded_model = models.load_model('/tmp/model.keras')

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

molcraft-0.1.0rc1.tar.gz (44.8 kB view details)

Uploaded Source

Built Distribution

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

molcraft-0.1.0rc1-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

Details for the file molcraft-0.1.0rc1.tar.gz.

File metadata

  • Download URL: molcraft-0.1.0rc1.tar.gz
  • Upload date:
  • Size: 44.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for molcraft-0.1.0rc1.tar.gz
Algorithm Hash digest
SHA256 8f63e6d033420dc99130723e32bf6e986da85077d02c978d4a8544216d889a0c
MD5 0edd358886f83c38a2eb84f971e51977
BLAKE2b-256 5f9b1b9d5b9cd417da8f2c2d4530be0b799a9ec236454f138ac525c24027de14

See more details on using hashes here.

File details

Details for the file molcraft-0.1.0rc1-py3-none-any.whl.

File metadata

  • Download URL: molcraft-0.1.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 44.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for molcraft-0.1.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 07def6a89d6889043e637cc9ac440473907897547854e37ea914e9332ff13fc9
MD5 4fd9450c3a3bc007ab2ac0ebf4c04751
BLAKE2b-256 060d803f93ce28ac87086eff7eb816e48e238835da4a5b9fdbedeb9c69cac37b

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