Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

Author: Rujun Han

Date: Nov 22nd, 2019

Title: Codebase for EMNLP 2019 Paper: Joint Event and Temporal Relation Extraction with Shared Representations and Structured Prediction

  1. Data processinng. We have preprocessed TB-Dense and MATRES raw data using internal NLP tools at the Information Sciences Institute. These .pickle files are saved in data fold. Download glove.6B.50d.txt into other/ folder.
  2. Featurize data. Run featurize_data.py and context_aggregator.py sequentially. Two folders are created: all_joint/ and all_context/. all_context contains the final files used in the model.
  3. Local Model: run joint_model.py
  4. Global Model: save a pipeline_joint model object from step 3 and then run joint_model_global.py.

Code Structure (joint_model.py)

Main() --> [NNClassifier].train_epoch()

[NNClassifier].train_epoch() --> [NNClassifier]._train()

-------------------------------> [NNClassifier].predict()

  1. Singletask Model. Set args.relation_weights = 0 to train event module; then set args.entity_weights = 0 to train a relation module; use both saved modules to train a pipeline end-to-end model.

python code/joint_model.py --relation_weights 0 --relation_weights 1.0 --data_type "tbd" --batch 4 --model "singletask/pipeline" --epoch 10

python code/joint_model.py --relation_weights 1.0 --entity_weights 0 --data_type "tbd" --batch 4 --model "singletask/pipeline" --epoch 10

  1. Multitask Model. Set args.pipe_epoch = 1000, args.eval_gold = True to train with gold relations only; set args.eval_gold = False to train with candidate relations generated by event module.

python code/joint_model.py --relation_weights 1.0 --entity_weights 1.0 --data_type "tbd" --batch 4 --model "multitask/pipeline" --eval_gold True --pipe_epoch 1000 --epoch 10

python code/joint_model.py --relation_weights 1.0 --entity_weights 1.0 --data_type "tbd" --batch 4 --model "multitask/pipeline" --eval_gold False --pipe_epoch 1000 --epoch 10

  1. Pipeline Joint Model. Set args.pipe_epoch < args.epochs and set args.eval_gold = False to train with candidate relations generated by event module. Our paper used the output model in this step as local model.

python code/joint_model.py --relation_weights 1.0 --entity_weights 1.0 --data_type "tbd" --batch 4 --model "multitask/pipeline" --eval_gold False --pipe_epoch 5 --epoch 10

  1. Global model. Install Gurobi package and run joint_model_global.py

python code/joint_model_global.py --relation_weights 1.0 --entity_weights 1.0 --data_type "tbd" --batch 4 --model "multitask/pipeline" --momentum 0.1 --decay 0.1 --entity_weight 0.1 --lr 0.0005 --ent_thresh 0.49 --epoch 5

About

Codebase for EMNLP 2019 Paper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages