Skip to content

DanSeb1295/multi-relation-QA-over-KG

Repository files navigation

Multi-Relation-QA-over-KG

This is an implementation of the stepwise-reasoning network described in this paper.

Run all commands from the directory containing this README file. Code is ran with python 3.5 or above.

Installing Libraries

Use pip as a package manager to install the required libraries.

If you only wish to see the model results:

pip install matplotlib

If you wish to train the model:

pip install -r requirements.txt

Visualizing the model results

python plot.py

Training and Validation results are displayed in separate plots.

Training the model

Download the dataset

A pre-trained embedding is used to embed the entities and relations used in our knowledge graph. Due to the size of the datasets, these are not submitted, but they are required to run the model.

To download the dataset, follow the steps below.

  1. Follow this link
  2. Download the Freebase dataset. (Submit the license agreement as required)
  3. Unzip the file.
  4. Save the Freebase folder into the datasets subfolder i.e. (/datasets/Freebase/)

Train the model

python experiment.py

A stepwise reasoning network and an ablated version of the network without the perceptron layer is trained using the PathQuestion dataset.

Results will be stored in the subfolder /saved_models/ in csv format.

About

Implementing the attention mechanism proposed in the paper: Stepwise Reasoning for Multi-Relation Question Answering over Knowledge Graph with Weak Supervision

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages