Giter Club home page Giter Club logo

ea-wgcn's Introduction

EA-WGCN

A Weighted GCN with Logical Adjacency Matrix for Relation Extraction (ECAI 2020)

PyTorch implementation of Deep Learning approach for relation extraction task(SemEval 2010 Task 8 and TACRED) via a Weighted Graph Convolutional Neural Networks with Entity-Attention (EA-WGCN).

This paper proposes a novel weighted graph convolutional network by constructing a logical adjacency matrix which effectively solves the feature fusion of multi-hop relation without additional layers and parameters for relation extraction task. Experimental results show that our model can take better advantage of the structural information in the dependency tree and produce better results than previous models.

You can find the paper here.

Model Architecture

EA-WGCN model

Requirements

  • Python 3 (tested on 3.7.3)
  • PyTorch (tested on 1.1.0)
  • tqdm, pickle

Usage

Preparation

We evaluate the performance of our model on TACRED and SemEval 2010 Task 8 datasets. This code needs to use the TACRED dataset(LDC license required). If you get the TACRED dataset, please put the JSON files under the directory dataset/tacred. In this repository, we provide only sample data from TACRED dataset. If you want to change the data set, you can go here to get the SemEval 2010 Task 8 datasets. But you need to do your own data preprocessing.

First, since the pre-training GLoVe vectors is applied, you need to download from the Stanford NLP group website and unzip it to the directory dataset/glove.

Then prepare vocabulary and initial word vectors with:

python3 prepare_vocab.py dataset/tacred dataset/vocab dataset/glove

The vocabulary and word vectors can be saved under this directory dataset/vocab.

Training

To train a EA-WGCN model, run:

python3 train.py

Model checkpoints and logs will be saved to ./saved_models. For details on the use of other parameters, please refer to train.py.

Evaluation

To run evaluation on the test set, run:

python3 evaluate.py --model_dir saved_models/best_model

This will use the best_model.pt file to evaluate the model by default.

Ensemble

To run an ensemble model, run:

python3 ensemble.py

You need to specify the parameter model_file_list in the ensemble.py as shown in the following example:

model_file_list = ['saved_models/01',
                   'saved_models/02',
                   'saved_models/03',
                   'saved_models/04',
                   'saved_models/05']                 

Store the trained model files under the all saved_models/XX.

Citation

@inproceedings{zhou2020eawgcn,
 author = {Zhou, Li and Wang, Tingyu and Qu, Hong and Huang, Li and Liu, Yuguo},
 booktitle = {European Conference on Artificial Intelligence},
 title = {A Weighted GCN with Logical Adjacency Matrix for Relation Extraction},
 url = {http://ebooks.iospress.nl/volumearticle/55155},
 year = {2020}
}

ea-wgcn's People

Contributors

lizhou21 avatar

Stargazers

 avatar  avatar Wanlong Liu avatar  avatar Yang FanChiang avatar  avatar  avatar Losredith avatar Sophie avatar  avatar Ravindra Gadde avatar Xeno Chou avatar Loser家里蹲 avatar  avatar

Watchers

 avatar

Forkers

jeffgan99

ea-wgcn's Issues

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.