Git Product home page Git Product logo

kbc's Introduction

Knowledge Base Completion (kbc)

This code reproduces results in Canonical Tensor Decomposition for Knowledge Base Completion (ICML 2018).

Installation

Create a conda environment with pytorch cython and scikit-learn :

conda create --name kbc_env python=3.7
source activate kbc_env
conda install --file requirements.txt -c pytorch

Then install the kbc package to this environment

python setup.py install

Datasets

To download the datasets, go to the kbc/scripts folder and run:

chmod +x download_data.sh
./download_data.sh

Once the datasets are download, add them to the package data folder by running :

python kbc/process_datasets.py

This will create the files required to compute the filtered metrics.

Update notes

In moving from cpp to pytorch, a hidden regularization weight constant was removed. This changes the settings required to reproduce the results in the paper. As a rule of thumb, and before I re-run a grid-search to find optimal parameters, multiplying the regularization strength in the table below by a factor of two should give reasonable results.

The "reciprocal" parameter was also lost in a temporary effort to simplify the code.

Reproducing results (only valid before pytorch update)

To reproduce results, use learning.learn as follows

python kbc/learn.py --dataset FB15K --model ComplEx --rank 2000 --optimizer Adagrad --learning_rate 1e-2 --batch_size 100 --regularizer N3 --reg 5e-3 --reciprocals 1 --max_epochs 10 --valid 1

To reproduce results in this setting, use the following hyper-parameters (model ComplEx, optimizer Adagrad, regularizer N3, reciprocals 1):

Dataset rank lr reg batch_size Time
WN18 2000 1e-1 1e-1 100 150s/epoch
WN18RR 2000 1e-1 1e-1 100 93s/epoch
FB15K 2000 1e-2 5e-3 100 225s/epoch
FB15K-237 2000 1e-1 1e-1 100 115s/epoch
YAGO3-10 1000 1e-1 1e-2 1500 485s/epoch

License

kbc is CC-BY-NC licensed, as found in the LICENSE file.

kbc's People

Contributors

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