Coder Social home page Coder Social logo

nlp-product-rating's Introduction

NLP โ€“ Product Rating

Objective:

The objective of this repository is to create prediction on product ratings based on a text given from customer feedback. This repository will be creating a model to predict the rating of product 1-5 stars with 5 being the highest.

How it works:

To create the model I will be training the model on Amazon reviews. Amazon product reviews have a star rating system so that can be used as the target output prediction.

Method:

There are different methods for classifying text as a rating system.

Generative (Naive Bayes):

Learns by the joint probability distribution p(x,y) then by using Bayes is transformed to p(y/x) however you are not directly computing p(y/x). In this classifier for text analysis, there is an assumption that the words are independent of one another.

Discriminative(RNN):

Learns the conditional probability distribution p(y/x) "probability of y given x. This type of model would read the data sequentially to try and figure out the difference in ratings based on examples. In this experiment I tried a number of different models (CNN, Multi Size CNN, and a LSTM).

Code:

The input variable in this is the text summary of a review, and the target output is the rating

  • The target variable (rating) I converted this to one hot encodings
  • Vectorized the text summary, I also removed emojis text
  • Calculated the average, max, min of the text summary
  • Set a sequence length that is appropriate
  • Tested x3 models (single hidden layer, CNN, LSTM)

Results:

Out of the three models, I tested. The LSTM model had an accuracy of 0.898. It should be noted minimal fine-tuning of the model was done and the model was only trained on 10,000 of the 500,000 available rows.

Sample Test:

picture

nlp-product-rating's People

Contributors

kawong14 avatar

Stargazers

Christian 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.