onehaitao / distant-supervised-relation-extraction

Implementation of Neural Relation Extraction with Selective Attention over Instances.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

distant-supervised-relation-extraction

PWC PWC

Implementation of Neural Relation Extraction with Selective Attention over Instances.

Environment Requirements

  • python 3.6
  • pytorch 1.3.0
  • gensim 3.8.0
  • matplotloib 3.1.2
  • sklearn 0.21.3

Data

Usage

  1. Download the NYT10 and decompress it in the current directory.
  2. Preprocess the original data, and the processed data is stored in processed folder.
python preprocess.py
  1. You can use the following the commands to start the program.
python run.py --encoder='cnn' --selector='one'
python run.py --encoder='cnn' --selector='att'
python run.py --encoder='cnn' --selector='avg'
python run.py --encoder='pcnn' --selector='one'
python run.py --encoder='pcnn' --selector='att'
python run.py --encoder='pcnn' --selector='avg'

More details can be seen by python run.py -h.

  1. You can use run the draw.py to visualize the results.
python draw.py

Result

The results of my version are present as follows: pr_cnn pr_pcnn

The training log can be seen in train.log.

Note:

  • Some settings may be different from those mentioned in the paper.
  • No validation set used during training.
  • Some errors exists in my code, but on the whole it is right.
  • If you have any suggestions, please Issue.

Reference Link

About

Implementation of Neural Relation Extraction with Selective Attention over Instances.

License:MIT License


Languages

Language:Python 99.1%Language:Shell 0.9%