Code Monkey home page Code Monkey logo

capsule4textclassification's Introduction

Capsule4TextClassification

Implementation of our paper "Information Aggregation via Dynamic Routing for Sequence Encoding"

Sytem Requirements

OS: Linux (Ubuntu 14.04+)

Python: v3.6

Tensorflow: v1.4.0

Numpy: v1.14

CUDA : v8.0

CUDNN: v6.0

Data Dowload

Refer to downloadDataset for data download instructions

Quick start

Please first refer to Data Dowload and download all the data needed, Go to root of this project Capsule4TextClassification, then type the following command to start training process on correspoding dataset.

#for sentence level datasets, more specifically for SST-1 and SST-2 datasets
python ./caps_attn_flatten/train_test.py --load-config --weight-path ./savings/sst01 
python ./caps_attn_flatten/train_test.py --load-config --weight-path ./savings/sst02

#for document level datasets, more specifically for imdb, yelp-2013 and yelp-2014
python ./caps_attn_hierarchical/train_test.py --load-config --weight-path ./savings/imdb
python ./caps_attn_hierarchical/train_test.py --load-config --weight-path ./savings/yelp2013
python ./caps_attn_hierarchical/train_test.py --load-config --weight-path ./savings/yelp2014

further explanation of the comamnd:

Note that we provide a sentence level model (caps_attn_flatten) and a document level model (caps_attn_hierarchical)

Take first command for example --load-config indicates that before construction of the computational graph we will load a config file from a directory which ever --weight-path specifies, in this case ./savings/sst01. There is a ./savings/sst01/config file that controls the configuration of the model, if you ever want to run another configuration, you should simply copy the ./savings/sst01 directory and modify the config file, and then run a command similar to those specified as above.

--weight-path specifies in which directory we want to store our config file, and most importantly the model checkpoint. Also a status file, which is originally used to avoid conflict. note that if you ever encountered "process running or finished" error, you should remove status file.

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.