Skip to content

Monireh2/kg-deductive-reasoner

Repository files navigation

End-To-End Memory Networks for Deductive Reasoning over Knowledge Graph

This is a modification of implementation of MemN2N model in Python for the Deductive Reasoning over Knowledge Graph as inspired by the Section 4 of the paper "End-To-End Memory Networks". It is based on Facebook's Matlab code.

[Web-based Demo](Coming soon!)

Requirements

  • Python 2.7
  • Numpy, Flask (only for web-based demo) can be installed via pip:
$ sudo pip install -r requirements.txt

$ mkdir data
=======

$ tar xvf sample_data_normalized.tar.xz -C data


$ tar xvf sample_json_files.tar.xz -C data
python json_reader_normalizer.py

Usage

  • To run on a knowledge graph reasoning task, use kg_reasoner_runner.py. For example,
python kg_reasoner_runner.py

The output will look like:

Using data from data/task_name/task_name
Train and test for task task_name ...
1 | train error: 0.876116 | val error: 0.75
|===================================               | 71% 0.5s

Knowledge Graph Reasoning Demo

  • In order to run the Web-based demo using the pretrained model task_name.pklz in trained_model/, run:
python -m demo.qa_kg
  • Alternatively, you can try the console-based demo:
python -m demo.qa_kg -console
  • The pretrained model task_name.pklz can be created by running:
python -m demo.qa_kg -train
  • To show all options, run python -m demo.qa_kg -h

Author

  • Monireh Ebrahimi

References

About

knowledge graph deductive reasoning using memory networks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages