Skip to content

vikasreddy11/Sentiment-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 

Repository files navigation

Sentiment Analysis with Bidirectional LSTM ,RNN and GRU

Binary text classification on IMDB movie reviews — positive or negative.

Results

Model AVG Test Accuracy
BiLSTM ~87%
RNN ~68%
GRU ~89%

Model Architecture

Input Text
↓
Tokenization 
↓
Embedding Layer 
↓
Model
↓
Concatenate
↓
Dropout (0.4)
↓
Linear Layer
↓
Sigmoid → probability (>0.5 = Positive)

Concepts Covered

  • Word Embeddings
  • Padding & Packing sequences
  • Vanishing Gradients
  • LSTM Gates (forget, input, output)
  • Bidirectional LSTM
  • Gradient Clipping
  • GRU
  • RNN

Setup

pip install torch datasets
python sentiment_LSTM.py
pip install torch datasets
python sentiment_Model.py

Sample Output

  • Epoch 1/10
  • Train loss: 0.66|Train Acc: 0.59
  • Test loss: 0.77| Test acc: 0.51

LSTM

  • one scene is good but the movie is worst NEG (confidence: 0.01)
  • this was an absolutely brilliant masterpiece POS (confidence: 0.97)
  • terrible boring waste of my time NEG (confidence: 0.01)

RNN

  • one scene is good but the movie is worst Positive (confidence: 0.92)
  • this was an absolutely brilliant masterpiece Negative (confidence: 0.27)
  • terrible boring waste of my time Negative (confidence: 0.01)

GRU

  • one scene is good but the movie is worst Negative (confidence: 0.00)
  • this was an absolutely brilliant masterpiece Positive (confidence: 1.00)
  • terrible boring waste of my time Negative (confidence: 0.00)

Author

Vikas Reddy

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages