Giter Site home page Giter Site logo

zainabzf / deep-text-classification-pytorch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dreamgonfly/deep-text-classification-pytorch

0.0 2.0 0.0 32 KB

Deep neural network text classification papers in PyTorch

Python 99.89% Shell 0.11%

deep-text-classification-pytorch's Introduction

Deep Text Classification in PyTorch

PyTorch implementation of deep text classification models including:

Requirements

Usage

To begin, you will need to download datasets as follows:

$ python download_dataset.py all

You can also download a specific dataset by specifying its name instead of all. Available datasets are MR, SST-1, SST-2, ag_news, sogou_news, dbpedia, yelp_review_full, yelp_review_polarity, yahoo_answers, amazon_review_full, and amazon_review_polarity

To download word vectors, run the following:

$ python download_wordvector.py word2vec
$ python download_wordvector.py glove

WordCNN

To train WordCNN with rand mode:

$ python main.py --dataset MR WordCNN --mode rand --vector_size 128 --epochs 300

To train WordCNN with multichannel mode:

$ python main.py --dataset MR WordCNN --mode multichannel --wordvec_mode word2vec --epochs 300

Available modes are rand, static, non-static, and multichannel

CharCNN

To train CharCNN with small mode:

$ python main.py --dataset MR CharCNN --mode small --epochs 300

To train CharCNN with large mode:

$ python main.py --dataset MR CharCNN --mode large --epochs 300

VDCNN

To train VDCNN with depth = 29:

$ python main.py --dataset MR VDCNN --depth 29

QRNN

To train QRNN with four layers:

$ python main.py --dataset MR QRNN --wordvec_mode glove --num_layers 4 --epochs 300

TF-IDF (benchmark)

You can train a multinomial logistic regression with TF-IDF features as a benchmark.

$ python tf-idf.py --dataset MR

Help

Refer to python main.py --help and python main.py {WordCNN, CharCNN, VDCNN, QRNN} --help for full description of how to use.

Experiments

Results are reported as follows: Test accuracy reproduced here (Test accuracy reported by the paper)

To find the settings for experiments, refer to experiments.sh.

MR SST_1 SST_2 ag_news sogu_news db_pedia yelp_review_full yelp_review_polarity yahoo_answer amazon_review_full amazon_review_polarity
WordCNN (rand) 69.4 (76.1) (45.0) (82.7) 88.3 92.5
WordCNN (static) (81.0) (45.5) (86.8)
WordCNN (non-static) (81.5) (48.0) (87.2)
WordCNN (multichannel) (81.1) (47.4) (88.1)
CharCNN (small)
CharCNN (large)
VDCNN (29-layers)
QRNN (k=2) (91.4)
QRNN (k=4) (91.1)

References

deep-text-classification-pytorch's People

Contributors

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