samehkamaleldin / libkge

A library for knowledge graph embedding models

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Requirements Status Build Status codecov

LibKGE is a library for knowledge graph embedding models using tensorflow. The knowledge graph embedding models implemented in the library are compatible with scikit-learn apis.

Installation

The library is tested and guaranteed to work on both linux and mac.

System requirements

  • Linux (CPU and GPU) and MacOS (CPU only)
  • Python >= 3.5

Python environments

We strongly recommend that you use a conda virtual environment for working with the library. You can initialise a new conda enviroment for the library as follows:

conda create --name libkge python=3.5
source activate libkge

Requirements installation

You acn install the requirements using the installation script as follows:

sh install.sh

Tensorflow installation

The libkge library supports tensorflow 1.x versions. We recommend that you install tensorflow=1.13.1 for cpu usage and tensorflow-gpu=1.13.1 for GPU support. You can install tensorflow by uncommenting the relevant line (cpu or gpu) or by running the following commands:

# for cpu usage
conda install tensorflow=1.13.1

for cpu usage, and for the GPU support you can use the following:

# for gpu usage
conda install tensorflow-gpu=1.13.1

Install the libkge library

You can install the library from the github repository using the following commands:

git clone https://github.com/samehkamaleldin/libkge.git
cd libkge
python setup.py install

Quick example

You can run a quick example using the model pipeline example file as follows:

# while you are in the libkge directory
cd examples
python kge_model_pipeline.py

You can edit the content of the kge_model_pipeline.py file to change the model parameters and other model and data configurations.

Contributions

Source code abbreviations

In this project we use a set of abbreviations as prefixes and suffixes in naming variables. These abbreviations are listed as follows:

- em    : embeddings
- nb    : number or count
- rnd   : random
- ent   : entity
- rel   : relation
- map   : mapping
- reg   : regularisation
- param : parameter
- lr    : learning rate
- neg   : negative
- negs  : negatives
- corr  : corruption
- corrs : corruptions
- vec   : vector
- pt    : pointwise
- pr    : pairwise
- mx    : matrix
- rs    : random state
- img   : imaginary
- src   : source
- val   : value
- wt    : weight
- dest  : destination
- var   : variable
- tf    : tensorflow

About

A library for knowledge graph embedding models

License:Apache License 2.0


Languages

Language:Python 99.2%Language:Shell 0.8%