Skip to main content

Knowledge Graph Autoencoder Training Environment (KGATE)

KGATE is a knowledge graph embedding library bridging the encoders from Pytorch Geometric and the decoders from TorchKGE.

This tool relies heavily on the performances of TorchKGE and its numerous implemented modules for link prediction, negative sampling and model evaluation. The main goal here is to address the lack of encoders in the original library, who is unfortunately not maintained anymore.

Installation

It is recommended to download the configuration template alongside your installation (see Usage below).

With pip

pip install kgate

From source

Clone this repository and install it in a virtual environment like so:

git clone git@github.com:BAUDOTlab/KGATE.git
python -m venv kge_env
source kge_env/bin/activate

Join the development

KGATE is developed using Poetry. If you want to contribute to KGATE or make your own modifications, follow these steps:

1. Install Poetry

pip install poetry

2. Clone the repository

git clone git@github.com:BAUDOTlab/KGATE.git

3. Install dependencies

cd KGATE
poetry install

(usage)=

Usage

KGATE is meant to be a self-sufficient training environment for knowledge graph embedding that requires very little code to work but can easily be expanded or modified. Everything stems from the Architect class, which holds all the necessary attributes and methods to fully train and test a KGE model following the autoencoder architecture, as well as run inference.

The configuration file lets you iterate quickly without changing your code. See the template to learn what the different options do.

At the very least, KGATE expects the Knowledge Graph to be given as a pandas dataframe or a CSV file with the columns "from", "to" and "rel", corresponding respectively to the head nodes, tail nodes and relation typesof the triplets, with one triplet per row. Any extra columns are ignored. In addition, a metadata dataframe can be submitted (can also be a CSV) to map each node with their type, requiring the columns "id" and "type". Extra columns are likewise ignored.

from kgate import Architect

config_path = "/path/to/your/config.toml"

architect = Architect(config_path = config_path)

# Train the model using KG and hyperparameters specified in the configuration
architect.train_model()

# Test the trained model, using the best checkpoint
architect.test()

# Run KG completion task, the empty list is the element that will be predicted
known_heads = []
known_relations = []
known_tails = []
architect.infer(known_heads, known_relations, known_tails)

For a more detailed example and specific methods that are available in the package, see the upcoming readthedocs documentation.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kgate-0.4.0.tar.gz (79.0 kB view details)

Uploaded Source

Built Distribution

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

kgate-0.4.0-py3-none-any.whl (90.4 kB view details)

Uploaded Python 3

File details

Details for the file kgate-0.4.0.tar.gz.

File metadata

  • Download URL: kgate-0.4.0.tar.gz
  • Upload date:
  • Size: 79.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.6 Linux/7.1.5-arch1-2

File hashes

Hashes for kgate-0.4.0.tar.gz
Algorithm Hash digest
SHA256 19e808a2640484d18878d2eadee138da512660f1a67a44a5fc3be660c6c362b2
MD5 5eb982c3dbdcc5ecdb1926284b816190
BLAKE2b-256 555ed401c7c23a7f4552efa4aec3c1b72d078dc2f205b0ba02160a42d3813bfe

See more details on using hashes here.

File details

Details for the file kgate-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: kgate-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 90.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.6 Linux/7.1.5-arch1-2

File hashes

Hashes for kgate-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf96b780e6fd37906797b9952fed1d1bf0159b40ec7ee99407e53492e703dfb1
MD5 e82488393251b540196294d195065b2f
BLAKE2b-256 4d172c535d18cd93ce8e79dae73b729fc12d43104c2bdb0672b9fb8b2b7c90aa

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.20

2 files

0.2.19

2 files

0.2.18

2 files

0.2.17

2 files

0.2.16

2 files

0.2.15

2 files

0.2.14

2 files

0.2.13

2 files

0.2.12

2 files

0.2.11

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.19

2 files

0.1.18

2 files

0.1.17

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page