https://github.com/cahya-wirawan/cnn-text-classification-tf
Convolutional Neural Network for Text Classification in Tensorflow
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (6.4%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
Convolutional Neural Network for Text Classification in Tensorflow
Basic Info
- Host: GitHub
- Owner: cahya-wirawan
- License: apache-2.0
- Language: Python
- Default Branch: master
- Size: 652 KB
Statistics
- Stars: 139
- Watchers: 11
- Forks: 54
- Open Issues: 0
- Releases: 0
Fork of dennybritz/cnn-text-classification-tf
Created over 9 years ago
· Last pushed almost 9 years ago
https://github.com/cahya-wirawan/cnn-text-classification-tf/blob/master/
**[This code belongs to the "Implementing a CNN for Text Classification in Tensorflow" blog post.](http://www.wildml.com/2015/12/implementing-a-cnn-for-text-classification-in-tensorflow/)**
It is slightly simplified implementation of Kim's [Convolutional Neural Networks for Sentence Classification](http://arxiv.org/abs/1408.5882) paper in Tensorflow.
## Requirements
- Python 3
- Tensorflow > 0.12
- Numpy
## Training
Print parameters:
```bash
./train.py --help
```
```
optional arguments:
-h, --help show this help message and exit
--embedding_dim EMBEDDING_DIM
Dimensionality of character embedding (default: 128)
--enable_word_embeddings
Enable/disable the word embeddings (default: True)
--filter_sizes FILTER_SIZES
Comma-separated filter sizes (default: '3,4,5')
--num_filters NUM_FILTERS
Number of filters per filter size (default: 128)
--l2_reg_lambda L2_REG_LAMBDA
L2 regularizaion lambda (default: 0.0)
--dropout_keep_prob DROPOUT_KEEP_PROB
Dropout keep probability (default: 0.5)
--batch_size BATCH_SIZE
Batch Size (default: 64)
--num_epochs NUM_EPOCHS
Number of training epochs (default: 100)
--evaluate_every EVALUATE_EVERY
Evaluate model on dev set after this many steps
(default: 100)
--checkpoint_every CHECKPOINT_EVERY
Save model after this many steps (default: 100)
--allow_soft_placement ALLOW_SOFT_PLACEMENT
Allow device soft device placement
--noallow_soft_placement
--log_device_placement LOG_DEVICE_PLACEMENT
Log placement of ops on devices
--nolog_device_placement
```
Train:
```bash
./train.py
```
## Evaluating
```bash
./eval.py --eval_train --checkpoint_dir="./runs/1459637919/checkpoints/"
```
Replace the checkpoint dir with the output from the training. To use your own data, change the `eval.py` script to load your data.
## References
- [Convolutional Neural Networks for Sentence Classification](http://arxiv.org/abs/1408.5882)
- [A Sensitivity Analysis of (and Practitioners' Guide to) Convolutional Neural Networks for Sentence Classification](http://arxiv.org/abs/1510.03820)
Owner
- Name: Cahya Wirawan
- Login: cahya-wirawan
- Kind: user
- Location: Vienna, Austria
- Website: https://www.linkedin.com/in/cahyawirawan/
- Twitter: CahyaWr
- Repositories: 171
- Profile: https://github.com/cahya-wirawan
System engineer, currently working on NLP, CV and Speech Recognition for fun and curiosity