Skip to content

Instantly share code, notes, and snippets.

@BinRoot
Forked from titipata/imdb.md
Created December 18, 2015 01:08
Show Gist options
  • Save BinRoot/ecfeff2355c5e9069968 to your computer and use it in GitHub Desktop.
Save BinRoot/ecfeff2355c5e9069968 to your computer and use it in GitHub Desktop.

#Dowload IMDB data for LSTM example

Here is a snippet to download python code and imdb.pkl

wget http://deeplearning.net/tutorial/code/imdb.py
wget http://deeplearning.net/tutorial/code/lstm.py
wget http://www.iro.umontreal.ca/~lisa/deep/data/imdb.pkl

Then in Python

import imdb
train, valid, test = imdb.load_data(path='imdb.pkl', 
                                    n_words=10000, valid_portion=0.05,
                                    maxlen=100)

Create LSTM model using TensorFlow

import imdb
import numpy as np
import tensorflow as tf
from tensorflow.models.rnn import rnn_cell

lstm_size = 100
lstm = rnn_cell.BasicLSTMCell(lstm_size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment