{"id":13477053,"url":"https://github.com/aimat-lab/gcnn_keras","last_synced_at":"2026-02-03T11:23:25.712Z","repository":{"id":40509237,"uuid":"280404197","full_name":"aimat-lab/gcnn_keras","owner":"aimat-lab","description":"Graph convolutions in Keras with TensorFlow, PyTorch or Jax.","archived":false,"fork":false,"pushed_at":"2025-01-08T13:54:52.000Z","size":96909,"stargazers_count":116,"open_issues_count":13,"forks_count":30,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-04T16:32:58.563Z","etag":null,"topics":["graph-algorithms","graph-convolution","graph-networks","graphs","machine-learning","molecules","networks","neural-networks","ragged-tensors"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aimat-lab.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-17T11:12:46.000Z","updated_at":"2025-09-03T13:23:34.000Z","dependencies_parsed_at":"2023-02-17T22:00:37.260Z","dependency_job_id":"26c3b7a3-289f-4f98-a8fc-3045d940466b","html_url":"https://github.com/aimat-lab/gcnn_keras","commit_stats":{"total_commits":2515,"total_committers":9,"mean_commits":"279.44444444444446","dds":"0.47833001988071566","last_synced_commit":"dacae41c9f7b613a6ad04430cc210287a684651e"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/aimat-lab/gcnn_keras","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimat-lab%2Fgcnn_keras","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimat-lab%2Fgcnn_keras/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimat-lab%2Fgcnn_keras/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimat-lab%2Fgcnn_keras/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aimat-lab","download_url":"https://codeload.github.com/aimat-lab/gcnn_keras/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimat-lab%2Fgcnn_keras/sbom","scorecard":{"id":173059,"data":{"date":"2025-08-11","repo":{"name":"github.com/aimat-lab/gcnn_keras","commit":"ab2a914301e2ff3fe2d231153e4f8b785fc9996a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/unittests.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unittests.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/aimat-lab/gcnn_keras/unittests.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unittests.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/aimat-lab/gcnn_keras/unittests.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/unittests.yml:28","Warn: pipCommand not pinned by hash: .github/workflows/unittests.yml:29","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Vulnerabilities","score":0,"reason":"42 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-29gw-9793-fvw7","Warn: Project is vulnerable to: PYSEC-2015-24 / GHSA-4vwq-x64q-j4cj","Warn: Project is vulnerable to: PYSEC-2017-46 / GHSA-66gw-5xpf-gfp5","Warn: Project is vulnerable to: PYSEC-2015-25 / GHSA-92mr-v722-f48m","Warn: Project is vulnerable to: PYSEC-2022-12 / GHSA-pq7m-3gw7-gq5x","Warn: Project is vulnerable to: PYSEC-2017-47","Warn: Project is vulnerable to: GHSA-cpwx-vrp4-4pq7","Warn: Project is vulnerable to: GHSA-gmj6-6f8f-6699","Warn: Project is vulnerable to: GHSA-h5c8-rqwp-cp95","Warn: Project is vulnerable to: GHSA-h75v-3vvj-5mfj","Warn: Project is vulnerable to: GHSA-q2x7-8rv6-6q7h","Warn: Project is vulnerable to: GHSA-48g7-3x6r-xfhp","Warn: Project is vulnerable to: GHSA-c9rc-mg46-23w3","Warn: Project is vulnerable to: GHSA-cjgq-5qmw-rcj6","Warn: Project is vulnerable to: PYSEC-2018-34 / GHSA-2fc2-6r4j-p65h","Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6","Warn: Project is vulnerable to: PYSEC-2019-108 / GHSA-9fq2-x9r6-wfmf","Warn: Project is vulnerable to: PYSEC-2018-33 / GHSA-cw6w-4rcx-xphc","Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f","Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm","Warn: Project is vulnerable to: PYSEC-2017-1 / GHSA-frgw-fgh6-9g52","Warn: Project is vulnerable to: PYSEC-2020-73","Warn: Project is vulnerable to: GHSA-5jqp-885w-xj32","Warn: Project is vulnerable to: PYSEC-2024-226 / GHSA-vgv8-5cpj-qj2f","Warn: Project is vulnerable to: PYSEC-2021-142 / GHSA-8q59-q68h-6hv4","Warn: Project is vulnerable to: PYSEC-2018-49 / GHSA-rprw-h62v-c2w7","Warn: Project is vulnerable to: PYSEC-2020-107 / GHSA-jjw5-xxj6-pcv5","Warn: Project is vulnerable to: PYSEC-2024-110 / GHSA-jw8x-6495-233v","Warn: Project is vulnerable to: PYSEC-2020-108","Warn: Project is vulnerable to: PYSEC-2019-156 / GHSA-xp76-357g-9wqq","Warn: Project is vulnerable to: PYSEC-2023-102","Warn: Project is vulnerable to: PYSEC-2023-114","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2023-74 / GHSA-j8r2-6x86-q33q","Warn: Project is vulnerable to: GHSA-3749-ghw9-m3mg","Warn: Project is vulnerable to: PYSEC-2025-41 / GHSA-53q9-r3pm-6pq6","Warn: Project is vulnerable to: PYSEC-2024-252 / GHSA-5pcm-hx3q-hm94","Warn: Project is vulnerable to: GHSA-887c-mr87-cxwp","Warn: Project is vulnerable to: PYSEC-2024-251 / GHSA-pg7h-5qx3-wjr3","Warn: Project is vulnerable to: PYSEC-2024-250","Warn: Project is vulnerable to: PYSEC-2024-259"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T17:04:48.808Z","repository_id":40509237,"created_at":"2025-08-16T17:04:48.808Z","updated_at":"2025-08-16T17:04:48.808Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29044110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T10:09:22.136Z","status":"ssl_error","status_checked_at":"2026-02-03T10:09:16.814Z","response_time":96,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graph-algorithms","graph-convolution","graph-networks","graphs","machine-learning","molecules","networks","neural-networks","ragged-tensors"],"created_at":"2024-07-31T16:01:37.713Z","updated_at":"2026-02-03T11:23:25.670Z","avatar_url":"https://github.com/aimat-lab.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook","Representation Learning"],"sub_categories":[],"readme":"![GitHub release (latest by date)](https://img.shields.io/github/v/release/aimat-lab/gcnn_keras)\r\n[![Documentation Status](https://readthedocs.org/projects/kgcnn/badge/?version=latest)](https://kgcnn.readthedocs.io/en/latest/?badge=latest)\r\n[![PyPI version](https://badge.fury.io/py/kgcnn.svg)](https://badge.fury.io/py/kgcnn)\r\n![PyPI - Downloads](https://img.shields.io/pypi/dm/kgcnn)\r\n[![kgcnn_unit_tests](https://github.com/aimat-lab/gcnn_keras/actions/workflows/unittests.yml/badge.svg)](https://github.com/aimat-lab/gcnn_keras/actions/workflows/unittests.yml)\r\n[![DOI](https://img.shields.io/badge/DOI-10.1016%2Fj.simpa.2021.100095%20-blue)](https://doi.org/10.1016/j.simpa.2021.100095)\r\n![GitHub](https://img.shields.io/github/license/aimat-lab/gcnn_keras)\r\n![GitHub issues](https://img.shields.io/github/issues/aimat-lab/gcnn_keras)\r\n![Maintenance](https://img.shields.io/maintenance/yes/2024)\r\n\r\n# Keras Graph Convolution Neural Networks\r\n\u003cp align=\"left\"\u003e\r\n  \u003cimg src=\"https://github.com/aimat-lab/gcnn_keras/blob/master/docs/source/_static/icon.svg\" height=\"80\"/\u003e\r\n\u003c/p\u003e\r\n\r\n\r\n[General](#general) | [Requirements](#requirements) | [Installation](#installation) | [Documentation](#documentation) | [Implementation details](#implementation-details)\r\n | [Literature](#literature) | [Data](#data)  | [Datasets](#datasets) | [Training](#training) | [Issues](#issues) | [Citing](#citing) | [References](#references)\r\n \r\n\r\n\u003ca name=\"general\"\u003e\u003c/a\u003e\r\n# General\r\n\r\nThe package in [kgcnn](kgcnn) contains several layer classes to build up graph convolution models in \r\nKeras with Tensorflow, PyTorch or Jax as backend. \r\nSome models are given as an example in literature.\r\nA [documentation](https://kgcnn.readthedocs.io/en/latest/index.html) is generated in [docs](docs).\r\nFocus of [kgcnn](kgcnn) is (batched) graph learning for molecules [kgcnn.molecule](kgcnn/molecule) and materials [kgcnn.crystal](kgcnn/crystal).\r\nIf you want to get in contact, feel free to [discuss](https://github.com/aimat-lab/gcnn_keras/discussions). \r\n\r\nNote that kgcnn\u003e=4.0.0 requires keras\u003e=3.0.0. Previous versions of kgcnn were focused on ragged tensors of tensorflow, for which\r\nhyperparameter for models should also transfer to kgcnn 4.0 by adding `input_tensor_type: \"ragged\"` and checking the order and *dtype* of inputs.\r\n\r\n\u003ca name=\"requirements\"\u003e\u003c/a\u003e\r\n# Requirements\r\n\r\nStandard python package requirements are installed automatically.\r\nHowever, you must make sure to install the GPU/TPU acceleration for the backend of your choice.\r\n\r\n\u003ca name=\"installation\"\u003e\u003c/a\u003e\r\n# Installation\r\n\r\nClone [repository](https://github.com/aimat-lab/gcnn_keras) or latest [release](https://github.com/aimat-lab/gcnn_keras/releases) and install with editable mode or latest release via [Python Package Index](https://pypi.org/project/kgcnn/).\r\n```bash\r\npip install kgcnn\r\n```\r\n\u003ca name=\"documentation\"\u003e\u003c/a\u003e\r\n# Documentation\r\n\r\nAuto-documentation is generated at https://kgcnn.readthedocs.io/en/latest/index.html .\r\n\r\n\u003ca name=\"implementation-details\"\u003e\u003c/a\u003e\r\n# Implementation details\r\n\r\n### Representation\r\n\r\nA graph of `N` nodes and `M` edges is commonly represented by a list of node or edge attributes: `node_attr` or `edge_attr`, respectively. \r\nPlus a list of indices pairs `(i, j)` that represents a directed edge in the graph: `edge_index`. \r\nThe feature dimension of the attributes is denoted by `F`. \r\nAlternatively, an adjacency matrix `A_ij` of shape `(N, N)` can be ascribed that has 'ones' entries\r\nwhere there is an edge between nodes and 'zeros' elsewhere. Consequently, sum of `A_ij` will give `M` edges.\r\n\r\n\u003ca name=\"implementation-details-input\"\u003e\u003c/a\u003e\r\n### Input\r\n\r\nFor learning on batches or single graphs, following tensor representation can be chosen:\r\n\r\n###### Batched Graphs\r\n\r\n* `node_attr`: Node attributes of shape `(batch, N, F)` and dtype *float*\r\n* `edge_attr`: Edge attributes of shape `(batch, M, F)` and dtype *float*\r\n* `edge_index`: Indices of shape `(batch, M, 2)` and dtype *int*\r\n* `graph_attr`: Graph attributes of shape `(batch, F)` and dtype *float*\r\n\r\nGraphs are stacked along the batch dimension `batch`. Note that for flexible sized graphs the tensor has to be padded up to a max `N`/`M` or ragged tensors are used,\r\nwith a ragged rank of one.\r\n\r\n###### Disjoint Graphs\r\n\r\n* `node_attr`: Node attributes of shape `([N], F)` and dtype *float*\r\n* `edge_attr`: Edge attributes of shape `([M], F)` and dtype *float*\r\n* `edge_index`: Indices of shape `(2, [M])` and dtype *int*\r\n* `batch_ID`: Graph ID of shape `([N], )` and dtype *int*\r\n\r\nHere, the lists essentially represent one graph but which consists of disjoint sub-graphs from the batch, \r\nwhich has been introduced by PytorchGeometric (PyG). \r\nFor pooling, the graph assignment is stored in `batch_ID`. \r\nNote, that for Jax, we can not have dynamic shapes, so we use a padded disjoint representation assigning \r\nall padded nodes to a discarded graph with zero index.\r\n\r\n### Model\r\n\r\nThe keras layers in [kgcnn.layers](kgcnn/layers) can be used with PyG compatible tensor representation. \r\nOr even by simply wrapping a PyG model with `TorchModuleWrapper`. Efficient model loading can be achieved \r\nin multiple ways (see [kgcnn.io](kgcnn/io)).\r\nFor most simple keras-like behaviour, the model can fed with batched padded or ragged tensor which are converted to/from\r\ndisjoint representation wrapping the PyG equivalent model.\r\nHere an example of a minimal message passing GNN:\r\n\r\n```python\r\nimport keras as ks\r\nfrom kgcnn.layers.casting import CastBatchedIndicesToDisjoint\r\nfrom kgcnn.layers.gather import GatherNodes\r\nfrom kgcnn.layers.pooling import PoolingNodes\r\nfrom kgcnn.layers.aggr import AggregateLocalEdges\r\n\r\n# Example for padded input.\r\nns = ks.layers.Input(shape=(None, 64), dtype=\"float32\", name=\"node_attributes\")\r\ne_idx = ks.layers.Input(shape=(None, 2), dtype=\"int64\", name=\"edge_indices\")\r\ntotal_n = ks.layers.Input(shape=(), dtype=\"int64\", name=\"total_nodes\")  # Or mask\r\ntotal_e = ks.layers.Input(shape=(), dtype=\"int64\", name=\"total_edges\")  # Or mask\r\n\r\nn, idx, batch_id, _, _, _, _, _ = CastBatchedIndicesToDisjoint(uses_mask=False)([ns, e_idx, total_n, total_e])\r\nn_in_out = GatherNodes()([n, idx])\r\nnode_messages = ks.layers.Dense(64, activation='relu')(n_in_out)\r\nnode_updates = AggregateLocalEdges()([n, node_messages, idx])\r\nn_node_updates = ks.layers.Concatenate()([n, node_updates])\r\nn_embedding = ks.layers.Dense(1)(n_node_updates)\r\ng_embedding = PoolingNodes()([total_n, n_embedding, batch_id])\r\n\r\nmessage_passing = ks.models.Model(inputs=[ns, e_idx, total_n, total_e], outputs=g_embedding)\r\n```\r\n\r\nThe actual message passing model can further be structured by e.g. subclassing the message passing base layer:\r\n\r\n```python\r\nimport keras as ks\r\nfrom kgcnn.layers.message import MessagePassingBase\r\n\r\nclass MyMessageNN(MessagePassingBase):\r\n\r\n    def __init__(self, units, **kwargs):\r\n        super(MyMessageNN, self).__init__(**kwargs)\r\n        self.dense = ks.layers.Dense(units)\r\n        self.add = ks.layers.Add()\r\n\r\n    def message_function(self, inputs, **kwargs):\r\n        n_in, n_out, edges = inputs\r\n        return self.dense(n_out, **kwargs)\r\n\r\n    def update_nodes(self, inputs, **kwargs):\r\n        nodes, nodes_update = inputs\r\n        return self.add([nodes, nodes_update], **kwargs)\r\n```\r\n\r\n\u003ca name=\"literature\"\u003e\u003c/a\u003e\r\n# Literature\r\nThe following models, proposed in literature, have a module in [literature](kgcnn/literature). The module usually exposes a `make_model` function\r\nto create a ``keras.models.Model``. The models can but must not be build completely from `kgcnn.layers` and can for example include\r\noriginal implementations (with proper licencing).\r\n\r\n* **[AttentiveFP](kgcnn/literature/AttentiveFP)**: [Pushing the Boundaries of Molecular Representation for Drug Discovery with the Graph Attention Mechanism](https://pubs.acs.org/doi/10.1021/acs.jmedchem.9b00959) by Xiong et al. (2019)\r\n* **[CGCNN](kgcnn/literature/CGCNN)**: [Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Properties](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.120.145301) by Xie et al. (2018)\r\n* **[CMPNN](kgcnn/literature/CMPNN)**: [Communicative Representation Learning on Attributed Molecular Graphs](https://www.ijcai.org/proceedings/2020/0392.pdf) by Song et al. (2020)\r\n* **[DGIN](kgcnn/literature/DGIN)**: [Improved Lipophilicity and Aqueous Solubility Prediction with Composite Graph Neural Networks ](https://pubmed.ncbi.nlm.nih.gov/34684766/) by Wieder et al. (2021)\r\n* **[DimeNetPP](kgcnn/literature/DimeNetPP)**: [Fast and Uncertainty-Aware Directional Message Passing for Non-Equilibrium Molecules](https://arxiv.org/abs/2011.14115) by Klicpera et al. (2020)\r\n* **[DMPNN](kgcnn/literature/DMPNN)**: [Analyzing Learned Molecular Representations for Property Prediction](https://pubs.acs.org/doi/abs/10.1021/acs.jcim.9b00237) by Yang et al. (2019)\r\n* **[EGNN](kgcnn/literature/EGNN)**: [E(n) Equivariant Graph Neural Networks](https://arxiv.org/abs/2102.09844) by Satorras et al. (2021)\r\n* **[GAT](kgcnn/literature/GAT)**: [Graph Attention Networks](https://arxiv.org/abs/1710.10903) by Veličković et al. (2018)\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003e ... and many more \u003cb\u003e(click to expand)\u003c/b\u003e.\u003c/summary\u003e\r\n\r\n* **[GATv2](kgcnn/literature/GATv2)**: [How Attentive are Graph Attention Networks?](https://arxiv.org/abs/2105.14491) by Brody et al. (2021)\r\n* **[GCN](kgcnn/literature/GCN)**: [Semi-Supervised Classification with Graph Convolutional Networks](https://arxiv.org/abs/1609.02907) by Kipf et al. (2016)\r\n* **[GIN](kgcnn/literature/GIN)**: [How Powerful are Graph Neural Networks?](https://arxiv.org/abs/1810.00826) by Xu et al. (2019)\r\n* **[GNNExplainer](kgcnn/literature/GNNExplain)**: [GNNExplainer: Generating Explanations for Graph Neural Networks](https://arxiv.org/abs/1903.03894) by Ying et al. (2019)\r\n* **[GNNFilm](kgcnn/literature/GNNFilm)**: [GNN-FiLM: Graph Neural Networks with Feature-wise Linear Modulation](https://arxiv.org/abs/1906.12192) by Marc Brockschmidt (2020)\r\n* **[GraphSAGE](kgcnn/literature/GraphSAGE)**: [Inductive Representation Learning on Large Graphs](http://arxiv.org/abs/1706.02216) by Hamilton et al. (2017)\r\n* **[HamNet](kgcnn/literature/HamNet)**: [HamNet: Conformation-Guided Molecular Representation with Hamiltonian Neural Networks](https://arxiv.org/abs/2105.03688) by Li et al. (2021)\r\n* **[HDNNP2nd](kgcnn/literature/HDNNP2nd)**: [Atom-centered symmetry functions for constructing high-dimensional neural network potentials](https://aip.scitation.org/doi/abs/10.1063/1.3553717) by Jörg Behler (2011)\r\n* **[INorp](kgcnn/literature/INorp)**: [Interaction Networks for Learning about Objects,Relations and Physics](https://arxiv.org/abs/1612.00222) by Battaglia et al. (2016)\r\n* **[MAT](kgcnn/literature/MAT)**: [Molecule Attention Transformer](https://arxiv.org/abs/2002.08264) by Maziarka et al. (2020)\r\n* **[MEGAN](kgcnn/literature/MEGAN)**: [MEGAN: Multi-explanation Graph Attention Network](https://link.springer.com/chapter/10.1007/978-3-031-44067-0_18) by Teufel et al. (2023)\r\n* **[Megnet](kgcnn/literature/Megnet)**: [Graph Networks as a Universal Machine Learning Framework for Molecules and Crystals](https://doi.org/10.1021/acs.chemmater.9b01294) by Chen et al. (2019)\r\n* **[MoGAT](kgcnn/literature/MoGAT)**: [Multi-order graph attention network for water solubility prediction and interpretation](https://www.nature.com/articles/s41598-022-25701-5) by Lee et al. (2023)\r\n* **[MXMNet](kgcnn/literature/MXMNet)**: [Molecular Mechanics-Driven Graph Neural Network with Multiplex Graph for Molecular Structures](https://arxiv.org/abs/2011.07457) by Zhang et al. (2020)\r\n* **[NMPN](kgcnn/literature/NMPN)**: [Neural Message Passing for Quantum Chemistry](http://arxiv.org/abs/1704.01212) by Gilmer et al. (2017)\r\n* **[PAiNN](kgcnn/literature/PAiNN)**: [Equivariant message passing for the prediction of tensorial properties and molecular spectra](https://arxiv.org/pdf/2102.03150.pdf) by Schütt et al. (2020)\r\n* **[RGCN](kgcnn/literature/RGCN)**: [Modeling Relational Data with Graph Convolutional Networks](https://arxiv.org/abs/1703.06103) by Schlichtkrull et al. (2017)\r\n* **[rGIN](kgcnn/literature/rGIN)** [Random Features Strengthen Graph Neural Networks](https://arxiv.org/abs/2002.03155) by Sato et al. (2020)\r\n* **[Schnet](kgcnn/literature/Schnet)**: [SchNet – A deep learning architecture for molecules and materials ](https://aip.scitation.org/doi/10.1063/1.5019779) by Schütt et al. (2017)\r\n\r\n\u003c/details\u003e\r\n\r\n\r\n\u003ca name=\"data\"\u003e\u003c/a\u003e\r\n# Data\r\n\r\nData handling classes are given in `kgcnn.data` which stores graphs as `List[Dict]` .\r\n\r\n#### Graph dictionary\r\n\r\nGraphs are represented by a dictionary `GraphDict` of (numpy) arrays which behaves like a python `dict`.\r\nThere are graph pre- and postprocessors in ``kgcnn.graph`` which take specific properties by name and apply a\r\nprocessing function or transformation. \r\n\r\n\u003e [!IMPORTANT]  \r\n\u003e They can do any operation but note that `GraphDict` does not impose an actual graph structure!\r\n\u003e For example to sort edge indices make sure that all attributes are sorted accordingly. \r\n\r\n\r\n```python\r\nfrom kgcnn.graph import GraphDict\r\n# Single graph.\r\ngraph = GraphDict({\"edge_indices\": [[1, 0], [0, 1]], \"node_label\": [[0], [1]]})\r\ngraph.set(\"graph_labels\", [0])  # use set(), get() to assign (tensor) properties.\r\ngraph.set(\"edge_attributes\", [[1.0], [2.0]])\r\ngraph.to_networkx()\r\n# Modify with e.g. preprocessor.\r\nfrom kgcnn.graph.preprocessor import SortEdgeIndices\r\nSortEdgeIndices(edge_indices=\"edge_indices\", edge_attributes=\"^edge_(?!indices$).*\", in_place=True)(graph)\r\n```\r\n\r\n#### List of graph dictionaries\r\n\r\nA `MemoryGraphList` should behave identical to a python list but contain only `GraphDict` items.\r\n\r\n```python\r\nfrom kgcnn.data import MemoryGraphList\r\n# List of graph dicts.\r\ngraph_list = MemoryGraphList([{\"edge_indices\": [[0, 1], [1, 0]]}, {\"edge_indices\": [[0, 0]]}, {}])\r\ngraph_list.clean([\"edge_indices\"])  # Remove graphs without property\r\ngraph_list.get(\"edge_indices\")  # opposite is set()\r\n# Easily cast to tensor; makes copy.\r\ntensor = graph_list.tensor([{\"name\": \"edge_indices\"}])  # config of keras `Input` layer\r\n# Or directly modify list.\r\nfor i, x in enumerate(graph_list):\r\n    x.set(\"graph_number\", [i])\r\nprint(len(graph_list), graph_list[:2])  # Also supports indexing lists.\r\n```\r\n\r\n\r\n\u003ca name=\"datasets\"\u003e\u003c/a\u003e\r\n# Datasets\r\n\r\nThe `MemoryGraphDataset` inherits from `MemoryGraphList` but must be initialized with file information on disk that points to a `data_directory` for the dataset.\r\nThe `data_directory` can have a subdirectory for files and/or single file such as a CSV file: \r\n\r\n```bash\r\n├── data_directory\r\n    ├── file_directory\r\n    │   ├── *.*\r\n    │   └── ... \r\n    ├── file_name\r\n    └── dataset_name.kgcnn.pickle\r\n```\r\nA base dataset class is created with path and name information:\r\n\r\n```python\r\nfrom kgcnn.data import MemoryGraphDataset\r\ndataset = MemoryGraphDataset(data_directory=\"ExampleDir/\", \r\n                             dataset_name=\"Example\",\r\n                             file_name=None, file_directory=None)\r\ndataset.save()  # opposite is load(). \r\n```\r\n\r\nThe subclasses `QMDataset`, `ForceDataset`, `MoleculeNetDataset`, `CrystalDataset` and `GraphTUDataset` further have functions required for the specific dataset type to convert and process files such as '.txt', '.sdf', '.xyz' etc. \r\nMost subclasses implement `prepare_data()` and `read_in_memory()` with dataset dependent arguments.\r\nAn example for `MoleculeNetDataset` is shown below. \r\nFor more details find tutorials in [notebooks](notebooks).\r\n\r\n```python\r\nfrom kgcnn.data.moleculenet import MoleculeNetDataset\r\n# File directory and files must exist. \r\n# Here 'ExampleDir' and 'ExampleDir/data.csv' with columns \"smiles\" and \"label\".\r\ndataset = MoleculeNetDataset(dataset_name=\"Example\",\r\n                             data_directory=\"ExampleDir/\",\r\n                             file_name=\"data.csv\")\r\ndataset.prepare_data(overwrite=True, smiles_column_name=\"smiles\", add_hydrogen=True,\r\n                     make_conformers=True, optimize_conformer=True, num_workers=None)\r\ndataset.read_in_memory(label_column_name=\"label\", add_hydrogen=False, \r\n                       has_conformers=True)\r\n```\r\n\r\nIn [data.datasets](kgcnn/data/datasets) there are graph learning benchmark datasets as subclasses which are being *downloaded* from e.g. popular graph archives like [TUDatasets](https://chrsmrrs.github.io/datasets/), [MatBench](https://matbench.materialsproject.org/) or [MoleculeNet](https://moleculenet.org/). \r\nThe subclasses `GraphTUDataset2020`, `MatBenchDataset2020` and `MoleculeNetDataset2018` download and read the available datasets by name.\r\nThere are also specific dataset subclasses for each dataset to handle additional processing or downloading from individual sources:\r\n\r\n```python\r\nfrom kgcnn.data.datasets.MUTAGDataset import MUTAGDataset\r\ndataset = MUTAGDataset()  # inherits from GraphTUDataset2020\r\n```\r\n\r\nDownloaded datasets are stored in `~/.kgcnn/datasets` on your computer. Please remove them manually, if no longer required.\r\n\r\n\u003ca name=\"training\"\u003e\u003c/a\u003e\r\n# Training\r\n\r\nA set of example training can be found in [training](training). Training scripts are configurable with a hyperparameter config file and command line arguments regarding model and dataset.\r\n\r\nYou can find a [table](training/results/README.md) of common benchmark datasets in [results](training/results).\r\n\r\n# Issues\r\n\r\nSome known issues to be aware of, if using and making new models or layers with `kgcnn`.\r\n* Jagged or nested Tensors loading into models for PyTorch backend is not working.\r\n* BatchNormalization layer dos not support padding yet.\r\n* Keras AUC metric does not seem to work for torch cuda.\r\n\r\n\u003ca name=\"citing\"\u003e\u003c/a\u003e\r\n# Citing\r\n\r\nIf you want to cite this repo, please refer to our [paper](https://doi.org/10.1016/j.simpa.2021.100095):\r\n\r\n```\r\n@article{REISER2021100095,\r\ntitle = {Graph neural networks in TensorFlow-Keras with RaggedTensor representation (kgcnn)},\r\njournal = {Software Impacts},\r\npages = {100095},\r\nyear = {2021},\r\nissn = {2665-9638},\r\ndoi = {https://doi.org/10.1016/j.simpa.2021.100095},\r\nurl = {https://www.sciencedirect.com/science/article/pii/S266596382100035X},\r\nauthor = {Patrick Reiser and Andre Eberhard and Pascal Friederich}\r\n}\r\n```\r\n\r\n\u003ca name=\"references\"\u003e\u003c/a\u003e\r\n# References\r\n\r\n- https://www.tensorflow.org/api_docs/python/tf/RaggedTensor\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimat-lab%2Fgcnn_keras","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faimat-lab%2Fgcnn_keras","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimat-lab%2Fgcnn_keras/lists"}