Dependencies


In [32]:
# Tensorflow
import tensorflow as tf
print('Tested with TensorFLow 1.2.0')
print('Your TensorFlow version:', tf.__version__) 

# Feeding function for enqueue data
from tensorflow.python.estimator.inputs.queues import feeding_functions as ff

# Rnn common functions
from tensorflow.contrib.learn.python.learn.estimators import rnn_common

# Model builder
from tensorflow.python.estimator import model_fn as model_fn_lib

# Run an experiment
from tensorflow.contrib.learn.python.learn import learn_runner

# Helpers for data processing
import pandas as pd
import numpy as np
import argparse


Tested with TensorFLow 1.2.0
Your TensorFlow version: 1.2.0

Parameters

Helper functions


In [71]:
# data from: http://ai.stanford.edu/~amaas/data/sentiment/
TRAIN_INPUT = 'data/train.csv'
TEST_INPUT = 'data/test.csv'

# data manually generated
MY_TEST_INPUT = 'data/mytest.csv'

# Parameters for training
STEPS = 15000
BATCH_SIZE = 64

# Parameters for data processing
SEQUENCE_LENGTH_KEY = 'sequence_length'
REVIEW_KEY = 'review'
CLASSIFICATION_KEY = 'is_positive'

# Vocabulary size
VOCAB_FILE = 'data/vocab.txt'
VOCAB = [line[:len(line)-1] for line in open(VOCAB_FILE)]
VOCAB_SIZE = len(VOCAB) - 1 # embedding goes from [0, VOCAB_SIZE - 1]

print('there are %d words in the train and test files' % (VOCAB_SIZE + 1))


there are 62702 words in the train and test files

In [72]:
# This function creates a sparse tensor in the following way, given:
# indices = [[0, 0], [1, 1], [2, 2]]
# values = [1, 2, 3]
# dense_shape = [3, 4]
#
# The output will be a sparse tensor that represents this dense tensor:
# [ 
#   [1, 0, 0, 0]
#   [0, 2, 0, 0]
#   [0, 0, 3, 0]
# ]
#
# We're using this to generate a Sparse tensor that can be easily
# formated in a one hot representation.
# More at: https://www.tensorflow.org/api_docs/python/tf/SparseTensor
def _sparse_string_to_index(sp, mapping):
    # This operation constructs a lookup table to convert tensor of strings
    # into int64 IDs
    table = tf.contrib.lookup.index_table_from_tensor(mapping, dtype=tf.string)
    
    return tf.SparseTensor(indices=sp.indices,
                           values=table.lookup(sp.values),
                           dense_shape=sp.dense_shape)
def array_to_onehot(array, num_dim=2):
    array = np.asarray(array, dtype=np.int32)
    onehot = np.zeros([array.shape[0], num_dim])
    for i in range(array.shape[0]):
        onehot[i][array[i]] = 1
    return onehot

# Returns the column values from a CSV file as a list
def _get_csv_column(csv_file, column_name):
    with open(csv_file, 'r') as f:
        df = pd.read_csv(f)
        return df[column_name].tolist()

Input functions


In [73]:
# Input function used for training and testing                                                
def get_input_fn(csv_file, batch_size, epochs=1):
    
    # loading csv in memory
    df = pd.read_csv(csv_file)
    df = df.dropna()
    
    # We can use a canned input function for generating batches
    # with the pandas data frame, then we call it and
    # make the changes needed on the features
    pd_fn = tf.estimator.inputs.pandas_input_fn(df, shuffle=True,
                                                batch_size=batch_size,
                                                num_epochs=epochs,
                                                queue_capacity=100000)

    def input_fn():   
        # calling the pandas input function
        fields = argparse.Namespace(**pd_fn())
        
        # Split sentences into words
        split_review = tf.string_split(fields.review, delimiter=' ')
        
        # Creating a tf constant to hold the word -> index
        # this is need to create the sparse tensor and after the one hot encode
        mapping = tf.constant(VOCAB, name="mapping")

        # Words represented in a sparse tensor
        integerized_review = _sparse_string_to_index(split_review, mapping)

        # Converting numbers to int 32
        classification = tf.cast(fields.is_positive, tf.int32)
        seq_len = tf.cast(fields.sequence_length, tf.int32)
        
        # reshaping outputs to correct shapes
        features = {REVIEW_KEY: integerized_review, SEQUENCE_LENGTH_KEY: seq_len}
        label_onehot = tf.one_hot(classification, 2)
        
        return features, label_onehot
    return input_fn

In [74]:
# Creating my own input function for a custom CSV file
# it's simpler than the input_fn above but just used for small tests
def my_test_input_fn():
    df = pd.read_csv(MY_TEST_INPUT)
    df = df.dropna()
    
    review = df.review.tolist()

    # Split sentences into words
    split_review = tf.string_split(review, delimiter=' ')
    # Creating a tf constant to hold the word -> index
    # this is need to create the sparse tensor and after the one hot encode
    mapping = tf.constant(VOCAB, name="mapping")

    # Words represented in a sparse tensor
    integerized_review = _sparse_string_to_index(split_review, mapping)

    x = {REVIEW_KEY: integerized_review, SEQUENCE_LENGTH_KEY: df.sequence_length.tolist()}
    y = df.is_positive.tolist()

    return x, y

In [75]:
train_input_fn = get_input_fn(TRAIN_INPUT, BATCH_SIZE, None)
test_input_fn = get_input_fn(TEST_INPUT, BATCH_SIZE)
my_test_input_fn = get_my_input_fn()

In [76]:
# Testing the input function
with tf.Graph().as_default():
    train_input = train_input_fn()
    with tf.train.MonitoredSession() as sess:
        #print (train_input)
        print (sess.run(train_input))
        pass


({'review': SparseTensorValue(indices=array([[ 0,  0],
       [ 0,  1],
       [ 0,  2],
       ..., 
       [63, 77],
       [63, 78],
       [63, 79]]), values=array([   37,   548,     0, ...,  8564,  2225, 10636]), dense_shape=array([64, 80])), 'sequence_length': array([80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
       80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
       80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 66, 80, 80, 80, 80, 80, 80,
       80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 53, 80, 80], dtype=int32)}, array([[ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 0.,  1.],
       [ 1.,  0.],
       [ 0.,  1.],
       [ 1.,  0.]], dtype=float32))

Creating the Estimator model


