Implementation of Neural Relation Extraction with Selective Attention over Instances.
- python 3.6
- pytorch 1.3.0
- gensim 3.8.0
- matplotloib 3.1.2
- sklearn 0.21.3
- Download the
NYT10
and decompress it in the current directory. - Preprocess the original data, and the processed data is stored in
processed
folder.
python preprocess.py
- 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
.
- You can use run the
draw.py
to visualize the results.
python draw.py
The results of my version are present as follows:
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.