Git Product home page Git Product logo

how_to_do_sentiment_analysis's Introduction

How_to_do_Sentiment_Analysis

This is the code for 'How to Do Sentiment Analysis' #3 - Intro to Deep Learning by Siraj Raval on Youtube

##Overview

This is the code for this video on Youtube by Siraj Raval. It uses TFLearn to train a Sentiment Analyzer on a set of IMDB Movie ratings. Once trained, given some input text, it will be able to classify it as either positive or negative. The neural network that is built for this is a recurrent network. It uses a technique called LSTM which I'll really deep dive into in later videos.

##Dependencies

  • tflearn

Use this guide to install TFLearn. Or just use the Amazon Web Services prebuilt AMI to run this in the cloud

##Usage

Run demo.py in terminal and it should start training

##Challenge

The challenge for this video is to train a model on this dataset of video game reviews from IGN.com. Then, given some new video game title it should be able to classify it. You can use pandas to parse this dataset. Right now each review has a label that's either Amazing, Great, Good, Mediocre, painful, or awful. These are the emotions. Using the existing labels is extra credit. The baseline is that you can just convert the labels so that there are only 2 emotions (positive or negative). Ideally you can use an RNN via TFLearn like the one in this example, but I'll accept other types of ML models as well.

You'll learn how to parse data, select appropriate features, and use a neural net on an IRL problem. Remember to ask each other questions for help in the Slack channel. Good luck!

##Credits

Credits for this code go to the author of TFLearn. I've merely created a wrapper to get people started.

how_to_do_sentiment_analysis's People

Contributors

llsourcell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

how_to_do_sentiment_analysis's Issues

imdb.load_data not returning n_words=10000

In this line of code:

train, test, _ = imdb.load_data(path='imdb.pkl', n_words=10000, valid_portion=0.1)

It appears to be splitting the data set into three lists: train, test and everything. Yet when I run the code it appears to train on 22500 pieces of data.

Obtaining imdb db...
numpy.shape(train)= (2, 22500)
numpy.shape(test)= (2, 2500)
numpy.shape(_)= (2, 25000)

This web page suggest that n_words maybe should be num_words but this gives an error.
https://keras.io/datasets/

I suspect this may be a bug in the tflearn library.

I have a trained and saved model but can not follow how to take a text field from a csv and make it something the model can produce a prediction from

I trained the model off the IMDB data set as seen in the example code https://github.com/fchollet/keras/blob/master/examples/imdb_lstm.py
and saved the produced model with model.save as sent_model.h5

I load the model with model = load_model("sent_model.h5"), print "model loaded" to screen to see that it has been done without error.

Now I can not find what I need to do to import text from a data.csv and be able to run a predict to get a sentiment analysis output. the 1st col in the csv is a natural language string and I would like to have the model attempt to analyse the sentiment using the training from the imdb data set but I can not find any guides or tutorials on how to take the text input and process it so that the model can predict from it. I have found your tutorials incredibly helpful and wanted to ask if you could please help me out?

I am using keras with a TF backend.

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.