/UKGEbert

Uncertain Knowledge Graphs Embedding with BERT Pretrained Language Model

Primary LanguagePython

UKGE based on BERT

Uncertain Knowledge Graphs Embedding is implemented by means of BERT pretrained natural language model. Exploring approximate inference on the embedding space. Considering the commonsense reasoning based on these works.

Environment require

Uncertain Knowledge Graphs datasets for benchmark

In data directory, train.tsv is the training data, test.tsv the testing data and val.tsv the validation data.

dataset entities relations facts average of confidence standard deviation ratio of facts/relations
CN15k 15,000 36 234,675 0.627 0.234 15.6
PPI5k 4,999 7 271,666 0.415 0.213 54.3

Comparison

The unit of all values on MSE and MAE is 10$^{-2}$. "-" means the corresponding data did not report in literatures.

dataset CN15k PPI5k
metricsMSEMAEepochsMSEMAEepochs
URGE10.3222.72-1.446.00-
UKGE$_{rect}$8.6119.90>1000.953.79>100
UKGE$_{logi}$9.8620.74>1000.964.07>100
UKG$_s$E7.7121.34190.985.9880
UKGE$_{bert}$6.6119.320.855.3875

Run

python.exe ./prediction.py
Using Theano backend.
Model: "bert_fine_tuning_UKGE"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
lstm_1 (LSTM)                (None, 768)               4721664   
_________________________________________________________________
dense_1 (Dense)              (None, 1)                 769       
=================================================================
Total params: 4,722,433
Trainable params: 4,722,433
Non-trainable params: 0
_________________________________________________________________
...

Prediction for (HEAD, ?relation?, TAIL) RANKING:
Head = ' car '
Tail = ' people '
  
      relation candidate 1 = ('hasa', 0.8294004)
      relation candidate 2 = ('usedfor', 0.760266) *
      relation candidate 3 = ('createdby', 0.65154946)
      relation candidate 4 = ('definedas', 0.63723207)
      relation candidate 5 = ('atlocation', 0.6002464)

Under working

The project is under working. We are very sorry for any trouble to you. You are welcome to put forward your valuable opinions by comments.