Skip to content

kapikantzari/10708-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

10708 Project: Improving Semantic Relation Prediction using Global Graph Properties

Group Members: Yun Cheng, Yuxin Pei, Eric Liang

The implementation of this code is based off of the M3GM model created by Yuval Pinter. The original paper can be found here. In addition the code along with details of the original model and how to run the original model can be found here.

In order to reproduce our results and run our experiments we provide a summary below. Please also note that because of the time and computing power it takes to run this code it is reccomended to use some sort of computing service to run this code. Also not for convenience of use we have included pre-trained models that can be downloaded here (the pre-trained model files could not be included in our github repository due to the size of the model).

How to train and predict the model

We based our model's structure off of the original M3GM model, so for easy use for new users we kept many of the command line argument flags. For in depth details of each command flag, please see the "Association Model" and "Max-Margin Markov Graph Models" sections here. We provide a brief summary on how to get our modified model running below.

In order to train the association model an example of the prompt to run the code is seen below. Note that the code to train the association model is under pretrain_assoc.py, however please defer to below sections to see how to run modified experiments as described in our report.

python pretrain_assoc.py --input data/wn18rr.pkl --embeddings data/ft-embs-all-lower.vec --model-out models/pret_transE --nll --assoc-mode transE --neg-samp 10 --early-stopping --eval-dev

In order to train the max-margin markov graph model and do prediction an example of the prompt to run the code is seen below. Note that the code to train and do prediction of the model is under predict_wn18.py, but in order to run modified experiments for sampling, etc. as described in our report see below sections.

python predict_wn18.py --input data/wn18rr.pkl --emb-size 300 --model models/pret_transE-ep-14 --model-only-init --assoc-mode transE --eval-dev --no-assoc-bp --epochs 3 --neg-samp 10 --regularize 0.01 --rand-all --skip-symmetrics --model-out models/from_pret_trE-3eps --rerank-out from_pret_trE-3eps.txt

How to run experiments with new association models

For experiments with new association models (for example, lineaRE), specify the --assoc-mode flag as lineaRE. The flag are for SE and QuatDE are sE and quatDE respectively.

How to run sampling experiments

In order to run the sampling experiments, the changes are housed in training.py. To run the three expriments with negative sampling, importance sampling, and hierarchical softmax, please refer to the instructions in lines 23-27 of training.py, in summary new users just need to modify the "samplingType" variable to be either negative, importance, or hierarchical in order to easily swap between the experiments. Further implementation details and comments can be seen in this file.

How to run motif experiments

For experiments with extra motifs, specify the --extra_motifs flag as True.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published