Skip to content

Commit 957efd4

Browse files
authored
Create README.md
1 parent 03540d1 commit 957efd4

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

classification/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
Code used for sentence classification tasks. We evaluate CNN, LSTM and SRU on 6 benchmarks
3+
4+
## How to run
5+
- Download the datasets from [harvardnlp/sent-conv-torch/data](https://github.com/harvardnlp/sent-conv-torch/tree/master/data)
6+
7+
- Download pre-trained word embeddings such as [word2vec](https://code.google.com/p/word2vec/); make it into text format
8+
9+
- Make sure CUDA library path and `cuda_functional.py` is available to python. For example,
10+
```python
11+
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
12+
export PYTHONPATH=../../sru/
13+
```
14+
15+
- Run **train_classifier.py** and get the results.
16+
```
17+
python train_classifier.py --help # see all running options
18+
19+
python train_classifier.py --dataset mr # which dataset (mr, subj, cr, sst, trec, mpqa)
20+
--path data_directory # path to the data directory
21+
--embedding google_word2vec.txt # path to pre-trained embeddings
22+
--cv 0 # 10-fold cross-validation, use split 0 as the test set
23+
```
24+
25+
<br>
26+
27+
### Credits
28+
29+
Part of the code (such as text preprocessing) is taken from https://github.com/harvardnlp/sent-conv-torch
30+
31+
CNN model is the implementation of [(Kim, 2014)](http://arxiv.org/abs/1408.5882), following
32+
- torch / lua version: https://github.com/yoonkim/CNN_sentence
33+
- pytorch version: https://github.com/Shawn1993/cnn-text-classification-pytorch
34+
35+
36+

0 commit comments

Comments
 (0)