KR-EAR

July 18, 2016 ยท View on GitHub

Code of IJCAI2016: "Knowledge Representation Learning with Entities, Attributes and Relations".

Evaluation Results

Evaluation results on entity prediction.

ModelMeanRank(Raw)MeanRank(Filter)Hit@10(Raw)Hit@10(Filter)
TransE25920035.853.0
TransH28222433.950.2
TransR26020037.056.1
KR-EAR(TransE)18613338.554.5
KR-EAR(TransR)17211839.557.3

Evaluation results on relation prediction.

ModelMeanRank(Raw)MeanRank(Filter)Hit@10(Raw)Hit@10(Filter)
TransE3.12.865.983.8
TransH3.43.164.984.1
TransR3.43.165.284.5
KR-EAR(TransE)2.42.167.986.2
+ CRA1.81.670.988.7
KR-EAR(TransR)2.62.266.889.0
+ CRA1.91.671.590.4

Evaluation results on attribute prediction.

ModelMeanRank(Raw)MeanRank(Filter)Hit@10(Raw)Hit@10(Filter)
TransE10.75.636.555.9
TransH10.75.638.557.9
TransR9.03.942.765.6
KR-EAR(TransE)8.33.247.269.0
+AC7.53.049.470.4
KR-EAR(TransR)8.33.247.669.8

DATA

We provide FB24k dataset used for the task knowledge base completion in data.zip, using the input format required by our codes.

Datasets are required in the folder data/ in the following format, containing nights files:

  • train-rel.txt: training file of relations, format (e1, e2, rel).

  • test-rel.txt: test file of relations, same format as train-rel.txt.

  • train-attr.txt: training file of attributes, format (e1, val, attar).

  • test-attr.txt: test file of attributes, same format as train-attr.txt.

  • entity2id.txt: all entities and corresponding ids, one per line.

  • relation2id.txt: all relations and corresponding ids, one per line.

  • attribute2id.txt: all attributes and corresponding ids, one per line.

  • val2id.txt: : all values and corresponding ids, one per line.

  • attribute_val.txt: the value set of each attribute

Code

The codes are in the folder KR-EAR(TransE)/, KR-EAR(TransR)/.

COMPILE

Just type make in the folder ./

RUN

You need to type the following command in each model folder:

For training:

./main

For testing:

./test

./test_attr

You can also change the parameters when training.

-n : the embedding size of entities, relations

-m : the embedding size of values

-margin: the margin length

CITE

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

Yankai Lin, Zhiyuan Liu, Maosong Sun. Knowledge Representation Learning with Entities, Attributes and Relations. International Joint Conference on Artificial Intelligence (IJCAI 2016).