Giter Site home page Giter Site logo

pcnnwwla's Introduction

PCNN with word-level attention

Requirements

  • numpy

  • tensorflow

  • keras

Usage

Input file

Default input: input.txt

Input file can contain multiple line. Each line must be follow this pattern

relation e1start e1end e2start e2end word-1 word-2 ... word-n
  • relation is integer. List of relations provided at origin_data/relations.txt

  • e1start, e1end, e2start, e2end are starting index and ending index of two entities in the sentence

  • From word-1 to word-n are the preprocessed sentence (tokenized, lowercase)

Example one line of input file:

0 0 0 4 4 lệ_quyên sinh ra tại hà_nội , trong gia_đình có 4 anh_chị_em , cô là con út

Train

Run initial.py one time to preprocess data. Preprocessed data will be placed in data folder

python initial.py

Run train.py to train model. You can edit model's parameters in settings.py. Train output and log will be placed in output/train/** folder. ** is the timestamp, you can train model many time to get best weights.

python train.py

Train output and log

Stored in output/train/**:

  • result.json: macro-averaged f1-score, max f1-score, best fold, best weights

  • fold_* folder: contain weights and all metrics of one fold

Test

Run test.py

python test.py example_test_input/weights.h5 example_test_input/input.txt
  • example_test_input/weights.h5: path to weights of model

  • example_test_input/input.txt: path to input file

Test output files

Stored in output/test/**:

  • Predictions for input file: output.txt

  • Error sentences: error_list.txt, error_predictions.txt

pcnnwwla's People

Contributors

nvn01234 avatar

Stargazers

 avatar  avatar

Watchers

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