Skip to content

Experiments in the field of Sentiment Analysis using ML Algorithms namely Logistic Regression, Naive Bayes along with tfidf, one hot encoding, bag of words vectorization. Different MLP and RNN models viz. LSTM, GRU, Bidirectional LSTM. Lastly, state of the art BERT model

Notifications You must be signed in to change notification settings

rid17pawar/Sentiment-Analysis-Model-Experiments

Repository files navigation

Sentiment-Analysis-Model-Experiments

Dataset Used:

Twitter US Airline Sentiment - Kaggle

Experiments:

Experiment-1. Using Machine Learning Algorithms and Vectorization Techniques For Sentiment Analysis

Text-Vectorization Techniques used:

  • CountVectorizer
  • TfidfVectorizer
  • OneHotEncoding

ML Algorithms used:

  • Logistic Regression
  • Naive Bayes

Result:

image BEST MODEL: TFIDFvectorizer_LogisticRegression

Experiment-2. Multi-Layer Perceptron (MLP) Models with different Model Architectures and Optimizers For Sentiment Analysis

Model Architectures:

  • Model-1
    Layer (type) - Output Shape
    layer_1 (Dense) - (None, 64)
    layer_2 (Dense) - (None, 64)
    layer_3 (Dense) - (None, 3)

  • Model-2
    Layer (type) - Output Shape
    layer_1 (Dense) - (None, 32)
    layer_2 (Dense) - (None, 3)

  • Model-3
    Layer (type) - Output Shape
    layer_1 (Dense) - (None, 10)
    layer_2 (Dense) - (None, 3)

Optimizers:

  • adam
  • rmsprop
  • sgd

Result:

image

Experiment-3. Recurrent Neural Network (RNN) Models For Sentiment Analysis

Model Architectures:

  • Simple RNN Model
    Layer (type) - Output Shape
    embedding_12 (Embedding) (None, 22, 100)
    layer_1 (SimpleRNN) (None, 128)
    layer_2 (Dense) (None, 10)
    output_layer (Dense) (None, 3)

  • LSTM Model
    Layer (type) - Output Shape
    embedding_12 (Embedding) (None, 22, 100)
    layer_1 (LSTM) (None, 128)
    output_layer (Dense) (None, 3)

  • GRU Model
    Layer (type) - Output Shape
    embedding_12 (Embedding) (None, 22, 100)
    layer_1 (GRU) (None, 128)
    output_layer (Dense) (None, 3)

  • Bidirectional LSTM Model
    Layer (type) - Output Shape
    embedding_12 (Embedding) (None, 22, 100)
    bidirectional_6 (Bidirectional) (None, 128)
    output_layer (Dense) (None, 3)


Result:

image

Experiment-3. Pretrained and Finetuned BERT Model For Sentiment Analysis

Result:

image
Overall Best Model: BERT

About

Experiments in the field of Sentiment Analysis using ML Algorithms namely Logistic Regression, Naive Bayes along with tfidf, one hot encoding, bag of words vectorization. Different MLP and RNN models viz. LSTM, GRU, Bidirectional LSTM. Lastly, state of the art BERT model

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published