Files
Achyudh Ram cc275f6bde Add CharacterCNN for Document Classification (#155)
* Add ReutersTrainer, ReutersEvaluator options in Factory classes

* Add Reuters to Kim-CNN command line arguments

* Fix SST dataset path according to changes in Kim-CNN args

The dataset path in args.py was made to point at the dataset folder rather than dataset/SST folder. Hence SST folder was added to paths in the SST dataset class

* Add Reuters dataset class, and support in __main__

* Add Reuters dataset trainers and evaluators

* Remove debug print statement in reuters_evaluator

* Fix rounding bug in reuters_trainer and reuters_evaluator

* Add LSTM for baseline text classification measurements

* Add eval metrics for lstm_baseline

* Set batch_first param in lstm_baseline

* Remove onnx args from lstm_baseline

* Pack padded sequences in LSTM_baseline

* Add TensorBoardX support for Reuters trainer

* Add Arxiv Academic Paper Dataset (AAPD)

* Add Hidden Bottleneck Layer to BiLSTM

* Fix packing of padded tensors in Reuters

* Add cmdline args for Hidden Bottleneck Layer for BiLSTM

* Include pre-padding lengths in AAPD dataset

* Remove duplication of preprocessing code in AAPD

* Remove batch_size condition in ReutersTrainer

* Add ignore_lengths option to ReutersTrainer and ReutersEvaluator

* Add AAPDCharQuantized and ReutersCharQuantized

* Rename Reuters_hierarchical to ReutersHierarchical

* Add CharacterCNN for document classification

* Update README.md for CharacterCNN

* Fix table in README.md for CharacterCNN

* Add AAPDHierarchical for HAN

* Update HAN for changes in Reuters dataset endpoints

* Fix bug in CharCNN when running on CPU
2018-10-28 19:01:54 -04:00

54 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## Character-level Convolutional Network
Implementation of Char-CNN from Character-level Convolutional Networks for Text Classification (http://papers.nips.cc/paper/5782-character-level-convolutional-networks-for-text-classification.pdf)
## Quick Start
To run the model on Reuters dataset, just run the following from the Castor working directory:
```
python -m char_cnn --dataset Reuters --gpu 1 --batch_size 128 --lr 0.001
```
To test the model, you can use the following command.
```
python -m char_cnn --trained_model kim_cnn/saves/Reuters/best_model.pt
```
## Dataset
We experiment the model on the following datasets.
- Reuters Newswire (RCV-1)
- Arxiv Academic Paper Dataset (AAPD)
## Settings
Adam is used for training.
## Dataset Results
### RCV-1
```
python -m char_cnn --dataset Reuters --gpu 1 --batch_size 128 --lr 0.001
```
  | Accuracy | Avg. Precision | Avg. Recall | Avg. F1
-- | -- | -- | -- | --
Char-CNN (Dev) | 0.585 | 0.702 | 0.569 | 0.628
Char-CNN (Test) | 0.589 | 0.691 | 0.552 | 0.614
### AAPD
```
python -m char_cnn --dataset AAPD --gpu 1 --batch_size 128 --lr 0.001
```
  | Accuracy | Avg. Precision | Avg. Recall | Avg. F1
-- | -- | -- | -- | --
Char-CNN (Dev) | 0.305 | 0.681 | 0.537 | 0.600
Char-CNN (Test) | 0.294 | 0.681 | 0.526 | 0.593
## TODO
- Support ONNX export. Currently throws a ONNX export failed (Couldn't export Python operator forward_flattened_wrapper) exception.
- Parameters tuning