Sentiment Analysis using tensorflow
Asked Answered
F

3

19

I am exploring tensorflow and would like to do sentiment analysis using the options available. I had a look at the following tutorial http://www.tensorflow.org/tutorials/recurrent/index.html#language_modeling

I have worked woth Naive Bayes Classifier, Maximum Entropy Algorithm and Scikit Learn Classifier and would like to know if there are any better algorithms offered by tensorflow. Is this the right place to start or are there any other options?

Any help pointing in the right direction would be greatly appreciated.

Thanks in advance.

Fugate answered 10/12, 2015 at 5:31 Comment(0)
D
15

A commonly used approach would be using a Convolutional Neural Network (CNN) to do sentiment analysis. You can find a great explanation/tutorial in this WildML blogpost. The accompanying TensorFlow code can be found here.

Another approach would be using an LSTM (or related network), you can find example implementations online, a good starting point is this blogpost.

Dynatron answered 25/8, 2016 at 20:36 Comment(0)
A
3

I would suggest you try a character-level LSTM, it's been shown to be able to achieve state-of-the-art results in many text classification tasks one of them being sentiment analysis.

I wrote a pretty lengthy article that you can find here where I go through it's implementation in TensorFlow line by line. The result is a model that is less than 100mb in size and that achieves an accuracy of over 80% on a test set of 80,000 tweets.

Another approach that has proven to be very effective is to use a recursive neural network, you can read the paper from Stanford NLP Group here

Arielariela answered 7/6, 2017 at 2:9 Comment(0)
A
0

For me, the easiest tutorial to follow was: https://pythonprogramming.net/data-size-example-tensorflow-deep-learning-tutorial/?completed=/train-test-tensorflow-deep-learning-tutorial/

It walks you throughTensorFlow.train.AdamOptimizer().minimize(cost) and uses Sentiment140 dataset (from Stanford, ~1 mil examples of positive and negative sentiment)

Appealing answered 18/4, 2017 at 16:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.