GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - yezhang-xiaofan/Rationale-CNN: This repository implements the model from paper: Rationale-Augmented Convolutional Neural Networks for Text Classification

BranchesTags
Open more actions menu

Latest commit

 

History

32 Commits
32 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
movies
movies
 
 
README.md
README.md
 
 
conv_net_classes.py
conv_net_classes.py
 
 
process_data_doc.py
process_data_doc.py
 
 
rationale_CNN.py
rationale_CNN.py
 
 
util.py
util.py
 
 

Repository files navigation

Rationale-CNN

This repository implements the model from paper: Rationale-Augmented Convolutional Neural Networks for Text Classification.

Much of the code is modified from: https://github.com/yoonkim/CNN_sentence

Preprocessing Data

You need to download Pre-trained word2vec file, and then run

python process_data_doc.py path_to_word2vec

where path_to_word2ec is the location of the pre-trained word2vec file. This program will generate the training and test data both as 3D tensor, with size (number of documents) * (number of sentences in one document) * (number of words in one sentence + 1). The '+1' part is used to put the sentence label for rationales. If you want to train your own dataset, you should modify the process_data.doc.py, since each dataset might mark the rationale with different format. But the generated data tensor should be in the same format.

Train the rationale-CNN model

Run the following, and the program will perform 9-fold cross validation (CV) on movie review dataset. Originally, the dataset has 10 folds, but there is one fold without rationale labeled, so we exclude that fold.

THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python rationale_CNN.py -nonstatic -word2vec

This program should generate a mean accuracy around 90.11%~91%, as reported in the paper. However, note that the optimal value of dropout rate on sentences when training document-level CNN might be different on different folds, and it is worth further tuning if you want to get a even better result. It can also generate predicted rationales with their probabilities for some correctly classified documents.

About

This repository implements the model from paper: Rationale-Augmented Convolutional Neural Networks for Text Classification

Resources

Readme
Activity

Stars

12 stars

Watchers

1 watching

Forks

8 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.