In [77]:
def get_model_fn(rnn_cell_sizes,
                 label_dimension,
                 dnn_layer_sizes=[],
                 optimizer='SGD',
                 learning_rate=0.01,
                 embed_dim=128):
    
    def model_fn(features, labels, mode):
        
        review = features[REVIEW_KEY]
        sequence_length = tf.cast(features[SEQUENCE_LENGTH_KEY], tf.int32)
        labels_onehot = labels
        
        # Creating dense representation for the sentences
        # and then converting it to embeding representation
        dense_review = tf.sparse_tensor_to_dense(review, default_value=VOCAB_SIZE)
        embed_review = tf.contrib.layers.embed_sequence(dense_review,
                                                        vocab_size=VOCAB_SIZE + 1,
                                                        embed_dim=embed_dim)
        
        
        # Each RNN layer will consist of a LSTM cell
        rnn_layers = [tf.nn.rnn_cell.LSTMCell(size) for size in rnn_cell_sizes]
        
        # Construct the layers
        multi_rnn_cell = tf.nn.rnn_cell.MultiRNNCell(rnn_layers)
        
        # Runs the RNN model dynamically
        # more about it at: 
        # https://www.tensorflow.org/api_docs/python/tf/nn/dynamic_rnn
        outputs, final_state = tf.nn.dynamic_rnn(cell=multi_rnn_cell,
                                                 inputs=embed_review,
                                                 sequence_length=sequence_length,
                                                 dtype=tf.float32)

        # Slice to keep only the last cell of the RNN
        last_activations = rnn_common.select_last_activations(outputs,
                                                              sequence_length)

        # Construct dense layers on top of the last cell of the RNN
        for units in dnn_layer_sizes:
            last_activations = tf.layers.dense(
              last_activations, units, activation=tf.nn.relu)
        
        # Final dense layer for prediction
        predictions = tf.layers.dense(last_activations, label_dimension)
        predictions_softmax = tf.nn.softmax(predictions)
        
        loss = None
        train_op = None
        
        preds_op = {
            'prediction': predictions_softmax,
            'label': labels_onehot
        }
        
        eval_op = {
            "accuracy": tf.metrics.accuracy(
                     tf.argmax(input=predictions_softmax, axis=1),
                     tf.argmax(input=labels_onehot, axis=1))
        }
        
        if mode != tf.estimator.ModeKeys.PREDICT:    
            loss = tf.losses.softmax_cross_entropy(labels_onehot, predictions)
    
        if mode == tf.estimator.ModeKeys.TRAIN:    
            train_op = tf.contrib.layers.optimize_loss(
              loss,
              tf.contrib.framework.get_global_step(),
              optimizer=optimizer,
              learning_rate=learning_rate)
        
        return tf.contrib.learn.ModelFnOps(mode,
                                           predictions=predictions_softmax,
                                           loss=loss,
                                           train_op=train_op,
                                           eval_metric_ops=eval_op)
    return model_fn

In [78]:
model_fn = get_model_fn(rnn_cell_sizes=[64], # size of the hidden layers
                        label_dimension=2, # since are just 2 classes
                        dnn_layer_sizes=[128, 64], # size of units in the dense layers on top of the RNN
                        optimizer='Adam',
                        learning_rate=0.001,
                        embed_dim=512)
estimator = tf.contrib.learn.Estimator(model_fn=model_fn, model_dir='tensorboard5/')


INFO:tensorflow:Using default config.
INFO:tensorflow:Using config: {'_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x7fe483588f98>, '_keep_checkpoint_max': 5, '_evaluation_master': '', '_environment': 'local', '_tf_config': gpu_options {
  per_process_gpu_memory_fraction: 1.0
}
, '_save_checkpoints_secs': 600, '_is_chief': True, '_task_type': None, '_keep_checkpoint_every_n_hours': 10000, '_num_worker_replicas': 0, '_save_checkpoints_steps': None, '_num_ps_replicas': 0, '_task_id': 0, '_master': '', '_model_dir': 'tensorboard5/', '_session_config': None, '_save_summary_steps': 100, '_tf_random_seed': None}

Create and Run Experiment


In [79]:
# create experiment
def generate_experiment_fn():
  
  """
  Create an experiment function given hyperparameters.
  Returns:
    A function (output_dir) -> Experiment where output_dir is a string
    representing the location of summaries, checkpoints, and exports.
    this function is used by learn_runner to create an Experiment which
    executes model code provided in the form of an Estimator and
    input functions.
    All listed arguments in the outer function are used to create an
    Estimator, and input functions (training, evaluation, serving).
    Unlisted args are passed through to Experiment.
  """

  def _experiment_fn(output_dir):
    return tf.contrib.learn.Experiment(
        estimator,
        train_input_fn=train_input_fn,
        eval_input_fn=test_input_fn,
        train_steps=STEPS
    )
  return _experiment_fn

In [ ]:
# run experiment 
learn_runner.run(generate_experiment_fn(), '/tmp/outputdir')


WARNING:tensorflow:From /usr/local/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/monitors.py:268: BaseMonitor.__init__ (from tensorflow.contrib.learn.python.learn.monitors) is deprecated and will be removed after 2016-12-05.
Instructions for updating:
Monitors are deprecated. Please use tf.train.SessionRunHook.
INFO:tensorflow:Create CheckpointSaverHook.
/usr/local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py:93: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
  "Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
