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.

Metadata

Release files for KGATE 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for KGATE 0.4.1
File Size Uploaded
kgate-0.4.1.tar.gz 88.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for KGATE 0.4.1
File Interpreter ABI Platform
kgate-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 190.6 kB

Release files / kgate-0.4.1.tar.gz

Download URL kgate-0.4.1.tar.gz
Size 88.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ff1fddf8d86990b4554df52480b4ec7f71ae8174d55d5705b2ff78522a2a9851
BLAKE2b-256 checksum
How to use checksums
e8c9d082424ed74c52199a3a8dd34f2683126464d8bfffc46c1305bb3c837239
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.6 Linux/7.1.5-arch1-2

Release files / kgate-0.4.1-py3-none-any.whl

Download URL kgate-0.4.1-py3-none-any.whl
Size 102.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb78f98d1b336be58cf9d4f39fa18d07e300bceaa447aeb17c2e82a9d92d2da8
BLAKE2b-256 checksum
How to use checksums
bc04484bd33f058fda82f5fb379be26e329515038e3801ad67680fd7e97c9740
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.6 Linux/7.1.5-arch1-2

Release history Release notifications | RSS feed

1.0.0

2 release files

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.19

2 release files

0.2.18

2 release files

0.2.17

2 release files

0.2.16

2 release files

0.2.14

2 release files

0.2.13

2 release files

0.2.12

2 release files

0.2.11

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page