https://github.com/thundergolfer/text-classify-with-cnn
:school: Easy to follow text classifying implementation using a Conv. Neural Network (Tensorflow)
https://github.com/thundergolfer/text-classify-with-cnn
conv ipython-notebook machine-learning neural-network notebook tensorflow
Last synced: 4 months ago
JSON representation
:school: Easy to follow text classifying implementation using a Conv. Neural Network (Tensorflow)
- Host: GitHub
- URL: https://github.com/thundergolfer/text-classify-with-cnn
- Owner: thundergolfer
- License: mit
- Created: 2016-10-11T00:13:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-22T09:43:07.000Z (almost 9 years ago)
- Last Synced: 2024-09-28T23:23:51.705Z (over 1 year ago)
- Topics: conv, ipython-notebook, machine-learning, neural-network, notebook, tensorflow
- Language: Jupyter Notebook
- Homepage:
- Size: 752 KB
- Stars: 14
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Text Classifying With A Convolutional Neural Network
> `python` `tensorflow` `juptyer `
> [](https://codeclimate.com/github/thundergolfer/text-classify-with-cnn) [](https://codeclimate.com/github/thundergolfer/text-classify-with-cnn/coverage)
Easy to follow text classifying implementation using a Conv. Neural Network (Tensorflow)
#### What You Need
1. Python 3.4 >=
2. Tensorflow >= 0.8
3. Jupyter Notebook *or* IPython Notebook [Deprecated]
### Training The Network
Training the network with Tensorflow CPU-only (2013 i7 3770K) took about **70 mins**. *Note: If you try train in Jupyter/Ipython Notebook remove all print statements in the training loop. These print statement will lock up your browser and slow things down a lot.*
To train the network on the Movie Review dataset just run:
```bash
./train.py
```
Training the network on the Customer Product Review data is
```bash
./train.py --dataset_option="products"
```
### Evaluating The Network
You first have to train the network so [see above](#training-the-network).
To evaluate the network we need to pass in some arguments to the `evaluate.py`. Run this command, replacing `checkpoint_dir` with the last savepoint of the trained model.
```shell
python evaluate.py --checkpoint_dir="runs/*some numbers*/checkpoints/"
```
or for product review dataset_option
```shell
python evaluate.py --checkpoint_dir="runs_product/*some numbers*/checkpoints/"
```
### Playing With The Network
You first have to train the network so [see above](#training-the-network).
To test out individual sentences on the network, open `experiment.ipynb` and follow instruction within the notebook.
```shell
python experiment.py --checkpoint_dir="runs/*some numbers*/checkpoints/" --sent="This is the sentence you want to test."
```
### Credit To
[Yoon Kim](https://github.com/yoonkim/CNN_sentence), [Hu and Liu - KDD-2004](https://www.cs.uic.edu/~liub/publications/kdd04-revSummary.pdf), [Denny Britz](https://github.com/dennybritz)
### Citations
*Minqing Hu and Bing Liu*. "Mining and Summarizing Customer Reviews." Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD-2004), Aug 22-25, 2004, Seattle, Washington, USA,