{"id":13535474,"url":"https://github.com/tkipf/relational-gcn","last_synced_at":"2025-10-05T19:13:26.290Z","repository":{"id":43961266,"uuid":"122223422","full_name":"tkipf/relational-gcn","owner":"tkipf","description":"Keras-based implementation of Relational Graph Convolutional Networks","archived":false,"fork":false,"pushed_at":"2019-07-02T23:04:40.000Z","size":50,"stargazers_count":813,"open_issues_count":19,"forks_count":134,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-05-24T19:04:43.832Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/tkipf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-20T16:23:31.000Z","updated_at":"2025-05-04T14:59:36.000Z","dependencies_parsed_at":"2022-09-15T20:12:06.012Z","dependency_job_id":null,"html_url":"https://github.com/tkipf/relational-gcn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tkipf/relational-gcn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkipf%2Frelational-gcn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkipf%2Frelational-gcn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkipf%2Frelational-gcn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkipf%2Frelational-gcn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkipf","download_url":"https://codeload.github.com/tkipf/relational-gcn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkipf%2Frelational-gcn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278504620,"owners_count":25997978,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-08-01T08:00:56.991Z","updated_at":"2025-10-05T19:13:26.245Z","avatar_url":"https://github.com/tkipf.png","language":"Python","funding_links":[],"categories":["Knowledge Graph:","图卷积网络","Knowledge Graph Embedding"],"sub_categories":["网络服务_其他"],"readme":"# Graph Convolutional Networks for relational graphs\n\nKeras-based implementation of Relational Graph Convolutional Networks for semi-supervised node classification on (directed) relational graphs.\n\nFor reproduction of the *entity classification* results in our paper [Modeling Relational Data with Graph Convolutional Networks](https://arxiv.org/abs/1703.06103) (2017) [1], see instructions below.\n\nThe code for the *link prediction* task in [1] can be found in the following repository: https://github.com/MichSchli/RelationPrediction\n\n## Installation\n\n```python setup.py install```\n\n## Dependencies\n\nImportant: keras 2.0 or higher is not supported as it breaks the Theano sparse matrix API. Tested with keras 1.2.1 and Theano 0.9.0, other versions might work as well.\n\n  * Theano (0.9.0)\n  * keras (1.2.1)\n  * pandas\n  * rdflib\n  \nNote: It is possible to use the TensorFlow backend of keras as well. Note that keras 1.2.1 uses the TensorFlow 0.11 API. Using TensorFlow as a backend will limit the maximum allowed size of a sparse matrix and therefore some of the experiments might throw an error.\n\n## Usage\n\nImportant: Switch keras backend to Theano and disable GPU execution (GPU memory is too limited for some of the experiments). GPU speedup for sparse operations is not that essential, so running this model on CPU will still be quite fast.\n\nTo replicate the experiments from our paper [1], first run (for AIFB):\n\n```\npython prepare_dataset.py -d aifb\n```\n\n\nAfterwards, train the model with:\n\n```\npython train.py -d aifb --bases 0 --hidden 16 --l2norm 0. --testing\n```\n\n\nNote that Theano performs an expensive compilation step the first time a computational graph is executed. This can take several minutes to complete.\n\nFor the MUTAG dataset, run:\n\n```\npython prepare_dataset.py -d mutag\npython train.py -d mutag --bases 30 --hidden 16 --l2norm 5e-4 --testing\n```\n\nFor BGS, run:\n\n```\npython prepare_dataset.py -d bgs\npython train.py -d bgs --bases 40 --hidden 16 --l2norm 5e-4 --testing\n```\n\nFor AM, run:\n\n```\npython prepare_dataset.py -d am\npython train.py -d am --bases 40 --hidden 10 --l2norm 5e-4 --testing\n```\n\nNote: Results depend on random seed and will vary between re-runs.\n\n## Setting keras backend to Theano\n\nCreate a file `~/.keras/keras.json` with the contents:\n\n```\n{\n    \"image_dim_ordering\": \"tf\",\n    \"epsilon\": 1e-07,\n    \"floatx\": \"float32\",\n    \"backend\": \"theano\"\n}\n```\n\n## Enforcing CPU execution\n\n\nYou can enforce execution on CPU by hiding all GPU resources:\n```\nCUDA_VISIBLE_DEVICES= python train.py -d aifb --bases 0 --hidden 16 --l2norm 0. --testing\n```\n\n\n## References\n\n[1] M. Schlichtkrull, T. N. Kipf, P. Bloem, R. van den Berg, I. Titov, M. Welling, [Modeling Relational Data with Graph Convolutional Networks](https://arxiv.org/abs/1703.06103), 2017\n\n\n## Cite \n\nPlease cite our paper if you use this code in your own work:\n\n```\n@article{schlichtkrull2017modeling,\n  title={Modeling Relational Data with Graph Convolutional Networks},\n  author={Schlichtkrull, Michael and Kipf, Thomas N and Bloem, Peter and Berg, Rianne van den and Titov, Ivan and Welling, Max},\n  journal={arXiv preprint arXiv:1703.06103},\n  year={2017}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkipf%2Frelational-gcn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkipf%2Frelational-gcn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkipf%2Frelational-gcn/lists"}