KGATE


NameKGATE JSON
Version 0.2.18 PyPI version JSON
download
home_pagehttps://github.com/BAUDOTlab/KGATE
SummaryKnowledge Graph Autoencoder Training Environment, bridging PyG encoders and TorchKGE decoders.
upload_time2025-07-29 13:48:20
maintainerNone
docs_urlNone
authorBenjamin Loire
requires_python>=3.10
licenseMIT
keywords knowledge graph knowledge graph embedding autoencoder machine learning link prediction
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Knowledge Graph Autoencoder Training Environment (KGATE)

KGATE is a knowledge graph embedding library bridging the encoders from [Pytorch Geometric](https://github.com/pyg-team/pytorch_geometric) and the decoders from [TorchKGE](https://github.com/torchkge-team/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](src/kgate/config_template.toml) alongside your installation (see [Usage](#usage) below).

### With pip

```bash
pip install kgate
```

### From source

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

```bash
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](https://python-poetry.org/). If you want to contribute to KGATE or make your own modifications, follow these steps:

#### 1. Install Poetry

```bash
pip install poetry
```

#### 2. Clone the repository

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

#### 3. Install dependencies

```bash
cd KGATE
poetry install
```

## 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](src/kgate/config_template.toml) 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. 

```python
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](#license) file for details.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/BAUDOTlab/KGATE",
    "name": "KGATE",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "Knowledge Graph, Knowledge Graph Embedding, Autoencoder, Machine Learning, Link Prediction",
    "author": "Benjamin Loire",
    "author_email": "benjamin.loire@univ-amu.fr",
    "download_url": "https://files.pythonhosted.org/packages/18/18/3a7e024bde66e9566e4acfd6cffb0eef20198288a9326be449d1c8d08405/kgate-0.2.18.tar.gz",
    "platform": null,
    "description": "# Knowledge Graph Autoencoder Training Environment (KGATE)\n\nKGATE is a knowledge graph embedding library bridging the encoders from [Pytorch Geometric](https://github.com/pyg-team/pytorch_geometric) and the decoders from [TorchKGE](https://github.com/torchkge-team/torchkge).\n\nThis 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.\n\n## Installation\n\nIt is recommended to download the [configuration template](src/kgate/config_template.toml) alongside your installation (see [Usage](#usage) below).\n\n### With pip\n\n```bash\npip install kgate\n```\n\n### From source\n\nClone this repository and install it in a virtual environment like so:\n\n```bash\ngit clone git@github.com:BAUDOTlab/KGATE.git\npython -m venv kge_env\nsource kge_env/bin/activate\n```\n\n### Join the development\n\nKGATE is developed using [Poetry](https://python-poetry.org/). If you want to contribute to KGATE or make your own modifications, follow these steps:\n\n#### 1. Install Poetry\n\n```bash\npip install poetry\n```\n\n#### 2. Clone the repository\n\n```bash\ngit clone git@github.com:BAUDOTlab/KGATE.git\n```\n\n#### 3. Install dependencies\n\n```bash\ncd KGATE\npoetry install\n```\n\n## Usage\n\nKGATE 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.\n\nThe configuration file lets you iterate quickly without changing your code. See the [template](src/kgate/config_template.toml) to learn what the different options do.\n\nAt 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. \n\n```python\nfrom kgate import Architect\n\nconfig_path = \"/path/to/your/config.toml\"\n\narchitect = Architect(config_path = config_path)\n\n# Train the model using KG and hyperparameters specified in the configuration\narchitect.train_model()\n\n# Test the trained model, using the best checkpoint\narchitect.test()\n\n# Run KG completion task, the empty list is the element that will be predicted\nknown_heads = []\nknown_relations = []\nknown_tails = []\narchitect.infer(known_heads, known_relations, known_tails)\n```\n\nFor a more detailed example and specific methods that are available in the package, see the upcoming readthedocs documentation.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](#license) file for details.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Knowledge Graph Autoencoder Training Environment, bridging PyG encoders and TorchKGE decoders.",
    "version": "0.2.18",
    "project_urls": {
        "Homepage": "https://github.com/BAUDOTlab/KGATE",
        "Repository": "https://github.com/BAUDOTlab/KGATE",
        "issues": "https://github.com/BAUDOTlab/KGATE/issues"
    },
    "split_keywords": [
        "knowledge graph",
        " knowledge graph embedding",
        " autoencoder",
        " machine learning",
        " link prediction"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bab5402404277aec40416d3c58c25c050f01cbf23bd1cba18341b14cb197ef1b",
                "md5": "0fdcb0b07c066b87e092f3d5ca20d4a6",
                "sha256": "df13af7b8b71e57759b65fd8c696aa383b0ed7cce90aa63d683268dfa69a0abe"
            },
            "downloads": -1,
            "filename": "kgate-0.2.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0fdcb0b07c066b87e092f3d5ca20d4a6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 56667,
            "upload_time": "2025-07-29T13:48:18",
            "upload_time_iso_8601": "2025-07-29T13:48:18.957100Z",
            "url": "https://files.pythonhosted.org/packages/ba/b5/402404277aec40416d3c58c25c050f01cbf23bd1cba18341b14cb197ef1b/kgate-0.2.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "18183a7e024bde66e9566e4acfd6cffb0eef20198288a9326be449d1c8d08405",
                "md5": "aaa3920fe45a698c6f71bf93ee1cf357",
                "sha256": "b23ac8fd9ed6e8543eca00378e791ead0f7d73a5d12316fb679269e4d1c7cb86"
            },
            "downloads": -1,
            "filename": "kgate-0.2.18.tar.gz",
            "has_sig": false,
            "md5_digest": "aaa3920fe45a698c6f71bf93ee1cf357",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 49444,
            "upload_time": "2025-07-29T13:48:20",
            "upload_time_iso_8601": "2025-07-29T13:48:20.547956Z",
            "url": "https://files.pythonhosted.org/packages/18/18/3a7e024bde66e9566e4acfd6cffb0eef20198288a9326be449d1c8d08405/kgate-0.2.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-29 13:48:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BAUDOTlab",
    "github_project": "KGATE",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "kgate"
}
        
Elapsed time: 0.72128s