Giter Club home page Giter Club logo

10708-project's Introduction

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.

10708-project's People

Contributors

liangeric avatar kapikantzari avatar abbeyyyy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.