Multi-class Text Classification
Implement four neural networks in Tensorflow for multi-class text classification problem.
Models
A LSTM classifier. See rnn_classifier.py
A Bidirectional LSTM classifier. See rnn_classifier.py
A CNN classifier. See cnn_classifier.py. Reference: Implementing a CNN for Text Classification in Tensorflow.
A C-LSTM classifier. See clstm_classifier.py. Reference: A C-LSTM Neural Network for Text Classification.
Requirements
Python 3.x
Tensorflow > 1.5
Sklearn > 0.19.0
Data Format
Training data should be stored in csv file. The first line of the file should be ["label", "content"] or ["content", "label"].
Train
Run train.py to train the models. Parameters:
You could run train.py to start training. For example:
After the training is done, you can use tensorboard to see the visualizations of the graph, losses and evaluation metrics:
Test
Run test.py to evaluate the trained model Parameters:
You could run test.py to start evaluation. For example: