percentcent / Fast-TransX

An Efficient implementation of TransE for Knowledge Representation Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fast-TransX

An extremely fast implementation of TransE [1], TransH [2], TransR [3] for knowledge representation learning (KRL) based on our previous pakcage KB2E ("https://github.com/thunlp/KB2E") for KRL. The overall framework is similar to KB2E, with some underlying design changes for acceleration. This implementation also supports multi-threaded training to save time.

Evaluation Results

Because the overall framework is similar, we just list the result of transE(this and previous model) in dateset FB15k.

Model MeanRank(Raw) MeanRank(Filter) Hit@10(Raw) Hit@10(Filter) time(min)
TransE (n = 50, rounds = 3000) 224 76 43.2 65.6 156
Fast-TransE (n = 50, threads = 8, rounds = 3000) 212 70 44.5 66.3 4

More results can be found in ("https://github.com/thunlp/KB2E").

Data

Datasets are required in the following format, containing three files:

triple2id.txt: training file, the first line is the number of triples for training. Then the follow lines are all in the format (e1, e2, rel).

entity2id.txt: all entities and corresponding ids, one per line. The first line is the number of entities.

relation2id.txt: all relations and corresponding ids, one per line. The first line is the number of relations.

You can download FB15K from [Download], and the more datasets can also be found in ("https://github.com/thunlp/KB2E").

Compile

g++ transX.cpp -o transX -pthread -O3 -march=native

Citation

If you use the code, please kindly cite the following paper:

Yankai Lin, Zhiyuan Liu, Maosong Sun, Yang Liu, Xuan Zhu. Learning Entity and Relation Embeddings for Knowledge Graph Completion. The 29th AAAI Conference on Artificial Intelligence (AAAI'15). [pdf]

Reference

[1] Bordes, Antoine, et al. Translating embeddings for modeling multi-relational data. Proceedings of NIPS, 2013.

[2] Zhen Wang, Jianwen Zhang, et al. Knowledge Graph Embedding by Translating on Hyperplanes. Proceedings of AAAI, 2014.

[3] Yankai Lin, Zhiyuan Liu, Maosong Sun, et al. Learning Entity and Relation Embeddings for Knowledge Graph Completion. Proceedings of AAAI, 2015.

About

An Efficient implementation of TransE for Knowledge Representation Learning


Languages

Language:C++ 100.0%