Git Product home page Git Product logo

sentiment-analysis's Introduction

Sentiment-Analysis

Sentiment analysis comparisons between Naive Bayes, Perceptron, and BERT.

This project performs sentiment analysis by classifying an entire movie review as positive or negative. We used the imdb dataset as used in the paper below. 2002. Thumbs up? Sentiment Classi cation using Machine Learning Techniques. Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 79-86.

  1. Naive Bayes: Naive Bayes is based on Bayes' theorem and assumes that the presence of each word in a document is conditionally independent of the presence of any other word in that document. Naive Bayes assumes conditional independence of features (fi) given the document's class (c), and the training involves relative-frequency estimation of P(c) and P(fi|c) using add-one smoothing.

  2. Perceptron: The Perceptron classification algorithm for sentiment analysis is a simple binary classifier that assigns sentiment labels, such as positive or negative, to text data. It represents text numerically, initializes weights, and iteratively updates them during training to find a linear boundary that separates the sentiment classes. If a document is misclassified, the algorithm adjusts the weights to correct the error. Once trained, it can classify new text data based on the learned linear separation. We train the perceptron for 4000 iterations.

  3. BERT. We fine-tune BERT (Bidirectional Encoder Representations from Transformers) on the imdb dataset to perform sentiment analysis of movie review classification. We train the model for 10 epochs on the training dataset.

We test the models with 10-fold cross validation training and testing on the data.

Model Average 10 fold Accuracy
Naive Bayes 81.6
Perceptron 82.2
BERT 83.0

The contextualized deep learning model outperforms all the other algorithms for sentiment analysis for the given dataset with just 10 epochs of fine-tuning. We can further increase the performance with additional training of the model.

sentiment-analysis's People

Contributors

susavlsh10 avatar

Stargazers

 avatar

Watchers

 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.