Code Monkey home page Code Monkey logo

yelp-review-classifier's Introduction

Yelp Review Classification

This is the code for a classifier that predicts ratings based on text from Yelp reviews.

Overview

I built a multinomial naive bayes classifier that rates reviews, using the Scikit-learn library. Text processing was done with the help of the NLTK library. The input is text, and the output is a numeric value of either 5 (high rating) or a 1 (low rating).

The model was able to classify text with a 92.3% accuracy.

Dependencies

  • numpy
  • pandas
  • scikit-learn
  • nltk

Install dependencies using pip.

Dataset

The dataset was taken from the Kaggle Yelp Business Rating Prediction competition. The particular subset I used (/input/yelp.csv) contains 10,000 observations (reviews) and 10 attributes.

Column Definition
business_id ID of the business being reviewed
date The date on which the review was posted
review_id Review ID
stars Rating given for the business
text Review text
type Type of text (all are "review" in this dataset)
user_id User's ID
cool / useful / funny Comments given by other users on the review

Text pre-processing

List of techniques used for text pre-processing:

  • stopword removal
  • vectorisation

Usage

Run the notebook on a localhost server using jupyter notebook.

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.