python
tensorflow
juptyer
Easy to follow text classifying implementation using a Conv. Neural Network (Tensorflow)
- Python 3.4 >=
- Tensorflow >= 0.8
- Jupyter Notebook or IPython Notebook [Deprecated]
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:
./train.py
Training the network on the Customer Product Review data is
./train.py --dataset_option="products"
You first have to train the network so see above.
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.
python evaluate.py --checkpoint_dir="runs/*some numbers*/checkpoints/"
or for product review dataset_option
python evaluate.py --checkpoint_dir="runs_product/*some numbers*/checkpoints/"
You first have to train the network so see above.
To test out individual sentences on the network, open experiment.ipynb
and follow instruction within the notebook.
python experiment.py --checkpoint_dir="runs/*some numbers*/checkpoints/" --sent="This is the sentence you want to test."
Yoon Kim, Hu and Liu - KDD-2004, Denny Britz
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,