GithubHelp home page GithubHelp logo

coldmist / pykeen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ddomingof/keen

1.0 2.0 0.0 10.51 MB

A Python library for learning and evaluating knowledge graph embeddings

License: MIT License

Jupyter Notebook 56.40% Python 43.60%

pykeen's Introduction

PyKEEN Build Status Coverage Status on CodeCov Documentation Status Zenodo DOI

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.

Share Your Experimental Artifacts

You can share you trained KGE models along the other experimental artifacts through the KEEN Model Zoo.

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

To install pykeen, Python 3.6+ is required, and we recommend to install it on Linux or Mac OS systems. Please run 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.

Installing Extras with Pip

PyKEEN uses pip's extras functionality to allow some non-essential features to be skipped. They can be installed with the following:

  1. pip install pykeen[ndex] enables support for loading networks from NDEx. They can be added to the training file paths by prefixing files with ndex:

Contributing

Contributions, whether filing an issue, making a pull request, or forking, are appreciated. See CONTRIBUTING.rst for more information on getting involved.

Tutorials

Code examples can be found in the notebooks directory.

Further tutorials are available in our documentation.

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 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 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

pykeen's People

Contributors

mali-git avatar cthoyt avatar ddomingof avatar lvermue avatar nudin avatar gezimsejdiu avatar labrax avatar annabreit avatar

Stargazers

Mirza Mohtashim Alam avatar

Watchers

James Cloos avatar Mirza Mohtashim Alam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.