Skip to content

Implementing multi models for Text Classification in TensorFlow.

Notifications You must be signed in to change notification settings

SunnyMarkLiu/tensorflow_text_classification

Repository files navigation

text classification in tensorflow

Implementing multi models for Text Classification in TensorFlow.

Contents

Data and Preprocess

Data

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.

Preprocess

  1. Load positive and negative sentences from the raw data files.
  2. Clean the text data.
  3. Pad each sentence to the maximum sentence length.
  4. Word vector mapping, Each sentence becomes a bag of word vectors.

Models

1. FastText

2. TextCNN

3. BiLSTM

4. TextRCNN

Learn more contextual information than conventional window-based neural networks.

5. Hierarchical Attention Networks

6. Seq2seq with Attention

Performance

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

References

License

This project is licensed under the terms of the MIT license.

About

Implementing multi models for Text Classification in TensorFlow.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages