Giter Site home page Giter Site logo

ryfan-rs / intra-bag-and-inter-bag-attentions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhixiuye/intra-bag-and-inter-bag-attentions

0.0 1.0 0.0 82.44 MB

Code for NAACL 2019 paper: Distant Supervision Relation Extraction with Intra-Bag and Inter-Bag Attentions

Python 79.25% C++ 20.47% Shell 0.28%

intra-bag-and-inter-bag-attentions's Introduction

Intra-Bag and Inter-Bag Attentions

Dependencies

The code is written in Python 3.6 and pytorch 0.3.0.

Evaluation Results

precision/recall curves

Precion/recall curves of CNN+ATT_BL, CNN+ATT_BL+BAG_ATT, CNN+ATT_RA, CNN+ATT RA+BAG ATT

Precion/recall curves of PCNN+ATT_BL, PCNN+ATT_BL+BAG_ATT, PCNN+ATT_RA, PCNN+ATT_RA+BAG_ATT

AUC Results

Model no BAG_ATT BAG_ATT
CNN+ATT_BL 0.376 0.388
CNN+ATT_RA 0.398 0.407
PCNN+ATT_BL 0.388 0.403
PCNN+ATT_RA 0.403 0.422

Usage

  1. upzip the file NYT_data/NYT_data.zip

  2. make data folder in the following structure

Intra-Bag-and-Inter-Bag-Attentions
|-- figure
    |-- CNNmethods.pdf
    |-- PCNNmethods.pdf
|-- model
    |-- embedding.py
    |-- model_bagatt.py
    |-- pcnn.py
|-- NYT_data
    |-- relation2id.txt
    |-- test.txt
    |-- train.txt
    |-- vec.bin
|-- preprocess
    |-- data2pkl.py
    |-- extract.cpp
    |-- pickledata.py
    |-- preprocess.sh
|-- plot.py
|-- README.md
|-- train.py
  1. preprocess NYT data
cd preprocess; bash preprocess.sh; cd ..
  1. train model
CUDA_VISIBLE_DEVICES=0 python train.py --pretrain --use_RA --sent_encoding pcnn --modelname PCNN_ATTRA
  1. plot the precision/recall curve
python plot.py --model_name PCNN_ATTRA_BAGATT

intra-bag-and-inter-bag-attentions's People

Contributors

zhixiuye 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.