PyTorch implementation of the algorithm DeepPath. Paper available here: https://arxiv.org/abs/1707.06690
The code has been adapted from the original DeepPath code in TensorFlow available here: https://github.com/xwhan/DeepPath
For dawnloading NELL-995 dataset run upload.sh script; FB15k-237 is avaliable here
-
unzip the data, put the data folder in the code directory
-
run the following scripts within
scripts/
./pathfinder.sh ${relation_name}
# find the reasoning paths, this is RL training, it might take sometime./fact_prediction_eval.py ${relation_name}
# calculate & print the fact prediction results./link_prediction_eval.sh ${relation_name}
# calculate & print the link prediction results
Examples (the relation_name can be found in
NELL-995/tasks/
):./pathfinder.sh concept_athletehomestadium
./fact_prediction_eval.py concept_athletehomestadium
./link_prediction_eval.sh concept_athletehomestadium
-
Reasoning path is arleady put in the dataset, you can directly run fact_prediction_eval.py or link_prediction_eval.sh to get the final results for each reasoning task
raw.kb
: the raw kb data from NELL systemkb_env_rl.txt
: we add inverse triples of all triples inraw.kb
, this file is used as the KG for reasoningentity2vec.bern/relation2vec.bern
: transE embeddings to represent out RL states, can be trained using TransX implementations by thunlptasks/
: each task is a particular reasoning relationtasks/${relation}/*.vec
: trained TransH Embeddingstasks/${relation}/*.vec_D
: trained TransD Embeddingstasks/${relation}/*.bern
: trained TransR Embedding trainedtasks/${relation}/*.unif
: trained TransE Embeddingstasks/${relation}/transX
: triples used to train the KB embeddingstasks/${relation}/train.pairs
: train triples in the PRA formattasks/${relation}/test.pairs
: test triples in the PRA formattasks/${relation}/path_to_use.txt
: reasoning paths found the RL agenttasks/${relation}/path_stats.txt
: path frequency of randomised BFS