Skip to main content

A package for training and evaluating knowledge graph embeddings

Project description

PyKEEN (Python KnowlEdge EmbeddiNgs) is a package for training and evaluating knowledge graph embeddings. Currently, it provides implementations of 10 knowledge graph emebddings models, and can be run in training mode in which users provide their own set of hyper-parameter values, or in hyper-parameter optimization mode to find suitable hyper-parameter values from set of user defined values. PyKEEN can also be run without having experience in programing by using its interactive command line interface that can be started with the command pykeen from a terminal.

Installation Current version on PyPI Supported Python Versions: 3.6 and 3.7 MIT License

pykeen can be installed on any system running Python 3.6+ with the following command:

pip install pykeen

Alternatively, it can be installed from the source for development with:

$ git clone https://github.com/SmartDataAnalytics/PyKEEN.git pykeen
$ cd pykeen
$ pip install -e .

However, GPU acceleration is limited to Linux systems with the appropriate graphics cards as described in the PyTorch documentation.

Usage

Code examples can be found in the notebooks directory.

CLI Usage - Set Up Your Experiment within 60 seconds

To start the PyKEEN CLI, run the following command:

pykeen

then the command line interface will assist you to configure your experiments.

To start PyKEEN with an existing configuration file, run:

pykeen -c /path/to/config.json

then the command line interface won’t be called, instead the pipeline will be started immediately.

Starting the Prediction Pipeline

To make prediction based on a trained model, run:

pykeen-predict -m /path/to/model/directory -d /path/to/data/directory

where the value for the argument -m is the directory containing the model, in more detail following files must be contained in the directory:

  • configuration.json

  • entities_to_embeddings.json

  • relations_to_embeddings.json

  • trained_model.pkl

These files are created automatically created after model is trained (and evaluated) and exported in your specified output directory.

The value for the argument -d is the directory containing the data for which inference should be applied, and it needs to contain following files:

  • entities.tsv

  • relations.tsv

where entities.tsv contains all entities of interest, and relations.tsv all relations. Both files should contain should contain a single column containing all the entities/relations. Based on these files, PyKEEN will create all triple permutations, and computes the predictions for them, and saves them in data directory in predictions.tsv. Note: the model- and the data-directory can be the same directory as long as all required files are provided.

Optionally, a set of triples can be provided that should be exluded from the prediction, e.g. all the triples contained in the training set:

pykeen-predict -m /path/to/model/directory -d /path/to/data/directory -t /path/to/triples.tsv

Hence, it is easily possible to compute plausibility scores for all triples that are not contained in the training set.

Summarize the Results of All Experiments

To summarize the results of all experiments, please provide the path to parent directory containing all the experiments as sub-directories, and the path to the output file:

pykeen-summarize -d /path/to/experiments/directory -o /path/to/output/file.csv

Project details


Download files

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

Source Distribution

pykeen-0.0.20.tar.gz (287.3 kB view details)

Uploaded Source

Built Distribution

pykeen-0.0.20-py36-none-any.whl (77.2 kB view details)

Uploaded Python 3.6

File details

Details for the file pykeen-0.0.20.tar.gz.

File metadata

  • Download URL: pykeen-0.0.20.tar.gz
  • Upload date:
  • Size: 287.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for pykeen-0.0.20.tar.gz
Algorithm Hash digest
SHA256 7db0f9cc6f4136d82abfe4dc026ced89662aac1909f5ef57317938afc8648ee6
MD5 10c52706cb317c39cb20124eec15b121
BLAKE2b-256 a53b85dab277a776f1c2cb0e79c817ebb485f0a8a162a0361b61a34c4572dd79

See more details on using hashes here.

Provenance

File details

Details for the file pykeen-0.0.20-py36-none-any.whl.

File metadata

  • Download URL: pykeen-0.0.20-py36-none-any.whl
  • Upload date:
  • Size: 77.2 kB
  • Tags: Python 3.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for pykeen-0.0.20-py36-none-any.whl
Algorithm Hash digest
SHA256 3d13cc401a96e7656ee0dd92cf7313b5723b8f6bd3c41be4cf6911facaaf2cf1
MD5 91b65c059327991f33d5d9cdab20ddde
BLAKE2b-256 393a60b2bae32961e97c2ba0cbb8b9a1e2c62604ed2bcaf33e21916ad655564a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page