Log In

Assignment - Sentiment Analysis of Movie Reviews

Open In Colab

Problem Statement: Apply the bag of words technique to train ML models for sentiment analysis using data from the "Sentiment Analysis on Movie Reviews" Kaggle competition.

Outline:

  1. Download and Explore Dataset
  2. Implement the Bag of Words Technique
  3. Train baseline model & submit to Kaggle
  4. Train & finetune different ML models
  5. Document & submit your notebook

Dataset: https://www.kaggle.com/c/sentiment-analysis-on-movie-reviews

Download and Explore the Data

Outline:

  1. Download Dataset from Kaggle
  2. Explore and visualize data

Download Dataset from Kaggle

  • Read the "Description", "Evaluation" and "Data" sections on the Kaggle competition page carefully
  • Make sure to download the kaggle.json file from your Kaggle account and upload it on Colab
 
 
 
 
 

Explore and Visualize Data

  • Load the train, test, and submission files using Pandas
  • Explore rows, columns, sample values etc.
  • Visualize distribution of target columns
 
 
 
 
 
 
 
 
 
 

Summarize your insights and learnings from the dataset below:

  • ???
  • ???
  • ???

Implement Bag of Words Model

Outline:

  1. Learn the vocabulary using CountVectorizer
  2. Transform training and test data

Learn Vocabulary using CountVectorizer

  • Create custom tokenizer with stemming
  • Create a list of stop words
  • Configure and create CountVectorizer
  • Learn vocubulary from training set
  • View sample entries from vocabulary
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Transform Training & Test Data

  • Transform phrases from training set
  • Transform phrases from test set
  • Look at some example values
 
 
 
 
 

Train Baseline Model & Submit to Kaggle

  1. Split training and validation sets
  2. Train logistic regression model
  3. Study predictions on sample phrases
  4. Make predictions and submit to Kaggle

Split Training and Validation Sets

Tip: Don't use a random sample for validation set (why?)

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Make Predictions & Submit to Kaggle

  1. Make predictions on Test Dataset
  2. Generate & submit CSV on Kaggle
  3. Add screenshot of your score
 
 
 
 
 

Train & Finetune Different ML Models

Train & finetune at least 2 other types of models

Models to try:

  • Decision Trees
  • Random Forests
  • Gradient Boosting
  • Naive Bayes
  • SVM

Optional:

  • Use PCA for dimensionality reduction
  • Compare classification vs regression models

Tips:

 
 
 
 
 
 
 
 
 
 

Best Model:

???

(include Kaggle score screenshot)

Submission and Future Work

How to make a submission:

  • Add documentation and explanations
  • Clean up any stray code/comments
  • Include a screenshot of your best score
  • Make a submission on the assignment page
  • Review evaluation criteria carefully

Future work:

  • Try more machine learning models
  • Try configuring CountVectorizer differently
  • Try approaches other than bag of words