Home

Awesome

Explainable Link Prediction for Emerging Entities in Knowledge Graphs

Acknowledgement

This repository is adopted from the source code of the paper Multi-Hop Knowledge Graph Reasoning with Reward Shaping. Lin et al., 2018 We thank the authors, especially, Xi Victoria Lin for helping us to understand their source code.

Requirements

python 3.6+ <br> pytorch 1.4.0 <br> tqdm 4.9.0

All experiments are run on NVIDIA Titan RTX GPUs with 24GB memory.

Data Processing

Run the following command to preprocess the datasets.

./experiment.sh configs/<dataset>.sh --process_data <gpu-ID>

<dataset> is the name of the dataset in the ./data directory. In our experiments, the three datasets used are: fb15k-237, wn18rr and nell-995. <gpu-ID> is a non-negative integer number representing the GPU index.

Model Training

For reward shaping, we used ConvE model.

  1. Train the ConvE model on the training split of the data
./experiment-emb.sh configs/<dataset>-conve.sh --train <gpu-ID>
  1. Train RL models (policy gradient + reward shaping)
./experiment-rs.sh configs/<dataset>-rs.sh --train <gpu-ID>
  1. To train an ablated version of the model (only policy gradient)
./experiment.sh configs/<dataset>.sh --train <gpu-ID>

Evaluation

To generate the evaluation results of a trained model, simply change the --train flag in the commands above to --inference.

For example, the following command performs inference with the RL models (policy gradient + reward shaping) and prints the evaluation results (on both dev and test sets).

./experiment-rs.sh configs/<dataset>-rs.sh --inference <gpu-ID>

To print the inference paths generated by beam search during inference, use the --save_beam_search_paths flag:

./experiment-rs.sh configs/<dataset>-rs.sh --inference <gpu-ID> --save_beam_search_paths

Change the hyperparameters

To change the hyperparameters and other experiment set up, start from the configuration files.

Citation

@inproceedings{BhowmikDeMelo2020ExplainableKGReasoning,
  author    = {Bhowmik, Rajarshi and de Melo, Gerard},
  title     = {Explainable Link Prediction for Emerging Entities in Knowledge Graphs},
  booktitle = {Proceedings of ISWC 2020},
  year      = {2020},
  eventdate = {2020-11-02/06},
}