INFO:tensorflow:Saving checkpoints for 1 into tensorboard5/model.ckpt.
INFO:tensorflow:loss = 0.692958, step = 1
INFO:tensorflow:Starting evaluation at 2017-06-21-14:43:45
INFO:tensorflow:Restoring parameters from tensorboard5/model.ckpt-1
INFO:tensorflow:Evaluation [1/100]
INFO:tensorflow:Evaluation [2/100]
INFO:tensorflow:Evaluation [3/100]
INFO:tensorflow:Evaluation [4/100]
INFO:tensorflow:Evaluation [5/100]
INFO:tensorflow:Evaluation [6/100]
INFO:tensorflow:Evaluation [7/100]
INFO:tensorflow:Evaluation [8/100]
INFO:tensorflow:Evaluation [9/100]
INFO:tensorflow:Evaluation [10/100]
INFO:tensorflow:Evaluation [11/100]
INFO:tensorflow:Evaluation [12/100]
INFO:tensorflow:Evaluation [13/100]
INFO:tensorflow:Evaluation [14/100]
INFO:tensorflow:Evaluation [15/100]
INFO:tensorflow:Evaluation [16/100]
INFO:tensorflow:Evaluation [17/100]
INFO:tensorflow:Evaluation [18/100]
INFO:tensorflow:Evaluation [19/100]
INFO:tensorflow:Evaluation [20/100]
INFO:tensorflow:Evaluation [21/100]
INFO:tensorflow:Evaluation [22/100]
INFO:tensorflow:Evaluation [23/100]
INFO:tensorflow:Evaluation [24/100]
INFO:tensorflow:Evaluation [25/100]
INFO:tensorflow:Evaluation [26/100]
INFO:tensorflow:Evaluation [27/100]
INFO:tensorflow:Evaluation [28/100]
INFO:tensorflow:Evaluation [29/100]
INFO:tensorflow:Evaluation [30/100]
INFO:tensorflow:Evaluation [31/100]
INFO:tensorflow:Evaluation [32/100]
INFO:tensorflow:Evaluation [33/100]
INFO:tensorflow:Evaluation [34/100]
INFO:tensorflow:Evaluation [35/100]
INFO:tensorflow:Evaluation [36/100]
INFO:tensorflow:Evaluation [37/100]
INFO:tensorflow:Evaluation [38/100]
INFO:tensorflow:Evaluation [39/100]
INFO:tensorflow:Evaluation [40/100]
INFO:tensorflow:Evaluation [41/100]
INFO:tensorflow:Evaluation [42/100]
INFO:tensorflow:Evaluation [43/100]
INFO:tensorflow:Evaluation [44/100]
INFO:tensorflow:Evaluation [45/100]
INFO:tensorflow:Evaluation [46/100]
INFO:tensorflow:Evaluation [47/100]
INFO:tensorflow:Evaluation [48/100]
INFO:tensorflow:Evaluation [49/100]
INFO:tensorflow:Evaluation [50/100]
INFO:tensorflow:Evaluation [51/100]
INFO:tensorflow:Evaluation [52/100]
INFO:tensorflow:Evaluation [53/100]
INFO:tensorflow:Evaluation [54/100]
INFO:tensorflow:Evaluation [55/100]
INFO:tensorflow:Evaluation [56/100]
INFO:tensorflow:Evaluation [57/100]
INFO:tensorflow:Evaluation [58/100]
INFO:tensorflow:Evaluation [59/100]
INFO:tensorflow:Evaluation [60/100]
INFO:tensorflow:Evaluation [61/100]
INFO:tensorflow:Evaluation [62/100]
INFO:tensorflow:Evaluation [63/100]
INFO:tensorflow:Evaluation [64/100]
INFO:tensorflow:Evaluation [65/100]
INFO:tensorflow:Evaluation [66/100]
INFO:tensorflow:Evaluation [67/100]
INFO:tensorflow:Evaluation [68/100]
INFO:tensorflow:Evaluation [69/100]
INFO:tensorflow:Evaluation [70/100]
INFO:tensorflow:Evaluation [71/100]
INFO:tensorflow:Evaluation [72/100]
INFO:tensorflow:Evaluation [73/100]
INFO:tensorflow:Evaluation [74/100]
INFO:tensorflow:Evaluation [75/100]
INFO:tensorflow:Evaluation [76/100]
INFO:tensorflow:Evaluation [77/100]
INFO:tensorflow:Evaluation [78/100]
INFO:tensorflow:Evaluation [79/100]
INFO:tensorflow:Evaluation [80/100]
INFO:tensorflow:Evaluation [81/100]
INFO:tensorflow:Evaluation [82/100]
INFO:tensorflow:Evaluation [83/100]
INFO:tensorflow:Evaluation [84/100]
INFO:tensorflow:Evaluation [85/100]
INFO:tensorflow:Evaluation [86/100]
INFO:tensorflow:Evaluation [87/100]
INFO:tensorflow:Evaluation [88/100]
INFO:tensorflow:Evaluation [89/100]
INFO:tensorflow:Evaluation [90/100]
INFO:tensorflow:Evaluation [91/100]
INFO:tensorflow:Evaluation [92/100]
INFO:tensorflow:Evaluation [93/100]
INFO:tensorflow:Evaluation [94/100]
INFO:tensorflow:Evaluation [95/100]
INFO:tensorflow:Evaluation [96/100]
INFO:tensorflow:Evaluation [97/100]
INFO:tensorflow:Evaluation [98/100]
INFO:tensorflow:Evaluation [99/100]
INFO:tensorflow:Evaluation [100/100]
INFO:tensorflow:Finished evaluation at 2017-06-21-14:43:51
INFO:tensorflow:Saving dict for global step 1: accuracy = 0.503906, global_step = 1, loss = 0.693066
INFO:tensorflow:Validation (step 1): global_step = 1, loss = 0.693066, accuracy = 0.503906
INFO:tensorflow:global_step/sec: 3.90595
INFO:tensorflow:loss = 0.509782, step = 101 (25.603 sec)
INFO:tensorflow:global_step/sec: 5.24323
INFO:tensorflow:loss = 0.338898, step = 201 (19.072 sec)
INFO:tensorflow:global_step/sec: 5.24964
INFO:tensorflow:loss = 0.253412, step = 301 (19.049 sec)
INFO:tensorflow:global_step/sec: 4.87736
INFO:tensorflow:loss = 0.226032, step = 401 (20.503 sec)
INFO:tensorflow:global_step/sec: 5.147
INFO:tensorflow:loss = 0.150812, step = 501 (19.429 sec)
INFO:tensorflow:global_step/sec: 5.08915
INFO:tensorflow:loss = 0.312629, step = 601 (19.650 sec)
INFO:tensorflow:global_step/sec: 5.19042
INFO:tensorflow:loss = 0.141266, step = 701 (19.266 sec)
INFO:tensorflow:global_step/sec: 5.20916
INFO:tensorflow:loss = 0.1165, step = 801 (19.197 sec)
INFO:tensorflow:global_step/sec: 5.14649
INFO:tensorflow:loss = 0.117326, step = 901 (19.431 sec)
INFO:tensorflow:global_step/sec: 5.16172
INFO:tensorflow:loss = 0.127401, step = 1001 (19.373 sec)
INFO:tensorflow:global_step/sec: 5.16954
INFO:tensorflow:loss = 0.118118, step = 1101 (19.344 sec)
INFO:tensorflow:global_step/sec: 5.16611
INFO:tensorflow:loss = 0.104141, step = 1201 (19.357 sec)
INFO:tensorflow:global_step/sec: 5.01813
INFO:tensorflow:loss = 0.0981689, step = 1301 (19.928 sec)
INFO:tensorflow:global_step/sec: 5.18237
INFO:tensorflow:loss = 0.0847901, step = 1401 (19.296 sec)
INFO:tensorflow:global_step/sec: 5.13791
INFO:tensorflow:loss = 0.128683, step = 1501 (19.463 sec)
INFO:tensorflow:global_step/sec: 5.09315
INFO:tensorflow:loss = 0.0797039, step = 1601 (19.634 sec)
INFO:tensorflow:global_step/sec: 5.09372
INFO:tensorflow:loss = 0.00474117, step = 1701 (19.632 sec)
INFO:tensorflow:global_step/sec: 5.16918
INFO:tensorflow:loss = 0.0315189, step = 1801 (19.345 sec)
INFO:tensorflow:global_step/sec: 5.15027
INFO:tensorflow:loss = 0.0192762, step = 1901 (19.416 sec)
INFO:tensorflow:global_step/sec: 5.1645
INFO:tensorflow:loss = 0.0324619, step = 2001 (19.363 sec)
INFO:tensorflow:global_step/sec: 5.16628
INFO:tensorflow:loss = 0.0306998, step = 2101 (19.356 sec)
INFO:tensorflow:global_step/sec: 5.11308
INFO:tensorflow:loss = 0.0786639, step = 2201 (19.558 sec)
INFO:tensorflow:global_step/sec: 5.20512
INFO:tensorflow:loss = 0.0104994, step = 2301 (19.212 sec)
INFO:tensorflow:global_step/sec: 5.1581
INFO:tensorflow:loss = 0.033287, step = 2401 (19.387 sec)
INFO:tensorflow:global_step/sec: 5.2184
INFO:tensorflow:loss = 0.0340346, step = 2501 (19.163 sec)
INFO:tensorflow:global_step/sec: 5.23599
INFO:tensorflow:loss = 0.00672109, step = 2601 (19.099 sec)
INFO:tensorflow:global_step/sec: 5.17738
INFO:tensorflow:loss = 0.000919884, step = 2701 (19.315 sec)
INFO:tensorflow:global_step/sec: 5.23425
INFO:tensorflow:loss = 0.072858, step = 2801 (19.105 sec)
INFO:tensorflow:global_step/sec: 5.2413
INFO:tensorflow:loss = 0.0148347, step = 2901 (19.079 sec)
INFO:tensorflow:global_step/sec: 5.05273
INFO:tensorflow:loss = 0.00096741, step = 3001 (19.791 sec)
INFO:tensorflow:Saving checkpoints for 3060 into tensorboard5/model.ckpt.
INFO:tensorflow:Starting evaluation at 2017-06-21-14:53:45
INFO:tensorflow:Restoring parameters from tensorboard5/model.ckpt-3060
INFO:tensorflow:Evaluation [1/100]
INFO:tensorflow:Evaluation [2/100]
INFO:tensorflow:Evaluation [3/100]
INFO:tensorflow:Evaluation [4/100]
INFO:tensorflow:Evaluation [5/100]
INFO:tensorflow:Evaluation [6/100]
INFO:tensorflow:Evaluation [7/100]
INFO:tensorflow:Evaluation [8/100]
INFO:tensorflow:Evaluation [9/100]
INFO:tensorflow:Evaluation [10/100]
INFO:tensorflow:Evaluation [11/100]
INFO:tensorflow:Evaluation [12/100]
INFO:tensorflow:Evaluation [13/100]
INFO:tensorflow:Evaluation [14/100]
INFO:tensorflow:Evaluation [15/100]
INFO:tensorflow:Evaluation [16/100]
INFO:tensorflow:Evaluation [17/100]
INFO:tensorflow:Evaluation [18/100]
INFO:tensorflow:Evaluation [19/100]
INFO:tensorflow:Evaluation [20/100]
INFO:tensorflow:Evaluation [21/100]
INFO:tensorflow:Evaluation [22/100]
INFO:tensorflow:Evaluation [23/100]
INFO:tensorflow:Evaluation [24/100]
INFO:tensorflow:Evaluation [25/100]
INFO:tensorflow:Evaluation [26/100]
INFO:tensorflow:Evaluation [27/100]
INFO:tensorflow:Evaluation [28/100]
INFO:tensorflow:Evaluation [29/100]
INFO:tensorflow:Evaluation [30/100]
INFO:tensorflow:Evaluation [31/100]
INFO:tensorflow:Evaluation [32/100]
INFO:tensorflow:Evaluation [33/100]
INFO:tensorflow:Evaluation [34/100]
INFO:tensorflow:Evaluation [35/100]
INFO:tensorflow:Evaluation [36/100]
INFO:tensorflow:Evaluation [37/100]
INFO:tensorflow:Evaluation [38/100]
INFO:tensorflow:Evaluation [39/100]
INFO:tensorflow:Evaluation [40/100]
INFO:tensorflow:Evaluation [41/100]
INFO:tensorflow:Evaluation [42/100]
INFO:tensorflow:Evaluation [43/100]
INFO:tensorflow:Evaluation [44/100]
INFO:tensorflow:Evaluation [45/100]
INFO:tensorflow:Evaluation [46/100]
INFO:tensorflow:Evaluation [47/100]
INFO:tensorflow:Evaluation [48/100]
INFO:tensorflow:Evaluation [49/100]
INFO:tensorflow:Evaluation [50/100]
INFO:tensorflow:Evaluation [51/100]
INFO:tensorflow:Evaluation [52/100]
INFO:tensorflow:Evaluation [53/100]
INFO:tensorflow:Evaluation [54/100]
INFO:tensorflow:Evaluation [55/100]
INFO:tensorflow:Evaluation [56/100]
INFO:tensorflow:Evaluation [57/100]
INFO:tensorflow:Evaluation [58/100]
INFO:tensorflow:Evaluation [59/100]
INFO:tensorflow:Evaluation [60/100]
INFO:tensorflow:Evaluation [61/100]
INFO:tensorflow:Evaluation [62/100]
INFO:tensorflow:Evaluation [63/100]
INFO:tensorflow:Evaluation [64/100]
INFO:tensorflow:Evaluation [65/100]
INFO:tensorflow:Evaluation [66/100]
INFO:tensorflow:Evaluation [67/100]
INFO:tensorflow:Evaluation [68/100]
INFO:tensorflow:Evaluation [69/100]
INFO:tensorflow:Evaluation [70/100]
INFO:tensorflow:Evaluation [71/100]
INFO:tensorflow:Evaluation [72/100]
INFO:tensorflow:Evaluation [73/100]
INFO:tensorflow:Evaluation [74/100]
INFO:tensorflow:Evaluation [75/100]
INFO:tensorflow:Evaluation [76/100]
INFO:tensorflow:Evaluation [77/100]
INFO:tensorflow:Evaluation [78/100]
INFO:tensorflow:Evaluation [79/100]
INFO:tensorflow:Evaluation [80/100]
INFO:tensorflow:Evaluation [81/100]
INFO:tensorflow:Evaluation [82/100]
INFO:tensorflow:Evaluation [83/100]
INFO:tensorflow:Evaluation [84/100]
INFO:tensorflow:Evaluation [85/100]
INFO:tensorflow:Evaluation [86/100]
INFO:tensorflow:Evaluation [87/100]
INFO:tensorflow:Evaluation [88/100]
INFO:tensorflow:Evaluation [89/100]
INFO:tensorflow:Evaluation [90/100]
INFO:tensorflow:Evaluation [91/100]
INFO:tensorflow:Evaluation [92/100]
INFO:tensorflow:Evaluation [93/100]
INFO:tensorflow:Evaluation [94/100]
INFO:tensorflow:Evaluation [95/100]
INFO:tensorflow:Evaluation [96/100]
INFO:tensorflow:Evaluation [97/100]
INFO:tensorflow:Evaluation [98/100]
INFO:tensorflow:Evaluation [99/100]
INFO:tensorflow:Evaluation [100/100]
INFO:tensorflow:Finished evaluation at 2017-06-21-14:53:51
INFO:tensorflow:Saving dict for global step 3060: accuracy = 0.758906, global_step = 3060, loss = 1.39563
INFO:tensorflow:Validation (step 3060): global_step = 3060, loss = 1.39563, accuracy = 0.758906
INFO:tensorflow:global_step/sec: 3.86028
INFO:tensorflow:loss = 0.00411983, step = 3101 (25.905 sec)
INFO:tensorflow:global_step/sec: 5.10551
INFO:tensorflow:loss = 0.00150824, step = 3201 (19.587 sec)
INFO:tensorflow:global_step/sec: 5.19217
INFO:tensorflow:loss = 0.124816, step = 3301 (19.260 sec)
INFO:tensorflow:global_step/sec: 5.18645
INFO:tensorflow:loss = 0.00264935, step = 3401 (19.281 sec)
INFO:tensorflow:global_step/sec: 5.1949
INFO:tensorflow:loss = 0.0027869, step = 3501 (19.250 sec)
INFO:tensorflow:global_step/sec: 5.21258
INFO:tensorflow:loss = 0.0677015, step = 3601 (19.184 sec)
INFO:tensorflow:global_step/sec: 5.12217
INFO:tensorflow:loss = 0.00107002, step = 3701 (19.523 sec)
INFO:tensorflow:global_step/sec: 5.17222
INFO:tensorflow:loss = 0.00355341, step = 3801 (19.334 sec)
INFO:tensorflow:global_step/sec: 5.19574
INFO:tensorflow:loss = 0.00772855, step = 3901 (19.246 sec)
INFO:tensorflow:global_step/sec: 5.20041
INFO:tensorflow:loss = 0.000576251, step = 4001 (19.229 sec)
INFO:tensorflow:global_step/sec: 5.15007
INFO:tensorflow:loss = 0.0249355, step = 4101 (19.417 sec)
INFO:tensorflow:global_step/sec: 5.20062
INFO:tensorflow:loss = 0.00662236, step = 4201 (19.228 sec)
INFO:tensorflow:global_step/sec: 5.20862
INFO:tensorflow:loss = 0.00695182, step = 4301 (19.199 sec)
INFO:tensorflow:global_step/sec: 5.22699
INFO:tensorflow:loss = 0.0201778, step = 4401 (19.132 sec)
INFO:tensorflow:global_step/sec: 5.23042
INFO:tensorflow:loss = 0.00105018, step = 4501 (19.119 sec)
INFO:tensorflow:global_step/sec: 5.15254
INFO:tensorflow:loss = 0.000472197, step = 4601 (19.408 sec)
INFO:tensorflow:global_step/sec: 5.17928
INFO:tensorflow:loss = 0.000452323, step = 4701 (19.308 sec)
INFO:tensorflow:global_step/sec: 5.08051
INFO:tensorflow:loss = 0.000237408, step = 4801 (19.683 sec)
INFO:tensorflow:global_step/sec: 5.08868
INFO:tensorflow:loss = 0.000596712, step = 4901 (19.652 sec)
INFO:tensorflow:global_step/sec: 5.16882
INFO:tensorflow:loss = 0.0146969, step = 5001 (19.347 sec)
INFO:tensorflow:global_step/sec: 5.19785
INFO:tensorflow:loss = 0.0122292, step = 5101 (19.239 sec)
INFO:tensorflow:global_step/sec: 5.19376
INFO:tensorflow:loss = 0.000340278, step = 5201 (19.254 sec)
INFO:tensorflow:global_step/sec: 5.24809
INFO:tensorflow:loss = 0.000327689, step = 5301 (19.055 sec)
INFO:tensorflow:global_step/sec: 5.20107
INFO:tensorflow:loss = 0.0805174, step = 5401 (19.227 sec)
INFO:tensorflow:global_step/sec: 5.26674
INFO:tensorflow:loss = 0.000509516, step = 5501 (18.987 sec)
INFO:tensorflow:global_step/sec: 5.24278
INFO:tensorflow:loss = 0.00246471, step = 5601 (19.074 sec)
INFO:tensorflow:global_step/sec: 5.22217
INFO:tensorflow:loss = 0.000918202, step = 5701 (19.149 sec)
INFO:tensorflow:global_step/sec: 5.21982
INFO:tensorflow:loss = 0.00244517, step = 5801 (19.158 sec)
INFO:tensorflow:global_step/sec: 5.17313
INFO:tensorflow:loss = 0.00135505, step = 5901 (19.331 sec)
INFO:tensorflow:global_step/sec: 5.2019
INFO:tensorflow:loss = 3.26352e-05, step = 6001 (19.224 sec)
INFO:tensorflow:global_step/sec: 5.16037
INFO:tensorflow:loss = 7.13116e-05, step = 6101 (19.378 sec)
INFO:tensorflow:Saving checkpoints for 6138 into tensorboard5/model.ckpt.
INFO:tensorflow:Starting evaluation at 2017-06-21-15:03:45
INFO:tensorflow:Restoring parameters from tensorboard5/model.ckpt-6138
INFO:tensorflow:Evaluation [1/100]
INFO:tensorflow:Evaluation [2/100]
INFO:tensorflow:Evaluation [3/100]
INFO:tensorflow:Evaluation [4/100]
INFO:tensorflow:Evaluation [5/100]
INFO:tensorflow:Evaluation [6/100]
INFO:tensorflow:Evaluation [7/100]
INFO:tensorflow:Evaluation [8/100]
INFO:tensorflow:Evaluation [9/100]
INFO:tensorflow:Evaluation [10/100]
INFO:tensorflow:Evaluation [11/100]
INFO:tensorflow:Evaluation [12/100]
INFO:tensorflow:Evaluation [13/100]
INFO:tensorflow:Evaluation [14/100]
INFO:tensorflow:Evaluation [15/100]
INFO:tensorflow:Evaluation [16/100]
INFO:tensorflow:Evaluation [17/100]
INFO:tensorflow:Evaluation [18/100]
INFO:tensorflow:Evaluation [19/100]
INFO:tensorflow:Evaluation [20/100]
INFO:tensorflow:Evaluation [21/100]
INFO:tensorflow:Evaluation [22/100]
INFO:tensorflow:Evaluation [23/100]
INFO:tensorflow:Evaluation [24/100]
INFO:tensorflow:Evaluation [25/100]
INFO:tensorflow:Evaluation [26/100]
INFO:tensorflow:Evaluation [27/100]
INFO:tensorflow:Evaluation [28/100]
INFO:tensorflow:Evaluation [29/100]
INFO:tensorflow:Evaluation [30/100]
INFO:tensorflow:Evaluation [31/100]
INFO:tensorflow:Evaluation [32/100]
INFO:tensorflow:Evaluation [33/100]
INFO:tensorflow:Evaluation [34/100]
INFO:tensorflow:Evaluation [35/100]
INFO:tensorflow:Evaluation [36/100]
INFO:tensorflow:Evaluation [37/100]
INFO:tensorflow:Evaluation [38/100]
INFO:tensorflow:Evaluation [39/100]
INFO:tensorflow:Evaluation [40/100]
INFO:tensorflow:Evaluation [41/100]
INFO:tensorflow:Evaluation [42/100]
INFO:tensorflow:Evaluation [43/100]
INFO:tensorflow:Evaluation [44/100]
INFO:tensorflow:Evaluation [45/100]
INFO:tensorflow:Evaluation [46/100]
INFO:tensorflow:Evaluation [47/100]
INFO:tensorflow:Evaluation [48/100]
INFO:tensorflow:Evaluation [49/100]
INFO:tensorflow:Evaluation [50/100]
INFO:tensorflow:Evaluation [51/100]
INFO:tensorflow:Evaluation [52/100]
INFO:tensorflow:Evaluation [53/100]
INFO:tensorflow:Evaluation [54/100]
INFO:tensorflow:Evaluation [55/100]
INFO:tensorflow:Evaluation [56/100]
INFO:tensorflow:Evaluation [57/100]
INFO:tensorflow:Evaluation [58/100]
INFO:tensorflow:Evaluation [59/100]
INFO:tensorflow:Evaluation [60/100]
INFO:tensorflow:Evaluation [61/100]
INFO:tensorflow:Evaluation [62/100]
INFO:tensorflow:Evaluation [63/100]
INFO:tensorflow:Evaluation [64/100]
INFO:tensorflow:Evaluation [65/100]
INFO:tensorflow:Evaluation [66/100]
INFO:tensorflow:Evaluation [67/100]
INFO:tensorflow:Evaluation [68/100]
INFO:tensorflow:Evaluation [69/100]
INFO:tensorflow:Evaluation [70/100]
INFO:tensorflow:Evaluation [71/100]
INFO:tensorflow:Evaluation [72/100]
INFO:tensorflow:Evaluation [73/100]
INFO:tensorflow:Evaluation [74/100]
INFO:tensorflow:Evaluation [75/100]
INFO:tensorflow:Evaluation [76/100]
INFO:tensorflow:Evaluation [77/100]
INFO:tensorflow:Evaluation [78/100]
INFO:tensorflow:Evaluation [79/100]
INFO:tensorflow:Evaluation [80/100]
INFO:tensorflow:Evaluation [81/100]
INFO:tensorflow:Evaluation [82/100]
INFO:tensorflow:Evaluation [83/100]
INFO:tensorflow:Evaluation [84/100]
INFO:tensorflow:Evaluation [85/100]
INFO:tensorflow:Evaluation [86/100]
INFO:tensorflow:Evaluation [87/100]
INFO:tensorflow:Evaluation [88/100]
INFO:tensorflow:Evaluation [89/100]
INFO:tensorflow:Evaluation [90/100]
INFO:tensorflow:Evaluation [91/100]
INFO:tensorflow:Evaluation [92/100]
INFO:tensorflow:Evaluation [93/100]
INFO:tensorflow:Evaluation [94/100]
INFO:tensorflow:Evaluation [95/100]
INFO:tensorflow:Evaluation [96/100]
INFO:tensorflow:Evaluation [97/100]
INFO:tensorflow:Evaluation [98/100]
INFO:tensorflow:Evaluation [99/100]
INFO:tensorflow:Evaluation [100/100]
INFO:tensorflow:Finished evaluation at 2017-06-21-15:03:51
INFO:tensorflow:Saving dict for global step 6138: accuracy = 0.744844, global_step = 6138, loss = 1.79269
INFO:tensorflow:Validation (step 6138): global_step = 6138, loss = 1.79269, accuracy = 0.744844
INFO:tensorflow:global_step/sec: 3.92933
INFO:tensorflow:loss = 0.000255428, step = 6201 (25.450 sec)
INFO:tensorflow:global_step/sec: 5.09402
INFO:tensorflow:loss = 0.00501759, step = 6301 (19.631 sec)
INFO:tensorflow:global_step/sec: 5.23684
INFO:tensorflow:loss = 0.000189106, step = 6401 (19.095 sec)
INFO:tensorflow:global_step/sec: 5.23161
INFO:tensorflow:loss = 0.00518859, step = 6501 (19.115 sec)
INFO:tensorflow:global_step/sec: 5.23524
INFO:tensorflow:loss = 0.0008064, step = 6601 (19.101 sec)
INFO:tensorflow:global_step/sec: 5.2047
INFO:tensorflow:loss = 0.000220748, step = 6701 (19.213 sec)
INFO:tensorflow:global_step/sec: 5.22083
INFO:tensorflow:loss = 0.000836212, step = 6801 (19.154 sec)
INFO:tensorflow:global_step/sec: 5.29942
INFO:tensorflow:loss = 0.00438922, step = 6901 (18.870 sec)
INFO:tensorflow:global_step/sec: 5.28698
INFO:tensorflow:loss = 0.000453551, step = 7001 (18.914 sec)
INFO:tensorflow:global_step/sec: 5.29004
INFO:tensorflow:loss = 0.000869851, step = 7101 (18.903 sec)
INFO:tensorflow:global_step/sec: 5.2096
INFO:tensorflow:loss = 4.1232e-05, step = 7201 (19.195 sec)
INFO:tensorflow:global_step/sec: 5.28761
INFO:tensorflow:loss = 0.00167836, step = 7301 (18.912 sec)
INFO:tensorflow:global_step/sec: 5.25557
INFO:tensorflow:loss = 5.43518e-05, step = 7401 (19.027 sec)
INFO:tensorflow:global_step/sec: 5.28645
INFO:tensorflow:loss = 3.34527e-05, step = 7501 (18.916 sec)
INFO:tensorflow:global_step/sec: 5.14533
INFO:tensorflow:loss = 0.000137796, step = 7601 (19.435 sec)
INFO:tensorflow:global_step/sec: 5.22415
INFO:tensorflow:loss = 3.88999e-05, step = 7701 (19.142 sec)
INFO:tensorflow:global_step/sec: 5.24108
INFO:tensorflow:loss = 8.08035e-05, step = 7801 (19.080 sec)
INFO:tensorflow:global_step/sec: 5.22792
INFO:tensorflow:loss = 1.53954e-05, step = 7901 (19.128 sec)
INFO:tensorflow:global_step/sec: 5.18433
INFO:tensorflow:loss = 3.93563e-05, step = 8001 (19.289 sec)
INFO:tensorflow:global_step/sec: 5.19075
INFO:tensorflow:loss = 1.93849e-05, step = 8101 (19.265 sec)
INFO:tensorflow:global_step/sec: 5.18763
INFO:tensorflow:loss = 3.38099e-05, step = 8201 (19.277 sec)
INFO:tensorflow:global_step/sec: 5.27647
INFO:tensorflow:loss = 1.02195e-05, step = 8301 (18.952 sec)
INFO:tensorflow:global_step/sec: 5.12882
INFO:tensorflow:loss = 0.000161402, step = 8401 (19.497 sec)
INFO:tensorflow:global_step/sec: 5.15051
INFO:tensorflow:loss = 0.000548788, step = 8501 (19.416 sec)
INFO:tensorflow:global_step/sec: 5.01701
INFO:tensorflow:loss = 9.6097e-05, step = 8601 (19.932 sec)
INFO:tensorflow:global_step/sec: 5.04163
INFO:tensorflow:loss = 7.19223e-05, step = 8701 (19.835 sec)
INFO:tensorflow:global_step/sec: 5.22874
INFO:tensorflow:loss = 0.000634883, step = 8801 (19.125 sec)
INFO:tensorflow:global_step/sec: 5.28668
INFO:tensorflow:loss = 0.0007336, step = 8901 (18.915 sec)
INFO:tensorflow:global_step/sec: 5.28031
INFO:tensorflow:loss = 0.000134641, step = 9001 (18.938 sec)
INFO:tensorflow:global_step/sec: 5.19475
INFO:tensorflow:loss = 0.000666097, step = 9101 (19.250 sec)
INFO:tensorflow:global_step/sec: 5.18066
INFO:tensorflow:loss = 0.00206482, step = 9201 (19.302 sec)
INFO:tensorflow:Saving checkpoints for 9232 into tensorboard5/model.ckpt.
INFO:tensorflow:Starting evaluation at 2017-06-21-15:13:45
INFO:tensorflow:Restoring parameters from tensorboard5/model.ckpt-9232
INFO:tensorflow:Evaluation [1/100]
INFO:tensorflow:Evaluation [2/100]
INFO:tensorflow:Evaluation [3/100]
INFO:tensorflow:Evaluation [4/100]
INFO:tensorflow:Evaluation [5/100]
INFO:tensorflow:Evaluation [6/100]
INFO:tensorflow:Evaluation [7/100]
INFO:tensorflow:Evaluation [8/100]
INFO:tensorflow:Evaluation [9/100]
INFO:tensorflow:Evaluation [10/100]
INFO:tensorflow:Evaluation [11/100]
INFO:tensorflow:Evaluation [12/100]
INFO:tensorflow:Evaluation [13/100]
INFO:tensorflow:Evaluation [14/100]
INFO:tensorflow:Evaluation [15/100]
INFO:tensorflow:Evaluation [16/100]
INFO:tensorflow:Evaluation [17/100]
INFO:tensorflow:Evaluation [18/100]
INFO:tensorflow:Evaluation [19/100]
INFO:tensorflow:Evaluation [20/100]
INFO:tensorflow:Evaluation [21/100]
INFO:tensorflow:Evaluation [22/100]
INFO:tensorflow:Evaluation [23/100]
INFO:tensorflow:Evaluation [24/100]
INFO:tensorflow:Evaluation [25/100]
INFO:tensorflow:Evaluation [26/100]
INFO:tensorflow:Evaluation [27/100]
INFO:tensorflow:Evaluation [28/100]
INFO:tensorflow:Evaluation [29/100]
INFO:tensorflow:Evaluation [30/100]
INFO:tensorflow:Evaluation [31/100]
INFO:tensorflow:Evaluation [32/100]
INFO:tensorflow:Evaluation [33/100]
INFO:tensorflow:Evaluation [34/100]
INFO:tensorflow:Evaluation [35/100]
INFO:tensorflow:Evaluation [36/100]
INFO:tensorflow:Evaluation [37/100]
INFO:tensorflow:Evaluation [38/100]
INFO:tensorflow:Evaluation [39/100]
INFO:tensorflow:Evaluation [40/100]
INFO:tensorflow:Evaluation [41/100]
INFO:tensorflow:Evaluation [42/100]
INFO:tensorflow:Evaluation [43/100]
INFO:tensorflow:Evaluation [44/100]
INFO:tensorflow:Evaluation [45/100]
INFO:tensorflow:Evaluation [46/100]
INFO:tensorflow:Evaluation [47/100]
INFO:tensorflow:Evaluation [48/100]
INFO:tensorflow:Evaluation [49/100]
INFO:tensorflow:Evaluation [50/100]
INFO:tensorflow:Evaluation [51/100]
INFO:tensorflow:Evaluation [52/100]
INFO:tensorflow:Evaluation [53/100]
INFO:tensorflow:Evaluation [54/100]
INFO:tensorflow:Evaluation [55/100]
INFO:tensorflow:Evaluation [56/100]
INFO:tensorflow:Evaluation [57/100]
INFO:tensorflow:Evaluation [58/100]
INFO:tensorflow:Evaluation [59/100]
INFO:tensorflow:Evaluation [60/100]
INFO:tensorflow:Evaluation [61/100]
INFO:tensorflow:Evaluation [62/100]
INFO:tensorflow:Evaluation [63/100]
INFO:tensorflow:Evaluation [64/100]
INFO:tensorflow:Evaluation [65/100]
INFO:tensorflow:Evaluation [66/100]
INFO:tensorflow:Evaluation [67/100]
INFO:tensorflow:Evaluation [68/100]
INFO:tensorflow:Evaluation [69/100]
INFO:tensorflow:Evaluation [70/100]
INFO:tensorflow:Evaluation [71/100]
INFO:tensorflow:Evaluation [72/100]
INFO:tensorflow:Evaluation [73/100]
INFO:tensorflow:Evaluation [74/100]
INFO:tensorflow:Evaluation [75/100]
INFO:tensorflow:Evaluation [76/100]
INFO:tensorflow:Evaluation [77/100]
INFO:tensorflow:Evaluation [78/100]
INFO:tensorflow:Evaluation [79/100]
INFO:tensorflow:Evaluation [80/100]
INFO:tensorflow:Evaluation [81/100]
INFO:tensorflow:Evaluation [82/100]
INFO:tensorflow:Evaluation [83/100]
INFO:tensorflow:Evaluation [84/100]
INFO:tensorflow:Evaluation [85/100]
INFO:tensorflow:Evaluation [86/100]
INFO:tensorflow:Evaluation [87/100]
INFO:tensorflow:Evaluation [88/100]
INFO:tensorflow:Evaluation [89/100]
INFO:tensorflow:Evaluation [90/100]
INFO:tensorflow:Evaluation [91/100]
INFO:tensorflow:Evaluation [92/100]
INFO:tensorflow:Evaluation [93/100]
INFO:tensorflow:Evaluation [94/100]
INFO:tensorflow:Evaluation [95/100]
INFO:tensorflow:Evaluation [96/100]
INFO:tensorflow:Evaluation [97/100]
INFO:tensorflow:Evaluation [98/100]
INFO:tensorflow:Evaluation [99/100]
INFO:tensorflow:Evaluation [100/100]
INFO:tensorflow:Finished evaluation at 2017-06-21-15:13:50
INFO:tensorflow:Saving dict for global step 9232: accuracy = 0.754219, global_step = 9232, loss = 1.52215
INFO:tensorflow:Validation (step 9232): global_step = 9232, loss = 1.52215, accuracy = 0.754219
INFO:tensorflow:global_step/sec: 4.02123
INFO:tensorflow:loss = 0.00386132, step = 9301 (24.868 sec)
INFO:tensorflow:global_step/sec: 4.94932
INFO:tensorflow:loss = 0.000422482, step = 9401 (20.205 sec)
INFO:tensorflow:global_step/sec: 5.14897
INFO:tensorflow:loss = 0.000272045, step = 9501 (19.421 sec)
INFO:tensorflow:global_step/sec: 5.0613
INFO:tensorflow:loss = 0.000135434, step = 9601 (19.758 sec)
INFO:tensorflow:global_step/sec: 5.2416
INFO:tensorflow:loss = 0.0584289, step = 9701 (19.078 sec)
INFO:tensorflow:global_step/sec: 5.26743
INFO:tensorflow:loss = 0.000186884, step = 9801 (18.985 sec)
INFO:tensorflow:global_step/sec: 5.08391
INFO:tensorflow:loss = 0.000248821, step = 9901 (19.670 sec)
INFO:tensorflow:global_step/sec: 5.20244
INFO:tensorflow:loss = 8.13732e-05, step = 10001 (19.222 sec)
INFO:tensorflow:global_step/sec: 5.21349
INFO:tensorflow:loss = 0.000965976, step = 10101 (19.181 sec)
INFO:tensorflow:global_step/sec: 5.24352
INFO:tensorflow:loss = 0.000175002, step = 10201 (19.071 sec)
INFO:tensorflow:global_step/sec: 5.15686
INFO:tensorflow:loss = 9.48976e-05, step = 10301 (19.392 sec)
INFO:tensorflow:global_step/sec: 5.17101
INFO:tensorflow:loss = 0.000158162, step = 10401 (19.339 sec)
INFO:tensorflow:global_step/sec: 5.18532
INFO:tensorflow:loss = 0.0117262, step = 10501 (19.285 sec)
INFO:tensorflow:global_step/sec: 5.12276
INFO:tensorflow:loss = 7.02216e-05, step = 10601 (19.521 sec)
INFO:tensorflow:global_step/sec: 5.08449
INFO:tensorflow:loss = 8.00503e-05, step = 10701 (19.668 sec)
INFO:tensorflow:global_step/sec: 5.02265
INFO:tensorflow:loss = 0.000239055, step = 10801 (19.910 sec)
INFO:tensorflow:global_step/sec: 5.14623
INFO:tensorflow:loss = 6.12818e-05, step = 10901 (19.432 sec)
INFO:tensorflow:global_step/sec: 5.16425
INFO:tensorflow:loss = 0.000134098, step = 11001 (19.364 sec)
INFO:tensorflow:global_step/sec: 5.10769
INFO:tensorflow:loss = 1.29915e-05, step = 11101 (19.578 sec)
INFO:tensorflow:global_step/sec: 5.131
INFO:tensorflow:loss = 4.20421e-05, step = 11201 (19.489 sec)
INFO:tensorflow:global_step/sec: 5.22737
INFO:tensorflow:loss = 6.06712e-05, step = 11301 (19.130 sec)
INFO:tensorflow:global_step/sec: 5.23052
INFO:tensorflow:loss = 0.00126124, step = 11401 (19.119 sec)
INFO:tensorflow:global_step/sec: 5.14987
INFO:tensorflow:loss = 1.3354e-05, step = 11501 (19.418 sec)
INFO:tensorflow:global_step/sec: 5.13208
INFO:tensorflow:loss = 6.10358e-06, step = 11601 (19.485 sec)
INFO:tensorflow:global_step/sec: 5.2396
INFO:tensorflow:loss = 4.27641e-06, step = 11701 (19.085 sec)
INFO:tensorflow:global_step/sec: 5.14981
INFO:tensorflow:loss = 2.62051e-05, step = 11801 (19.419 sec)
INFO:tensorflow:global_step/sec: 5.02529
INFO:tensorflow:loss = 9.36139e-06, step = 11901 (19.900 sec)
INFO:tensorflow:global_step/sec: 4.88893
INFO:tensorflow:loss = 0.000141036, step = 12001 (20.454 sec)
INFO:tensorflow:global_step/sec: 5.00076
INFO:tensorflow:loss = 2.84327e-05, step = 12101 (19.997 sec)
INFO:tensorflow:global_step/sec: 5.1594
INFO:tensorflow:loss = 3.50555e-05, step = 12201 (19.382 sec)
INFO:tensorflow:Saving checkpoints for 12284 into tensorboard5/model.ckpt.
INFO:tensorflow:Starting evaluation at 2017-06-21-15:23:45
INFO:tensorflow:Restoring parameters from tensorboard5/model.ckpt-12284
INFO:tensorflow:Evaluation [1/100]
INFO:tensorflow:Evaluation [2/100]
INFO:tensorflow:Evaluation [3/100]
INFO:tensorflow:Evaluation [4/100]
INFO:tensorflow:Evaluation [5/100]
INFO:tensorflow:Evaluation [6/100]
INFO:tensorflow:Evaluation [7/100]
INFO:tensorflow:Evaluation [8/100]
INFO:tensorflow:Evaluation [9/100]
INFO:tensorflow:Evaluation [10/100]
INFO:tensorflow:Evaluation [11/100]
INFO:tensorflow:Evaluation [12/100]
INFO:tensorflow:Evaluation [13/100]
INFO:tensorflow:Evaluation [14/100]
INFO:tensorflow:Evaluation [15/100]
INFO:tensorflow:Evaluation [16/100]
INFO:tensorflow:Evaluation [17/100]
INFO:tensorflow:Evaluation [18/100]
INFO:tensorflow:Evaluation [19/100]
INFO:tensorflow:Evaluation [20/100]
INFO:tensorflow:Evaluation [21/100]
INFO:tensorflow:Evaluation [22/100]
INFO:tensorflow:Evaluation [23/100]
INFO:tensorflow:Evaluation [24/100]
INFO:tensorflow:Evaluation [25/100]
INFO:tensorflow:Evaluation [26/100]
INFO:tensorflow:Evaluation [27/100]
INFO:tensorflow:Evaluation [28/100]
INFO:tensorflow:Evaluation [29/100]
INFO:tensorflow:Evaluation [30/100]
INFO:tensorflow:Evaluation [31/100]
INFO:tensorflow:Evaluation [32/100]
INFO:tensorflow:Evaluation [33/100]
INFO:tensorflow:Evaluation [34/100]
INFO:tensorflow:Evaluation [35/100]
INFO:tensorflow:Evaluation [36/100]
INFO:tensorflow:Evaluation [37/100]
INFO:tensorflow:Evaluation [38/100]
INFO:tensorflow:Evaluation [39/100]
INFO:tensorflow:Evaluation [40/100]
INFO:tensorflow:Evaluation [41/100]
INFO:tensorflow:Evaluation [42/100]
INFO:tensorflow:Evaluation [43/100]
INFO:tensorflow:Evaluation [44/100]
INFO:tensorflow:Evaluation [45/100]
INFO:tensorflow:Evaluation [46/100]
INFO:tensorflow:Evaluation [47/100]
INFO:tensorflow:Evaluation [48/100]
INFO:tensorflow:Evaluation [49/100]
INFO:tensorflow:Evaluation [50/100]
INFO:tensorflow:Evaluation [51/100]
INFO:tensorflow:Evaluation [52/100]
INFO:tensorflow:Evaluation [53/100]
INFO:tensorflow:Evaluation [54/100]
INFO:tensorflow:Evaluation [55/100]
INFO:tensorflow:Evaluation [56/100]
INFO:tensorflow:Evaluation [57/100]
INFO:tensorflow:Evaluation [58/100]
INFO:tensorflow:Evaluation [59/100]
INFO:tensorflow:Evaluation [60/100]
INFO:tensorflow:Evaluation [61/100]
INFO:tensorflow:Evaluation [62/100]
INFO:tensorflow:Evaluation [63/100]
INFO:tensorflow:Evaluation [64/100]
INFO:tensorflow:Evaluation [65/100]
INFO:tensorflow:Evaluation [66/100]
INFO:tensorflow:Evaluation [67/100]
INFO:tensorflow:Evaluation [68/100]
INFO:tensorflow:Evaluation [69/100]
INFO:tensorflow:Evaluation [70/100]
INFO:tensorflow:Evaluation [71/100]
INFO:tensorflow:Evaluation [72/100]
INFO:tensorflow:Evaluation [73/100]
INFO:tensorflow:Evaluation [74/100]
INFO:tensorflow:Evaluation [75/100]
INFO:tensorflow:Evaluation [76/100]
INFO:tensorflow:Evaluation [77/100]
INFO:tensorflow:Evaluation [78/100]
INFO:tensorflow:Evaluation [79/100]
INFO:tensorflow:Evaluation [80/100]
INFO:tensorflow:Evaluation [81/100]
INFO:tensorflow:Evaluation [82/100]
INFO:tensorflow:Evaluation [83/100]
INFO:tensorflow:Evaluation [84/100]
INFO:tensorflow:Evaluation [85/100]
INFO:tensorflow:Evaluation [86/100]
INFO:tensorflow:Evaluation [87/100]
INFO:tensorflow:Evaluation [88/100]
INFO:tensorflow:Evaluation [89/100]
INFO:tensorflow:Evaluation [90/100]
INFO:tensorflow:Evaluation [91/100]
INFO:tensorflow:Evaluation [92/100]
INFO:tensorflow:Evaluation [93/100]
INFO:tensorflow:Evaluation [94/100]
INFO:tensorflow:Evaluation [95/100]
INFO:tensorflow:Evaluation [96/100]
INFO:tensorflow:Evaluation [97/100]
INFO:tensorflow:Evaluation [98/100]
INFO:tensorflow:Evaluation [99/100]
INFO:tensorflow:Evaluation [100/100]
INFO:tensorflow:Finished evaluation at 2017-06-21-15:23:51
INFO:tensorflow:Saving dict for global step 12284: accuracy = 0.743281, global_step = 12284, loss = 2.21311
INFO:tensorflow:Validation (step 12284): global_step = 12284, loss = 2.21311, accuracy = 0.743281
INFO:tensorflow:global_step/sec: 3.80529
INFO:tensorflow:loss = 0.0092188, step = 12301 (26.279 sec)
INFO:tensorflow:global_step/sec: 5.16148
INFO:tensorflow:loss = 1.28064e-05, step = 12401 (19.374 sec)
INFO:tensorflow:global_step/sec: 5.11265
INFO:tensorflow:loss = 1.22159e-05, step = 12501 (19.559 sec)
INFO:tensorflow:global_step/sec: 5.14934
INFO:tensorflow:loss = 1.99032e-05, step = 12601 (19.420 sec)

Making Predictions


In [70]:
preds = estimator.predict(input_fn=my_test_input_fn, as_iterable=True)

sentences = _get_csv_column(MY_TEST_INPUT, 'review')

print()
for p, s in zip(preds, sentences):
    print('sentence:', s)
    print('bad review:', p[0], 'good review:', p[1])
    print('-' * 10)


INFO:tensorflow:Restoring parameters from tensorboard4/model.ckpt-5000

sentence: this is a great movie
bad review: 0.0300507 good review: 0.969949
----------
sentence: this is a good movie but isnt the best
bad review: 0.200127 good review: 0.799873
----------
sentence: this is a ok movie
bad review: 0.297393 good review: 0.702607
----------
sentence: this movie sucks
bad review: 0.999929 good review: 7.09027e-05
----------
sentence: this movie sucks but isnt the worst
bad review: 0.670557 good review: 0.329443
----------
sentence: its not that bad
bad review: 0.0490778 good review: 0.950922
----------