Git Product home page Git Product logo

lstm-sentiment-analysis's Introduction

Sentiment Analysis with LSTMs

This repository contains the iPython notebook and training data to accompany the O'Reilly tutorial on sentiment analysis with LSTMs in Tensorflow. See the original tutorial to run this code in a pre-built environment on O'Reilly's servers with cell-by-cell guidance, or run these files on your own machine. There is also another file called Pre-Trained LSTM.ipynb which allows you to input your own text, and see the output of the trained network.

Downloading Data

Before running the notebook, you'll first need to download all data we'll be using. This data is located in the models.tar.gz and training_data.tar.gz tarballs. We will extract these into the same directory as Oriole LSTM.ipynb. As always, the first step is to clone the repository.

git clone https://github.com/adeshpande3/LSTM-Sentiment-Analysis.git

Next, we will navigate to the newly created directory and run the following commands.

tar -xvzf models.tar.gz
tar -xvzf training_data.tar.gz

Requirements and Installation

In order to run the iPython notebook, you'll need the following libraries.

  • TensorFlow version 1.1 (Currently not supported for 1.2, 1.3, 1.4 etc but if someone wants to submit a pull request, I'd be open to that :) )
  • NumPy
  • Jupyter
  • matplotlib

Docker

With Docker, you could just mount the repository and exec it.

  1. Install Docker. Follow the docker guide.

  2. Build docker image

    cd LSTM-Sentiment-Analysis
    docker build -t="@yourname/tensorflow_1.1.0_py3" .
  3. Run the container from the image

    docker run -p 8888:8888 --name=tensorflow_yourname_py3 -v /@YourDir/LSTM-Sentiment-Analysis:/LSTM-Sentiment-Analysis -it @yourname/tensorflow_1.1.0_py3

    and visit the URL(http://localhost:8888/)

  4. Stop and restart the container

    docker stop tensorflow_yourname_py3
    docker start tensorflow_yourname_py3
    docker attach tensorflow_yourname_py3

    If jupyter is down, relaunch it by using the command below.

    cd LSTM-Sentiment-Analysis
    jupyter notebook --ip=0.0.0.0 --allow-root

Installing Anaconda Python and TensorFlow

The easiest way to install TensorFlow as well as NumPy, Jupyter, and matplotlib is to start with the Anaconda Python distribution.

  1. Follow the installation instructions for Anaconda Python. We recommend using Python 3.6.

  2. Follow the platform-specific TensorFlow installation instructions. Be sure to follow the "Installing with Anaconda" process, and create a Conda environment named tensorflow.

  3. If you aren't still inside your Conda TensorFlow environment, enter it by opening your terminal and typing

    source activate tensorflow
  4. If you haven't done so already, download and unzip this entire repository from GitHub, either interactively, or by entering

    git clone https://github.com/adeshpande3/LSTM-Sentiment-Analysis
  5. Use cd to navigate into the top directory of the repo on your machine

  6. Launch Jupyter by entering

    jupyter notebook

    and, using your browser, navigate to the URL shown in the terminal output (usually http://localhost:8888/)

lstm-sentiment-analysis's People

Contributors

adeshpande3 avatar sean10 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.