• Stars
    star
    308
  • Rank 134,950 (Top 3 %)
  • Language
    Python
  • Created over 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎭 Sentiment Analysis of Twitter data using combined CNN and LSTM Neural Network models

CS291K

Sentiment Analysis of Twitter data using a combined CNN-LSTM Neural Network model

Motivation

This project seeks to extend the work we did previously on sentiment analysis using simple Feed-Foward Neural Networks (Found here: paper & repo). Instead, we wish to experiment with building a combined CNN-LSTM Neural Net model using Tensorflow to perform sentiment analysis on Twitter data.

Dependencies

sudo -H pip install -r requirements.txt

Run the Code

  • On train.py change the variable MODEL_TO_RUN = {0 or 1}
    • 0 = CNN-LSTM
    • 1 = LSTM-CNN
  • Feel free to change other variables (batch_size, filter_size, etc...)
  • Run python train.py (or, with proper permissions, ./train.py

Code Structure

  • lstm_cnn.py : Contains the LSTM_CNN Model class to be instantiated.
  • cnn_lstm.py : Contains the CNN_LSTM Model class to be instantiated.
  • train.py : Main runner for the code. It instantiates a model, trains it and validates it.
  • batchgen.py : Contains a couple of functions needed to pre-process and tokenize the dataset.