The Github Repo consists of the following folders:
baselines
: containing all the baselinesRTransE
,IR
,SELECT
models
: containing code for the encoder-decoder baselinetriples2seq.py
andour-model
:tripletext2seq.py
kbembeddings
: code forked and adapted from https://github.com/thunlp/KB2Eevaluator
: code for calculating BLEU, METEOR, ROUGE forked and adapted from https://github.com/tylin/coco-captiondata
: containing data for training and testing as well asdata.py
python modules that is responsible for creating training/test sets in zeroshot or normal setups.
** Prep Repo **
From the repository base folder run the script that downloads extra files and setup the repository
. prepare_repo.sh
The file run.py takes some arguments described in the begining of the file and responsible for running training the our-models or the encoder-decoder baseline.
Experiment params:
epochs
: number of epochs to trainsetup
: either zeroshot or normal train/test/valid splits using the regular splits from SimpleQuestionscriteria
: the zeroshot criteriapred
for unseen pred,subtype
orobjtype
min
: minimum number of samples for each predicate to keepdatapath
: path of the folder with the preprocessed fileskfolds
: number of kfoldsfold
: 0-9 which cross validation split
picking model params:
pred
: add textual context for predicates (flag with no values)subtype
: add textual context for subject types (flag with no values)objtype
: add textual context for object types (flag with no values)
Examples:
How to run zeroshot experiments for unseen-predicates :
Encoder-Decoder
: No textual contexts or copy actions:
python run.py -epochs 10 -min 50 -setup zeroshot -criteria pred -datapath ./data/nocopy -fold 1
Our-Model
the model with textual contexts but no copy actions:
python run.py -epochs 10 -min 50 -setup zeroshot -criteria pred -fold 1 -datapath ./data/nocopy/ -subtype -objtype -pred
Our-Model+Copy
full model with textual contexts and copy actions:
python run.py -epochs 10 -min 50 -setup zeroshot -criteria pred -fold 1 datapath ./data/copy/ -subtype -objtype -pred
The file ./data/pred_textual_contexts.csv
contains textual contexts collected for the freebase relations.