Implementing multi models for Text Classification in TensorFlow.
Models are used to perform sentiment analysis on movie reviews from the Large Movie Review Dataset, which contains 25,000 highly polar movie reviews for training, and 25,000 for testing.
In this task, given a movie review, the model attempts to predict whether it is positive or negative. This is a binary classification task.
- Load positive and negative sentences from the raw data files.
- Clean the text data.
- Pad each sentence to the maximum sentence length.
- Word vector mapping, Each sentence becomes a bag of word vectors.
- text classification: Bag of Tricks for Efficient Text Classification, 2016.07
- Convolutional Neural Networks for Sentence Classification, 2014.08
- A Sensitivity Analysis of (and Practitioners' Guide to) Convolutional Neural Networks for Sentence Classification
Learn more contextual information than conventional window-based neural networks.
epochs = 10
batch_size = 64
max_learning_rate = 0.001
decay_rate = 0.8
decay_steps = 2000
l2_reg_lambda = 1e-3
embedding_trainable = False
Models | fastText | TextCNN | BiLSTM | TextRCNN | HierAtteNet | Seq2seqAttn | EntityNet | DynamicMemory | Transformer |
---|---|---|---|---|---|---|---|---|---|
Accuracy | 0.834304 | 0.878276 | 0.884974 | 0.840128 | 0.889314 |
- Understanding Convolutional Neural Networks for NLP
- Implementing a CNN for Text Classification in TensorFlow
- Github: cnn-text-classification-tf
- 基于 word2vec 和 CNN 的文本分类 :综述 & 实践
- 自然语言处理中CNN模型几种常见的Max Pooling操作
- LSTM Networks for Sentiment Analysis
- Bag of Tricks for Efficient Text Classification
- Chatbots with Seq2Seq
This project is licensed under the terms of the MIT license.