Giter Club home page Giter Club logo

movie-review-sentiment-analysis's Introduction

Movie-Review-Sentiment-Analysis

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

Dataset

IMDB sentiment analysis data set, which has 100,000 multi-paragraph movie reviews, both positive and negative. The dataset has 50,000 rows (i.e., reviews) and 3 columns. Column 1 "new_id" is the ID for each review (same as the row number), Column 2 "sentiment" is the binary response, and Column 3 is the review.

Target

Evaluation metric is AUC on the test data.

Ideal Scenario

Google's Word2Vec is a deep-learning inspired method that focuses on the meaning of words. Word2Vec attempts to understand meaning and semantic relationships among words.

Main File

Save my main file as mymain.ipynb

Data Preprocessing

Select s to determine which train and test split (S = 1 or 2 or 3). Then I left join split data and generate different training and test dataset. Last, I store all the preprocessing in train_list and test_list

Vocabulary list and text processing

First, I create the function review_to_words to remove any non-letters and stopwords in review. Then I import Tokenizer from keras and set the max_feature to 5000. Before I split the data into different training and test dataset, I use whole dataset to fit Tokenizer. You can find the most 5000 frequent vocabularies in myVocab.txt file.

alt text

Model Prediction

Use Logistic regression, random forest and LSTM model to make the prediction. It turns out LSTM can reach the best performance. Fit LSTM model and do the text processing. LSTM model is units of a recurrent neural network (RNN). The parameter turning is refered to the reference from Kaggle’s kernel. Use the tokenizer we trained before, we can convert the text in review to sequence. Then use pad_sequence to transforms a list of sequence into a 2D numpy array. The activation function I use is sigmoid and I use Adam optimizer.

Result

According to evaluation matrix, the best performance I reached is 0.94489. I’ve saved all the result in result.txt file. Then, I draw AUC graph based on predicted result.

AUC (train and test split 1)

alt text

AUC (train and test split 2)

alt text

AUC (train and test split 3)

alt text

movie-review-sentiment-analysis's People

Contributors

hyestt avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.