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.
The library is tested and guaranteed to work on both linux and mac.
- Linux (CPU and GPU) and MacOS (CPU only)
- Python >= 3.5
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
You acn install the requirements using the installation script as follows:
sh install.sh
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
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
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.
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