In [86]:
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import

In [87]:
# We're using pandas to read the CSV file. This is easy for small datasets, but for large and complex datasets,
# tensorflow parsing and processing functions are more powerful
import pandas as pd
import numpy as np

# TensorFlow
import tensorflow as tf
print('please make sure that version >= 1.2:')
print(tf.__version__)
print('@monteirom: I made changes so it also works with 1.1.0 that is the current pip install version')
print('@monteirom: The lines that were changed have @1.2 as comment')

# Layers that will define the features
#
# real_value_column: real values, float32
# sparse_column_with_hash_bucket: Use this when your sparse features are in string or integer format, 
#                                 but you don't have a vocab file that maps each value to an integer ID. 
#                                 output_id = Hash(input_feature_string) % bucket_size
# sparse_column_with_keys: Look up logic is as follows: 
#                          lookup_id = index_of_feature_in_keys if feature in keys else default_value.
#                          You should use this when you know the vocab file for the feature
# one_hot_column: Creates an _OneHotColumn for a one-hot or multi-hot repr in a DNN.
#                 The input can be a _SparseColumn which is created by `sparse_column_with_*`
#                 or crossed_column functions
from tensorflow.contrib.layers import real_valued_column, sparse_column_with_keys, sparse_column_with_hash_bucket
from tensorflow.contrib.layers import one_hot_column


please make sure that version >= 1.2:
1.2.0-rc1
@monteirom: I made changes so it also works with 1.1.0 that is the current pip install version
@monteirom: The lines that were changed have @1.2 as comment

Please Download

https://archive.ics.uci.edu/ml/machine-learning-databases/autos/imports-85.data And move it to data/

So: data/imports-85.data is expected to exist!

Preparing the data


In [88]:
# The CSV file does not have a header, so we have to fill in column names.
names = [
    'symboling', 
    'normalized-losses', 
    'make', 
    'fuel-type', 
    'aspiration',
    'num-of-doors',
    'body-style',
    'drive-wheels',
    'engine-location',
    'wheel-base',
    'length',
    'width',
    'height',
    'curb-weight',
    'engine-type',
    'num-of-cylinders',
    'engine-size',
    'fuel-system',
    'bore',
    'stroke',
    'compression-ratio',
    'horsepower',
    'peak-rpm',
    'city-mpg',
    'highway-mpg',
    'price',
]

# We also have to specify dtypes.
dtypes = {
    'symboling': np.int32, 
    'normalized-losses': np.float32, 
    'make': str, 
    'fuel-type': str, 
    'aspiration': str,
    'num-of-doors': str,
    'body-style': str,
    'drive-wheels': str,
    'engine-location': str,
    'wheel-base': np.float32,
    'length': np.float32,
    'width': np.float32,
    'height': np.float32,
    'curb-weight': np.float32,
    'engine-type': str,
    'num-of-cylinders': str,
    'engine-size': np.float32,
    'fuel-system': str,
    'bore': np.float32,
    'stroke': np.float32,
    'compression-ratio': np.float32,
    'horsepower': np.float32,
    'peak-rpm': np.float32,
    'city-mpg': np.float32,
    'highway-mpg': np.float32,
    'price': np.float32,    
}

In [89]:
# Read the file.
df = pd.read_csv('data/imports-85.data', names=names, dtype=dtypes, na_values='?')

In [90]:
# Some rows don't have price data, we can't use those.
df = df.dropna(axis='rows', how='any', subset=['price'])

Dealing with NaN

There are many approaches possibles for NaN values in the data, here we just changing it to " " or 0 depending of the data type. This is the simplest way, but for sure is not the best in most cases, so in practice you should try some other ways to use the NaN data. Some approaches are:

  • use the mean of the row
  • use the mean of the column
  • if/else substituion (e.g if a lot of NaN do this, else do this other thing)
  • ...
  • google others

In [91]:
# Fill missing values in continuous columns with zeros instead of NaN.
float_columns = [k for k,v in dtypes.items() if v == np.float32]
df[float_columns] = df[float_columns].fillna(value=0., axis='columns')

# Fill missing values in continuous columns with '' instead of NaN (NaN mixed with strings is very bad for us).
string_columns = [k for k,v in dtypes.items() if v == str]
df[string_columns] = df[string_columns].fillna(value='', axis='columns')

Standardize features


In [92]:
# We have too many variables let's just use some of them
df = df[['num-of-doors','num-of-cylinders', 'horsepower', 'make', 'price', 'length', 'height', 'width']]

In [93]:
# Since we're possibly dealing with parameters of different units and scales. We'll need to rescale our data.
# There are two main ways to do it: 
# * Normalization, which scales all numeric variables in the range [0,1].
#   Example:
# * Standardization, it will then transform it to have zero mean and unit variance.
#   Example: 
# Which is better? It deppends of your data and your features.
# But one disadvantage of normalization over standardization is that it loses 
# some information in the data. Since normalization loses more info it can make harder
# for gradient descent to converse, so we'll use standardization.
# In practice: please analyse your data and see what gives you better results.

def std(x):
    return (x - x.mean()) / x.std()

before = df.length[0]
df.length = std(df.length)
df.width = std(df.width)
df.height = std(df.height)
df.horsepower = std(df.horsepower)

after = df.length[0]
print('before:', before, 'after:', after)


before: 168.8 after: -0.438314

Separating training data from testing data


In [94]:
TRAINING_DATA_SIZE = 160
TEST_DATA_SIZE = 10

LABEL = 'price'

# Split the data into a training set, eval set and test set
training_data = df[:TRAINING_DATA_SIZE]
eval_data = df[TRAINING_DATA_SIZE: TRAINING_DATA_SIZE + TEST_DATA_SIZE]
test_data = df[TRAINING_DATA_SIZE + TEST_DATA_SIZE:]

# Separate input features from labels
training_label = training_data.pop(LABEL)
eval_label = eval_data.pop(LABEL)
test_label = test_data.pop(LABEL)

Using Tensorflow

Defining input function


In [95]:
BATCH_SIZE = 64

# Make input function for training: 
#   num_epochs=None -> will cycle through input data forever
#   shuffle=True -> randomize order of input data
training_input_fn = tf.estimator.inputs.pandas_input_fn(x=training_data,
                                                        y=training_label,
                                                        batch_size=BATCH_SIZE,
                                                        shuffle=True,
                                                        num_epochs=None)

# Make input function for evaluation:
# shuffle=False -> do not randomize input data
eval_input_fn = tf.estimator.inputs.pandas_input_fn(x=eval_data,
                                                    y=eval_label,
                                                    batch_size=BATCH_SIZE,
                                                    shuffle=False)

# Make input function for testing:
# shuffle=False -> do not randomize input data
eval_input_fn = tf.estimator.inputs.pandas_input_fn(x=test_data,
                                                    y=test_label,
                                                    batch_size=1,
                                                    shuffle=False)

Defining a Linear Estimator


In [100]:
# Describe how the model should interpret the inputs. The names of the feature columns have to match the names
# of the series in the dataframe.

# @1.2.0 tf.feature_column.numeric_column -> tf.contrib.layers.real_valued_column
horsepower = real_valued_column('horsepower')
width = real_valued_column('width')
height = real_valued_column('height')
length = real_valued_column('length')

# @1.2.0 tf.feature_column.categorical_column_with_hash_bucket -> tf.contrib.layers.sparse_column_with_hash_bucket
make = sparse_column_with_hash_bucket('make', 50)

# @1.2.0 tf.feature_column.categorical_column_with_vocabulary_list -> tf.contrib.layers.sparse_column_with_keys
fuel_type = sparse_column_with_keys('fuel-type', keys=['diesel', 'gas'])
num_of_doors = sparse_column_with_keys('num-of-doors', keys=['two', 'four'])
num_of_cylinders = sparse_column_with_keys('num-of-cylinders', ['eight', 'five', 'four', 'six', 'three', 'twelve', 'two'])

linear_features = [horsepower, make, num_of_doors, num_of_cylinders, length, width, height]

In [101]:
regressor = tf.contrib.learn.LinearRegressor(feature_columns=linear_features, model_dir='tensorboard/linear_regressor/')


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

Training


In [113]:
regressor.fit(input_fn=training_input_fn, steps=10000)


WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:From /usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/estimators/head.py:625: scalar_summary (from tensorflow.python.ops.logging_ops) is deprecated and will be removed after 2016-11-30.
Instructions for updating:
Please switch to tf.summary.scalar. Note that tf.summary.scalar uses the node name instead of the tag. This means that TensorFlow will automatically de-duplicate summary names based on the scope they are created in. Also, passing a tensor or list of tags to a scalar summary op is no longer supported.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Restoring parameters from tensorboard/linear_regressor/model.ckpt-10000
INFO:tensorflow:Saving checkpoints for 10001 into tensorboard/linear_regressor/model.ckpt.
INFO:tensorflow:loss = 2.3649e+08, step = 10001
INFO:tensorflow:global_step/sec: 487.666
INFO:tensorflow:loss = 2.64713e+08, step = 10101 (0.211 sec)
INFO:tensorflow:global_step/sec: 604.038
INFO:tensorflow:loss = 1.71841e+08, step = 10201 (0.163 sec)
INFO:tensorflow:global_step/sec: 753.477
INFO:tensorflow:loss = 2.28382e+08, step = 10301 (0.132 sec)
INFO:tensorflow:global_step/sec: 843.912
INFO:tensorflow:loss = 2.27272e+08, step = 10401 (0.118 sec)
INFO:tensorflow:global_step/sec: 792.461
INFO:tensorflow:loss = 2.5155e+08, step = 10501 (0.126 sec)
INFO:tensorflow:global_step/sec: 792.853
INFO:tensorflow:loss = 2.94792e+08, step = 10601 (0.126 sec)
INFO:tensorflow:global_step/sec: 797.68
INFO:tensorflow:loss = 2.52011e+08, step = 10701 (0.125 sec)
INFO:tensorflow:global_step/sec: 827.651
INFO:tensorflow:loss = 2.28872e+08, step = 10801 (0.121 sec)
INFO:tensorflow:global_step/sec: 853.689
INFO:tensorflow:loss = 2.59033e+08, step = 10901 (0.118 sec)
INFO:tensorflow:global_step/sec: 834.32
INFO:tensorflow:loss = 3.01536e+08, step = 11001 (0.120 sec)
INFO:tensorflow:global_step/sec: 806.106
INFO:tensorflow:loss = 2.44482e+08, step = 11101 (0.124 sec)
INFO:tensorflow:global_step/sec: 765.947
INFO:tensorflow:loss = 2.9846e+08, step = 11201 (0.130 sec)
INFO:tensorflow:global_step/sec: 854.784
INFO:tensorflow:loss = 2.94663e+08, step = 11301 (0.117 sec)
INFO:tensorflow:global_step/sec: 824.534
INFO:tensorflow:loss = 2.41443e+08, step = 11401 (0.121 sec)
INFO:tensorflow:global_step/sec: 866.56
INFO:tensorflow:loss = 2.65833e+08, step = 11501 (0.116 sec)
INFO:tensorflow:global_step/sec: 909.636
INFO:tensorflow:loss = 1.94989e+08, step = 11601 (0.110 sec)
INFO:tensorflow:global_step/sec: 888.274
INFO:tensorflow:loss = 2.45184e+08, step = 11701 (0.113 sec)
INFO:tensorflow:global_step/sec: 880.437
INFO:tensorflow:loss = 2.53462e+08, step = 11801 (0.114 sec)
INFO:tensorflow:global_step/sec: 836.163
INFO:tensorflow:loss = 1.96561e+08, step = 11901 (0.120 sec)
INFO:tensorflow:global_step/sec: 850.22
INFO:tensorflow:loss = 2.0783e+08, step = 12001 (0.117 sec)
INFO:tensorflow:global_step/sec: 829.03
INFO:tensorflow:loss = 2.19988e+08, step = 12101 (0.119 sec)
INFO:tensorflow:global_step/sec: 856.974
INFO:tensorflow:loss = 1.87884e+08, step = 12201 (0.118 sec)
INFO:tensorflow:global_step/sec: 853.78
INFO:tensorflow:loss = 1.96885e+08, step = 12301 (0.118 sec)
INFO:tensorflow:global_step/sec: 842.492
INFO:tensorflow:loss = 3.23267e+08, step = 12401 (0.118 sec)
INFO:tensorflow:global_step/sec: 853.834
INFO:tensorflow:loss = 2.04225e+08, step = 12501 (0.117 sec)
INFO:tensorflow:global_step/sec: 734.003
INFO:tensorflow:loss = 2.56797e+08, step = 12601 (0.136 sec)
INFO:tensorflow:global_step/sec: 845.667
INFO:tensorflow:loss = 2.59135e+08, step = 12701 (0.118 sec)
INFO:tensorflow:global_step/sec: 818.819
INFO:tensorflow:loss = 2.6101e+08, step = 12801 (0.123 sec)
INFO:tensorflow:global_step/sec: 692.346
INFO:tensorflow:loss = 2.12495e+08, step = 12901 (0.145 sec)
INFO:tensorflow:global_step/sec: 732.3
INFO:tensorflow:loss = 2.53228e+08, step = 13001 (0.136 sec)
INFO:tensorflow:global_step/sec: 883.856
INFO:tensorflow:loss = 2.74027e+08, step = 13101 (0.112 sec)
INFO:tensorflow:global_step/sec: 901.377
INFO:tensorflow:loss = 2.85378e+08, step = 13201 (0.112 sec)
INFO:tensorflow:global_step/sec: 720.314
INFO:tensorflow:loss = 2.07587e+08, step = 13301 (0.138 sec)
INFO:tensorflow:global_step/sec: 696.604
INFO:tensorflow:loss = 1.90748e+08, step = 13401 (0.143 sec)
INFO:tensorflow:global_step/sec: 839.16
INFO:tensorflow:loss = 2.55649e+08, step = 13501 (0.120 sec)
INFO:tensorflow:global_step/sec: 853.372
INFO:tensorflow:loss = 1.76534e+08, step = 13601 (0.117 sec)
INFO:tensorflow:global_step/sec: 913.223
INFO:tensorflow:loss = 2.04736e+08, step = 13701 (0.110 sec)
INFO:tensorflow:global_step/sec: 795.664
INFO:tensorflow:loss = 3.35833e+08, step = 13801 (0.127 sec)
INFO:tensorflow:global_step/sec: 623.953
INFO:tensorflow:loss = 1.93106e+08, step = 13901 (0.158 sec)
INFO:tensorflow:global_step/sec: 819.618
INFO:tensorflow:loss = 1.59751e+08, step = 14001 (0.123 sec)
INFO:tensorflow:global_step/sec: 825.342
INFO:tensorflow:loss = 2.39024e+08, step = 14101 (0.122 sec)
INFO:tensorflow:global_step/sec: 797.44
INFO:tensorflow:loss = 2.57495e+08, step = 14201 (0.124 sec)
INFO:tensorflow:global_step/sec: 760.112
INFO:tensorflow:loss = 1.8934e+08, step = 14301 (0.132 sec)
INFO:tensorflow:global_step/sec: 715.349
INFO:tensorflow:loss = 2.56141e+08, step = 14401 (0.140 sec)
INFO:tensorflow:global_step/sec: 762.918
INFO:tensorflow:loss = 2.07191e+08, step = 14501 (0.131 sec)
INFO:tensorflow:global_step/sec: 813.793
INFO:tensorflow:loss = 1.92391e+08, step = 14601 (0.123 sec)
INFO:tensorflow:global_step/sec: 839.904
INFO:tensorflow:loss = 2.04549e+08, step = 14701 (0.119 sec)
INFO:tensorflow:global_step/sec: 847.384
INFO:tensorflow:loss = 3.23016e+08, step = 14801 (0.118 sec)
INFO:tensorflow:global_step/sec: 724.549
INFO:tensorflow:loss = 2.3303e+08, step = 14901 (0.138 sec)
INFO:tensorflow:global_step/sec: 825.871
INFO:tensorflow:loss = 2.5306e+08, step = 15001 (0.121 sec)
INFO:tensorflow:global_step/sec: 810.273
INFO:tensorflow:loss = 2.1004e+08, step = 15101 (0.123 sec)
INFO:tensorflow:global_step/sec: 859.49
INFO:tensorflow:loss = 1.9931e+08, step = 15201 (0.115 sec)
INFO:tensorflow:global_step/sec: 839.195
INFO:tensorflow:loss = 2.72383e+08, step = 15301 (0.120 sec)
INFO:tensorflow:global_step/sec: 789.58
INFO:tensorflow:loss = 1.85116e+08, step = 15401 (0.127 sec)
INFO:tensorflow:global_step/sec: 762.767
INFO:tensorflow:loss = 2.95402e+08, step = 15501 (0.131 sec)
INFO:tensorflow:global_step/sec: 713.743
INFO:tensorflow:loss = 2.45418e+08, step = 15601 (0.143 sec)
INFO:tensorflow:global_step/sec: 597.107
INFO:tensorflow:loss = 2.48227e+08, step = 15701 (0.168 sec)
INFO:tensorflow:global_step/sec: 604.462
INFO:tensorflow:loss = 4.23105e+08, step = 15801 (0.165 sec)
INFO:tensorflow:global_step/sec: 704.802
INFO:tensorflow:loss = 2.0276e+08, step = 15901 (0.140 sec)
INFO:tensorflow:global_step/sec: 703.797
INFO:tensorflow:loss = 2.72434e+08, step = 16001 (0.141 sec)
INFO:tensorflow:global_step/sec: 626.111
INFO:tensorflow:loss = 3.06792e+08, step = 16101 (0.160 sec)
INFO:tensorflow:global_step/sec: 692.25
INFO:tensorflow:loss = 1.6977e+08, step = 16201 (0.145 sec)
INFO:tensorflow:global_step/sec: 715.072
INFO:tensorflow:loss = 1.74598e+08, step = 16301 (0.139 sec)
INFO:tensorflow:global_step/sec: 740.773
INFO:tensorflow:loss = 2.69238e+08, step = 16401 (0.135 sec)
INFO:tensorflow:global_step/sec: 718.917
INFO:tensorflow:loss = 2.07609e+08, step = 16501 (0.138 sec)
INFO:tensorflow:global_step/sec: 638.956
INFO:tensorflow:loss = 2.33665e+08, step = 16601 (0.158 sec)
INFO:tensorflow:global_step/sec: 734.41
INFO:tensorflow:loss = 1.88454e+08, step = 16701 (0.135 sec)
INFO:tensorflow:global_step/sec: 711.329
INFO:tensorflow:loss = 2.66716e+08, step = 16801 (0.141 sec)
INFO:tensorflow:global_step/sec: 623.028
INFO:tensorflow:loss = 2.40482e+08, step = 16901 (0.161 sec)
INFO:tensorflow:global_step/sec: 551.129
INFO:tensorflow:loss = 1.71491e+08, step = 17001 (0.181 sec)
INFO:tensorflow:global_step/sec: 665.47
INFO:tensorflow:loss = 2.43472e+08, step = 17101 (0.150 sec)
INFO:tensorflow:global_step/sec: 740.87
INFO:tensorflow:loss = 3.72998e+08, step = 17201 (0.135 sec)
INFO:tensorflow:global_step/sec: 840.003
INFO:tensorflow:loss = 1.76391e+08, step = 17301 (0.118 sec)
INFO:tensorflow:global_step/sec: 887.008
INFO:tensorflow:loss = 2.03636e+08, step = 17401 (0.113 sec)
INFO:tensorflow:global_step/sec: 886.531
INFO:tensorflow:loss = 2.03204e+08, step = 17501 (0.113 sec)
INFO:tensorflow:global_step/sec: 849.691
INFO:tensorflow:loss = 2.10635e+08, step = 17601 (0.119 sec)
INFO:tensorflow:global_step/sec: 723.69
INFO:tensorflow:loss = 2.1184e+08, step = 17701 (0.138 sec)
INFO:tensorflow:global_step/sec: 761.203
INFO:tensorflow:loss = 2.77344e+08, step = 17801 (0.132 sec)
INFO:tensorflow:global_step/sec: 805.298
INFO:tensorflow:loss = 3.10556e+08, step = 17901 (0.124 sec)
INFO:tensorflow:global_step/sec: 776.499
INFO:tensorflow:loss = 1.80064e+08, step = 18001 (0.128 sec)
INFO:tensorflow:global_step/sec: 726.984
INFO:tensorflow:loss = 2.6132e+08, step = 18101 (0.138 sec)
INFO:tensorflow:global_step/sec: 869.102
INFO:tensorflow:loss = 2.71631e+08, step = 18201 (0.115 sec)
INFO:tensorflow:global_step/sec: 734.272
INFO:tensorflow:loss = 2.65901e+08, step = 18301 (0.139 sec)
INFO:tensorflow:global_step/sec: 524.165
INFO:tensorflow:loss = 2.62825e+08, step = 18401 (0.191 sec)
INFO:tensorflow:global_step/sec: 548.97
INFO:tensorflow:loss = 1.92312e+08, step = 18501 (0.182 sec)
INFO:tensorflow:global_step/sec: 711.498
INFO:tensorflow:loss = 1.81039e+08, step = 18601 (0.140 sec)
INFO:tensorflow:global_step/sec: 584.093
INFO:tensorflow:loss = 2.24824e+08, step = 18701 (0.171 sec)
INFO:tensorflow:global_step/sec: 699.242
INFO:tensorflow:loss = 2.72645e+08, step = 18801 (0.143 sec)
INFO:tensorflow:global_step/sec: 746.417
INFO:tensorflow:loss = 2.22061e+08, step = 18901 (0.135 sec)
INFO:tensorflow:global_step/sec: 761.179
INFO:tensorflow:loss = 3.13355e+08, step = 19001 (0.130 sec)
INFO:tensorflow:global_step/sec: 791.381
INFO:tensorflow:loss = 2.17411e+08, step = 19101 (0.127 sec)
INFO:tensorflow:global_step/sec: 733.634
INFO:tensorflow:loss = 1.44224e+08, step = 19201 (0.136 sec)
INFO:tensorflow:global_step/sec: 786.583
INFO:tensorflow:loss = 3.02453e+08, step = 19301 (0.127 sec)
INFO:tensorflow:global_step/sec: 680.41
INFO:tensorflow:loss = 2.98873e+08, step = 19401 (0.147 sec)
INFO:tensorflow:global_step/sec: 563.124
INFO:tensorflow:loss = 2.10761e+08, step = 19501 (0.178 sec)
INFO:tensorflow:global_step/sec: 690.107
INFO:tensorflow:loss = 3.01292e+08, step = 19601 (0.144 sec)
INFO:tensorflow:global_step/sec: 703.241
INFO:tensorflow:loss = 2.41969e+08, step = 19701 (0.144 sec)
INFO:tensorflow:global_step/sec: 755.899
INFO:tensorflow:loss = 2.53078e+08, step = 19801 (0.131 sec)
INFO:tensorflow:global_step/sec: 753.018
INFO:tensorflow:loss = 2.43982e+08, step = 19901 (0.133 sec)
INFO:tensorflow:Saving checkpoints for 20000 into tensorboard/linear_regressor/model.ckpt.
INFO:tensorflow:Loss for final step: 2.35494e+08.
Out[113]:
LinearRegressor(params={'joint_weights': False, 'gradient_clip_norm': None, 'feature_columns': [_RealValuedColumn(column_name='horsepower', dimension=1, default_value=None, dtype=tf.float32, normalizer=None), _SparseColumnHashed(column_name='make', is_integerized=False, bucket_size=50, lookup_config=None, combiner='sum', dtype=tf.string), _SparseColumnKeys(column_name='num-of-doors', is_integerized=False, bucket_size=None, lookup_config=_SparseIdLookupConfig(vocabulary_file=None, keys=('two', 'four'), num_oov_buckets=0, vocab_size=2, default_value=-1), combiner='sum', dtype=tf.string), _SparseColumnKeys(column_name='num-of-cylinders', is_integerized=False, bucket_size=None, lookup_config=_SparseIdLookupConfig(vocabulary_file=None, keys=('eight', 'five', 'four', 'six', 'three', 'twelve', 'two'), num_oov_buckets=0, vocab_size=7, default_value=-1), combiner='sum', dtype=tf.string), _RealValuedColumn(column_name='length', dimension=1, default_value=None, dtype=tf.float32, normalizer=None), _RealValuedColumn(column_name='width', dimension=1, default_value=None, dtype=tf.float32, normalizer=None), _RealValuedColumn(column_name='height', dimension=1, default_value=None, dtype=tf.float32, normalizer=None)], 'optimizer': None, 'head': <tensorflow.contrib.learn.python.learn.estimators.head._RegressionHead object at 0x7faf67544860>})

Evaluating


In [114]:
regressor.evaluate(input_fn=eval_input_fn)


WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:From /usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/estimators/head.py:625: scalar_summary (from tensorflow.python.ops.logging_ops) is deprecated and will be removed after 2016-11-30.
Instructions for updating:
Please switch to tf.summary.scalar. Note that tf.summary.scalar uses the node name instead of the tag. This means that TensorFlow will automatically de-duplicate summary names based on the scope they are created in. Also, passing a tensor or list of tags to a scalar summary op is no longer supported.
INFO:tensorflow:Starting evaluation at 2017-06-15-14:06:27
INFO:tensorflow:Restoring parameters from tensorboard/linear_regressor/model.ckpt-20000
INFO:tensorflow:Finished evaluation at 2017-06-15-14:06:27
INFO:tensorflow:Saving dict for global step 20000: global_step = 20000, loss = 2.01072e+08
Out[114]:
{'global_step': 20000, 'loss': 2.0107243e+08}

Predicting


In [115]:
preds = list(regressor.predict(input_fn=eval_input_fn))

for i in range(TEST_DATA_SIZE):
    print('prediction:', preds[i], 'real value:', test_label.iloc[i])


WARNING:tensorflow:From /usr/local/lib/python3.4/dist-packages/tensorflow/python/util/deprecation.py:347: calling LinearRegressor.predict (from tensorflow.contrib.learn.python.learn.estimators.linear) with outputs=None is deprecated and will be removed after 2017-03-01.
Instructions for updating:
Please switch to predict_scores, or set `outputs` argument.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
INFO:tensorflow:Restoring parameters from tensorboard/linear_regressor/model.ckpt-20000
prediction: 201.656 real value: 10698.0
prediction: 225.959 real value: 9988.0
prediction: 226.609 real value: 10898.0
prediction: 225.959 real value: 11248.0
prediction: 372.34 real value: 16558.0
prediction: 372.34 real value: 15998.0
prediction: 356.334 real value: 15690.0
prediction: 356.334 real value: 15750.0
prediction: 82.5563 real value: 7775.0
prediction: 125.895 real value: 7975.0

Defining a DNN Estimator


In [105]:
# @1.2.0 tf.feature_column.indicator_column -> tf.contrib.layers.one_hot_column(tf.contrib.layers.sparse_column_with_keys(...))
dnn_features = [
    #numerical features
    length, width, height, horsepower,    
    # densify categorical features:
    one_hot_column(make),
    one_hot_column(num_of_doors)
]

In [109]:
dnnregressor = tf.contrib.learn.DNNRegressor(feature_columns=dnn_features,
                                             hidden_units=[50, 30, 10], model_dir='tensorboard/DNN_regressor/')


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

Training


In [116]:
dnnregressor.fit(input_fn=training_input_fn, steps=10000)


WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:From /usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/estimators/head.py:625: scalar_summary (from tensorflow.python.ops.logging_ops) is deprecated and will be removed after 2016-11-30.
Instructions for updating:
Please switch to tf.summary.scalar. Note that tf.summary.scalar uses the node name instead of the tag. This means that TensorFlow will automatically de-duplicate summary names based on the scope they are created in. Also, passing a tensor or list of tags to a scalar summary op is no longer supported.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Restoring parameters from tensorboard/DNN_regressor/model.ckpt-10000
INFO:tensorflow:Saving checkpoints for 10001 into tensorboard/DNN_regressor/model.ckpt.
INFO:tensorflow:loss = 3.0062e+06, step = 10001
INFO:tensorflow:global_step/sec: 410.865
INFO:tensorflow:loss = 1.80712e+06, step = 10101 (0.249 sec)
INFO:tensorflow:global_step/sec: 432.046
INFO:tensorflow:loss = 1.08074e+06, step = 10201 (0.228 sec)
INFO:tensorflow:global_step/sec: 477.219
INFO:tensorflow:loss = 2.16673e+06, step = 10301 (0.211 sec)
INFO:tensorflow:global_step/sec: 473.175
INFO:tensorflow:loss = 1.27043e+06, step = 10401 (0.211 sec)
INFO:tensorflow:global_step/sec: 468.612
INFO:tensorflow:loss = 1.73635e+06, step = 10501 (0.212 sec)
INFO:tensorflow:global_step/sec: 542.977
INFO:tensorflow:loss = 2.44349e+06, step = 10601 (0.184 sec)
INFO:tensorflow:global_step/sec: 512.278
INFO:tensorflow:loss = 1.72678e+06, step = 10701 (0.195 sec)
INFO:tensorflow:global_step/sec: 539.579
INFO:tensorflow:loss = 1.73575e+06, step = 10801 (0.186 sec)
INFO:tensorflow:global_step/sec: 569.43
INFO:tensorflow:loss = 1.84625e+06, step = 10901 (0.176 sec)
INFO:tensorflow:global_step/sec: 579.667
INFO:tensorflow:loss = 1.40508e+06, step = 11001 (0.171 sec)
INFO:tensorflow:global_step/sec: 608.118
INFO:tensorflow:loss = 1.85724e+06, step = 11101 (0.165 sec)
INFO:tensorflow:global_step/sec: 472.727
INFO:tensorflow:loss = 2.04939e+06, step = 11201 (0.212 sec)
INFO:tensorflow:global_step/sec: 526.254
INFO:tensorflow:loss = 1.54183e+06, step = 11301 (0.190 sec)
INFO:tensorflow:global_step/sec: 640.349
INFO:tensorflow:loss = 2.96649e+06, step = 11401 (0.155 sec)
INFO:tensorflow:global_step/sec: 515.249
INFO:tensorflow:loss = 1.07737e+06, step = 11501 (0.194 sec)
INFO:tensorflow:global_step/sec: 572.923
INFO:tensorflow:loss = 1.58026e+06, step = 11601 (0.177 sec)
INFO:tensorflow:global_step/sec: 581.207
INFO:tensorflow:loss = 1.63373e+06, step = 11701 (0.171 sec)
INFO:tensorflow:global_step/sec: 553.665
INFO:tensorflow:loss = 1.67285e+06, step = 11801 (0.179 sec)
INFO:tensorflow:global_step/sec: 535.318
INFO:tensorflow:loss = 2.56106e+06, step = 11901 (0.190 sec)
INFO:tensorflow:global_step/sec: 498.954
INFO:tensorflow:loss = 2.04174e+06, step = 12001 (0.199 sec)
INFO:tensorflow:global_step/sec: 594.491
INFO:tensorflow:loss = 1.0685e+06, step = 12101 (0.166 sec)
INFO:tensorflow:global_step/sec: 536.315
INFO:tensorflow:loss = 1.78378e+06, step = 12201 (0.185 sec)
INFO:tensorflow:global_step/sec: 562.286
INFO:tensorflow:loss = 1.23437e+06, step = 12301 (0.179 sec)
INFO:tensorflow:global_step/sec: 420.133
INFO:tensorflow:loss = 2.01861e+06, step = 12401 (0.239 sec)
INFO:tensorflow:global_step/sec: 447.574
INFO:tensorflow:loss = 1.09678e+06, step = 12501 (0.226 sec)
INFO:tensorflow:global_step/sec: 448.196
INFO:tensorflow:loss = 1.14881e+06, step = 12601 (0.224 sec)
INFO:tensorflow:global_step/sec: 488.272
INFO:tensorflow:loss = 1.36226e+06, step = 12701 (0.202 sec)
INFO:tensorflow:global_step/sec: 430.907
INFO:tensorflow:loss = 2.27906e+06, step = 12801 (0.234 sec)
INFO:tensorflow:global_step/sec: 516.592
INFO:tensorflow:loss = 2.18078e+06, step = 12901 (0.192 sec)
INFO:tensorflow:global_step/sec: 480.854
INFO:tensorflow:loss = 1.40007e+06, step = 13001 (0.205 sec)
INFO:tensorflow:global_step/sec: 737.43
INFO:tensorflow:loss = 2.25306e+06, step = 13101 (0.137 sec)
INFO:tensorflow:global_step/sec: 592.39
INFO:tensorflow:loss = 1.57321e+06, step = 13201 (0.167 sec)
INFO:tensorflow:global_step/sec: 678.36
INFO:tensorflow:loss = 1.337e+06, step = 13301 (0.149 sec)
INFO:tensorflow:global_step/sec: 618.066
INFO:tensorflow:loss = 1.90416e+06, step = 13401 (0.163 sec)
INFO:tensorflow:global_step/sec: 488.916
INFO:tensorflow:loss = 1.59448e+06, step = 13501 (0.203 sec)
INFO:tensorflow:global_step/sec: 579.586
INFO:tensorflow:loss = 1.50297e+06, step = 13601 (0.173 sec)
INFO:tensorflow:global_step/sec: 634.333
INFO:tensorflow:loss = 977750.0, step = 13701 (0.156 sec)
INFO:tensorflow:global_step/sec: 605.422
INFO:tensorflow:loss = 1.60281e+06, step = 13801 (0.166 sec)
INFO:tensorflow:global_step/sec: 621.328
INFO:tensorflow:loss = 1.32841e+06, step = 13901 (0.161 sec)
INFO:tensorflow:global_step/sec: 553.949
INFO:tensorflow:loss = 1.47141e+06, step = 14001 (0.179 sec)
INFO:tensorflow:global_step/sec: 586.639
INFO:tensorflow:loss = 1.13979e+06, step = 14101 (0.173 sec)
INFO:tensorflow:global_step/sec: 485.641
INFO:tensorflow:loss = 1.33312e+06, step = 14201 (0.208 sec)
INFO:tensorflow:global_step/sec: 602.422
INFO:tensorflow:loss = 1.53774e+06, step = 14301 (0.163 sec)
INFO:tensorflow:global_step/sec: 560.841
INFO:tensorflow:loss = 1.06281e+06, step = 14401 (0.177 sec)
INFO:tensorflow:global_step/sec: 627.239
INFO:tensorflow:loss = 1.69983e+06, step = 14501 (0.160 sec)
INFO:tensorflow:global_step/sec: 493.997
INFO:tensorflow:loss = 1.39271e+06, step = 14601 (0.202 sec)
INFO:tensorflow:global_step/sec: 610.628
INFO:tensorflow:loss = 1.33658e+06, step = 14701 (0.163 sec)
INFO:tensorflow:global_step/sec: 623.686
INFO:tensorflow:loss = 1.97745e+06, step = 14801 (0.163 sec)
INFO:tensorflow:global_step/sec: 442.198
INFO:tensorflow:loss = 2.8141e+06, step = 14901 (0.226 sec)
INFO:tensorflow:global_step/sec: 531.434
INFO:tensorflow:loss = 1.37871e+06, step = 15001 (0.190 sec)
INFO:tensorflow:global_step/sec: 402.412
INFO:tensorflow:loss = 1.20593e+06, step = 15101 (0.251 sec)
INFO:tensorflow:global_step/sec: 419.193
INFO:tensorflow:loss = 1.2813e+06, step = 15201 (0.234 sec)
INFO:tensorflow:global_step/sec: 448.498
INFO:tensorflow:loss = 1.52284e+06, step = 15301 (0.223 sec)
INFO:tensorflow:global_step/sec: 515.252
INFO:tensorflow:loss = 987623.0, step = 15401 (0.193 sec)
INFO:tensorflow:global_step/sec: 616.002
INFO:tensorflow:loss = 1.78134e+06, step = 15501 (0.163 sec)
INFO:tensorflow:global_step/sec: 550.2
INFO:tensorflow:loss = 946898.0, step = 15601 (0.183 sec)
INFO:tensorflow:global_step/sec: 510.34
INFO:tensorflow:loss = 1.30809e+06, step = 15701 (0.193 sec)
INFO:tensorflow:global_step/sec: 494.768
INFO:tensorflow:loss = 1.01661e+06, step = 15801 (0.203 sec)
INFO:tensorflow:global_step/sec: 414.967
INFO:tensorflow:loss = 1.40305e+06, step = 15901 (0.244 sec)
INFO:tensorflow:global_step/sec: 475.016
INFO:tensorflow:loss = 1.28881e+06, step = 16001 (0.207 sec)
INFO:tensorflow:global_step/sec: 466.893
INFO:tensorflow:loss = 1.41307e+06, step = 16101 (0.215 sec)
INFO:tensorflow:global_step/sec: 445.964
INFO:tensorflow:loss = 1.54385e+06, step = 16201 (0.227 sec)
INFO:tensorflow:global_step/sec: 356.662
INFO:tensorflow:loss = 1.04547e+06, step = 16301 (0.281 sec)
INFO:tensorflow:global_step/sec: 402.729
INFO:tensorflow:loss = 1.81635e+06, step = 16401 (0.244 sec)
INFO:tensorflow:global_step/sec: 582.786
INFO:tensorflow:loss = 1.21318e+06, step = 16501 (0.170 sec)
INFO:tensorflow:global_step/sec: 604.806
INFO:tensorflow:loss = 1.47087e+06, step = 16601 (0.166 sec)
INFO:tensorflow:global_step/sec: 628.247
INFO:tensorflow:loss = 1.60473e+06, step = 16701 (0.160 sec)
INFO:tensorflow:global_step/sec: 485.227
INFO:tensorflow:loss = 1.88488e+06, step = 16801 (0.207 sec)
INFO:tensorflow:global_step/sec: 469.102
INFO:tensorflow:loss = 823697.0, step = 16901 (0.213 sec)
INFO:tensorflow:global_step/sec: 368.488
INFO:tensorflow:loss = 1.53954e+06, step = 17001 (0.273 sec)
INFO:tensorflow:global_step/sec: 356.418
INFO:tensorflow:loss = 1.45857e+06, step = 17101 (0.278 sec)
INFO:tensorflow:global_step/sec: 452.527
INFO:tensorflow:loss = 1.20414e+06, step = 17201 (0.221 sec)
INFO:tensorflow:global_step/sec: 420.855
INFO:tensorflow:loss = 1.10563e+06, step = 17301 (0.239 sec)
INFO:tensorflow:global_step/sec: 382.098
INFO:tensorflow:loss = 1.16531e+06, step = 17401 (0.263 sec)
INFO:tensorflow:global_step/sec: 416.136
INFO:tensorflow:loss = 1.83771e+06, step = 17501 (0.237 sec)
INFO:tensorflow:global_step/sec: 510.275
INFO:tensorflow:loss = 1.2754e+06, step = 17601 (0.197 sec)
INFO:tensorflow:global_step/sec: 429.058
INFO:tensorflow:loss = 1.27058e+06, step = 17701 (0.235 sec)
INFO:tensorflow:global_step/sec: 417.446
INFO:tensorflow:loss = 1.44957e+06, step = 17801 (0.238 sec)
INFO:tensorflow:global_step/sec: 390.338
INFO:tensorflow:loss = 1.98533e+06, step = 17901 (0.254 sec)
INFO:tensorflow:global_step/sec: 485.397
INFO:tensorflow:loss = 858066.0, step = 18001 (0.205 sec)
INFO:tensorflow:global_step/sec: 621.736
INFO:tensorflow:loss = 850435.0, step = 18101 (0.163 sec)
INFO:tensorflow:global_step/sec: 628.529
INFO:tensorflow:loss = 1.273e+06, step = 18201 (0.159 sec)
INFO:tensorflow:global_step/sec: 566.567
INFO:tensorflow:loss = 1.62966e+06, step = 18301 (0.175 sec)
INFO:tensorflow:global_step/sec: 532.578
INFO:tensorflow:loss = 1.72546e+06, step = 18401 (0.190 sec)
INFO:tensorflow:global_step/sec: 456.907
INFO:tensorflow:loss = 1.30249e+06, step = 18501 (0.220 sec)
INFO:tensorflow:global_step/sec: 415.351
INFO:tensorflow:loss = 1.84526e+06, step = 18601 (0.242 sec)
INFO:tensorflow:global_step/sec: 427.428
INFO:tensorflow:loss = 1.73231e+06, step = 18701 (0.230 sec)
INFO:tensorflow:global_step/sec: 446.415
INFO:tensorflow:loss = 2.00656e+06, step = 18801 (0.228 sec)
INFO:tensorflow:global_step/sec: 412.629
INFO:tensorflow:loss = 1.18067e+06, step = 18901 (0.240 sec)
INFO:tensorflow:global_step/sec: 466.333
INFO:tensorflow:loss = 984653.0, step = 19001 (0.214 sec)
INFO:tensorflow:global_step/sec: 487.585
INFO:tensorflow:loss = 1.61887e+06, step = 19101 (0.203 sec)
INFO:tensorflow:global_step/sec: 455.934
INFO:tensorflow:loss = 1.08504e+06, step = 19201 (0.224 sec)
INFO:tensorflow:global_step/sec: 435.185
INFO:tensorflow:loss = 1.70321e+06, step = 19301 (0.223 sec)
INFO:tensorflow:global_step/sec: 556.179
INFO:tensorflow:loss = 1.43427e+06, step = 19401 (0.181 sec)
INFO:tensorflow:global_step/sec: 602.564
INFO:tensorflow:loss = 1.31241e+06, step = 19501 (0.167 sec)
INFO:tensorflow:global_step/sec: 565.256
INFO:tensorflow:loss = 1.19668e+06, step = 19601 (0.177 sec)
INFO:tensorflow:global_step/sec: 600.1
INFO:tensorflow:loss = 1.06076e+06, step = 19701 (0.166 sec)
INFO:tensorflow:global_step/sec: 554.526
INFO:tensorflow:loss = 1.44967e+06, step = 19801 (0.181 sec)
INFO:tensorflow:global_step/sec: 484.585
INFO:tensorflow:loss = 1.31894e+06, step = 19901 (0.205 sec)
INFO:tensorflow:Saving checkpoints for 20000 into tensorboard/DNN_regressor/model.ckpt.
INFO:tensorflow:Loss for final step: 1.37584e+06.
Out[116]:
DNNRegressor(params={'hidden_units': [50, 30, 10], 'embedding_lr_multipliers': None, 'dropout': None, 'feature_columns': (_RealValuedColumn(column_name='length', dimension=1, default_value=None, dtype=tf.float32, normalizer=None), _RealValuedColumn(column_name='width', dimension=1, default_value=None, dtype=tf.float32, normalizer=None), _RealValuedColumn(column_name='height', dimension=1, default_value=None, dtype=tf.float32, normalizer=None), _RealValuedColumn(column_name='horsepower', dimension=1, default_value=None, dtype=tf.float32, normalizer=None), _OneHotColumn(sparse_id_column=_SparseColumnHashed(column_name='make', is_integerized=False, bucket_size=50, lookup_config=None, combiner='sum', dtype=tf.string)), _OneHotColumn(sparse_id_column=_SparseColumnKeys(column_name='num-of-doors', is_integerized=False, bucket_size=None, lookup_config=_SparseIdLookupConfig(vocabulary_file=None, keys=('two', 'four'), num_oov_buckets=0, vocab_size=2, default_value=-1), combiner='sum', dtype=tf.string))), 'head': <tensorflow.contrib.learn.python.learn.estimators.head._RegressionHead object at 0x7faf24e85ef0>, 'activation_fn': <function relu at 0x7faf731a3048>, 'gradient_clip_norm': None, 'optimizer': None, 'input_layer_min_slice_size': None})

Evaluating


In [117]:
dnnregressor.evaluate(input_fn=eval_input_fn)


WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:From /usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/estimators/head.py:625: scalar_summary (from tensorflow.python.ops.logging_ops) is deprecated and will be removed after 2016-11-30.
Instructions for updating:
Please switch to tf.summary.scalar. Note that tf.summary.scalar uses the node name instead of the tag. This means that TensorFlow will automatically de-duplicate summary names based on the scope they are created in. Also, passing a tensor or list of tags to a scalar summary op is no longer supported.
INFO:tensorflow:Starting evaluation at 2017-06-15-14:09:38
INFO:tensorflow:Restoring parameters from tensorboard/DNN_regressor/model.ckpt-20000
INFO:tensorflow:Finished evaluation at 2017-06-15-14:09:39
INFO:tensorflow:Saving dict for global step 20000: global_step = 20000, loss = 1.54576e+07
Out[117]:
{'global_step': 20000, 'loss': 15457560.0}

Predicting


In [118]:
preds = list(dnnregressor.predict(input_fn=eval_input_fn))

for i in range(TEST_DATA_SIZE):
    print('prediction:', preds[i], 'real value:', test_label.iloc[i])


WARNING:tensorflow:From /usr/local/lib/python3.4/dist-packages/tensorflow/python/util/deprecation.py:347: calling DNNRegressor.predict (from tensorflow.contrib.learn.python.learn.estimators.dnn) with outputs=None is deprecated and will be removed after 2017-03-01.
Instructions for updating:
Please switch to predict_scores, or set `outputs` argument.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
INFO:tensorflow:Restoring parameters from tensorboard/DNN_regressor/model.ckpt-20000
prediction: 8559.48 real value: 10698.0
prediction: 10046.9 real value: 9988.0
prediction: 9907.54 real value: 10898.0
prediction: 10046.9 real value: 11248.0
prediction: 24726.5 real value: 16558.0
prediction: 24726.5 real value: 15998.0
prediction: 20584.9 real value: 15690.0
prediction: 20584.9 real value: 15750.0
prediction: 3707.19 real value: 7775.0
prediction: 5748.44 real value: 7975.0

Creating an Experiment


In [82]:
# @1.2.0 experiment_fn(run_config, params) - > experiment_fn(output_dir)
def experiment_fn(output_dir):
    # This function makes an Experiment, containing an Estimator and inputs for training and evaluation.
    # You can use params and config here to customize the Estimator depending on the cluster or to use
    # hyperparameter tuning.

    # Collect information for training
    # @1.2.0 config=run_config -> ''
    return tf.contrib.learn.Experiment(estimator=tf.contrib.learn.LinearRegressor(
                                     feature_columns=linear_features, model_dir=output_dir),
                                     train_input_fn=training_input_fn,
                                     train_steps=10000,
                                     eval_input_fn=eval_input_fn)

In [83]:
import shutil
# @1.2.0 tf.contrib.learn.learn_runner(exp, run_config=tf.contrib.learn.RunConfig(model_dir="/tmp/output_dir")
# -> tf.contrib.learn.python.learn.learm_runner.run(exp, output_dir='/tmp/output_dir')
shutil.rmtree("/tmp/output_dir", ignore_errors=True)

from tensorflow.contrib.learn.python.learn import learn_runner
learn_runner.run(experiment_fn, output_dir='/tmp/output_dir')


INFO:tensorflow:Using default config.
INFO:tensorflow:Using config: {'_save_checkpoints_steps': None, '_tf_config': gpu_options {
  per_process_gpu_memory_fraction: 1
}
, '_task_id': 0, '_keep_checkpoint_max': 5, '_save_checkpoints_secs': 600, '_session_config': None, '_model_dir': '/tmp/output_dir', '_master': '', '_tf_random_seed': None, '_environment': 'local', '_num_ps_replicas': 0, '_num_worker_replicas': 0, '_task_type': None, '_keep_checkpoint_every_n_hours': 10000, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x7faf2c6dc5f8>, '_save_summary_steps': 100, '_evaluation_master': '', '_is_chief': True}
WARNING:tensorflow:From /usr/local/lib/python3.4/dist-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.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:From /usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/estimators/head.py:625: scalar_summary (from tensorflow.python.ops.logging_ops) is deprecated and will be removed after 2016-11-30.
Instructions for updating:
Please switch to tf.summary.scalar. Note that tf.summary.scalar uses the node name instead of the tag. This means that TensorFlow will automatically de-duplicate summary names based on the scope they are created in. Also, passing a tensor or list of tags to a scalar summary op is no longer supported.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Saving checkpoints for 1 into /tmp/output_dir/model.ckpt.
INFO:tensorflow:loss = 2.53779e+08, step = 1
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:From /usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/estimators/head.py:625: scalar_summary (from tensorflow.python.ops.logging_ops) is deprecated and will be removed after 2016-11-30.
Instructions for updating:
Please switch to tf.summary.scalar. Note that tf.summary.scalar uses the node name instead of the tag. This means that TensorFlow will automatically de-duplicate summary names based on the scope they are created in. Also, passing a tensor or list of tags to a scalar summary op is no longer supported.
INFO:tensorflow:Starting evaluation at 2017-06-15-00:13:35
INFO:tensorflow:Restoring parameters from /tmp/output_dir/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:Finished evaluation at 2017-06-15-00:13:35
INFO:tensorflow:Saving dict for global step 1: global_step = 1, loss = 2.08159e+08
INFO:tensorflow:Validation (step 1): loss = 2.08159e+08, global_step = 1
INFO:tensorflow:global_step/sec: 54.6108
INFO:tensorflow:loss = 3.2995e+08, step = 101 (1.832 sec)
INFO:tensorflow:global_step/sec: 454.199
INFO:tensorflow:loss = 2.2434e+08, step = 201 (0.220 sec)
INFO:tensorflow:global_step/sec: 456.823
INFO:tensorflow:loss = 2.70825e+08, step = 301 (0.219 sec)
INFO:tensorflow:global_step/sec: 472.326
INFO:tensorflow:loss = 2.6304e+08, step = 401 (0.212 sec)
INFO:tensorflow:global_step/sec: 462.905
INFO:tensorflow:loss = 2.07089e+08, step = 501 (0.216 sec)
INFO:tensorflow:global_step/sec: 468.526
INFO:tensorflow:loss = 2.40862e+08, step = 601 (0.213 sec)
INFO:tensorflow:global_step/sec: 473.318
INFO:tensorflow:loss = 2.4237e+08, step = 701 (0.211 sec)
INFO:tensorflow:global_step/sec: 478.001
INFO:tensorflow:loss = 1.96818e+08, step = 801 (0.209 sec)
INFO:tensorflow:global_step/sec: 452.254
INFO:tensorflow:loss = 2.08855e+08, step = 901 (0.222 sec)
INFO:tensorflow:global_step/sec: 463.583
INFO:tensorflow:loss = 2.83313e+08, step = 1001 (0.215 sec)
INFO:tensorflow:global_step/sec: 396.998
INFO:tensorflow:loss = 3.63846e+08, step = 1101 (0.252 sec)
INFO:tensorflow:global_step/sec: 472.892
INFO:tensorflow:loss = 2.27487e+08, step = 1201 (0.211 sec)
INFO:tensorflow:global_step/sec: 473.153
INFO:tensorflow:loss = 1.95032e+08, step = 1301 (0.211 sec)
INFO:tensorflow:global_step/sec: 426.272
INFO:tensorflow:loss = 2.15183e+08, step = 1401 (0.235 sec)
INFO:tensorflow:global_step/sec: 473.015
INFO:tensorflow:loss = 2.63166e+08, step = 1501 (0.211 sec)
INFO:tensorflow:global_step/sec: 472.721
INFO:tensorflow:loss = 2.94977e+08, step = 1601 (0.212 sec)
INFO:tensorflow:global_step/sec: 478.031
INFO:tensorflow:loss = 2.07383e+08, step = 1701 (0.210 sec)
INFO:tensorflow:global_step/sec: 475.855
INFO:tensorflow:loss = 2.41123e+08, step = 1801 (0.209 sec)
INFO:tensorflow:global_step/sec: 480.033
INFO:tensorflow:loss = 2.24982e+08, step = 1901 (0.208 sec)
INFO:tensorflow:global_step/sec: 475.881
INFO:tensorflow:loss = 2.31737e+08, step = 2001 (0.210 sec)
INFO:tensorflow:global_step/sec: 482.01
INFO:tensorflow:loss = 2.37991e+08, step = 2101 (0.208 sec)
INFO:tensorflow:global_step/sec: 473.816
INFO:tensorflow:loss = 1.94863e+08, step = 2201 (0.211 sec)
INFO:tensorflow:global_step/sec: 468.928
INFO:tensorflow:loss = 2.36104e+08, step = 2301 (0.213 sec)
INFO:tensorflow:global_step/sec: 468.532
INFO:tensorflow:loss = 2.42888e+08, step = 2401 (0.214 sec)
INFO:tensorflow:global_step/sec: 481.561
INFO:tensorflow:loss = 2.06083e+08, step = 2501 (0.208 sec)
INFO:tensorflow:global_step/sec: 477.19
INFO:tensorflow:loss = 2.10886e+08, step = 2601 (0.210 sec)
INFO:tensorflow:global_step/sec: 464.82
INFO:tensorflow:loss = 2.36597e+08, step = 2701 (0.215 sec)
INFO:tensorflow:global_step/sec: 480.239
INFO:tensorflow:loss = 2.64082e+08, step = 2801 (0.208 sec)
INFO:tensorflow:global_step/sec: 454.252
INFO:tensorflow:loss = 2.7465e+08, step = 2901 (0.220 sec)
INFO:tensorflow:global_step/sec: 473.216
INFO:tensorflow:loss = 3.03645e+08, step = 3001 (0.211 sec)
INFO:tensorflow:global_step/sec: 481.783
INFO:tensorflow:loss = 2.82896e+08, step = 3101 (0.208 sec)
INFO:tensorflow:global_step/sec: 472.608
INFO:tensorflow:loss = 2.05005e+08, step = 3201 (0.212 sec)
INFO:tensorflow:global_step/sec: 481.667
INFO:tensorflow:loss = 2.04795e+08, step = 3301 (0.208 sec)
INFO:tensorflow:global_step/sec: 485.621
INFO:tensorflow:loss = 2.34377e+08, step = 3401 (0.206 sec)
INFO:tensorflow:global_step/sec: 486.705
INFO:tensorflow:loss = 2.8409e+08, step = 3501 (0.205 sec)
INFO:tensorflow:global_step/sec: 487.064
INFO:tensorflow:loss = 2.64078e+08, step = 3601 (0.205 sec)
INFO:tensorflow:global_step/sec: 479.578
INFO:tensorflow:loss = 1.93784e+08, step = 3701 (0.209 sec)
INFO:tensorflow:global_step/sec: 477.774
INFO:tensorflow:loss = 2.8074e+08, step = 3801 (0.209 sec)
INFO:tensorflow:global_step/sec: 485.669
INFO:tensorflow:loss = 2.33637e+08, step = 3901 (0.206 sec)
INFO:tensorflow:global_step/sec: 486.921
INFO:tensorflow:loss = 1.72349e+08, step = 4001 (0.205 sec)
INFO:tensorflow:global_step/sec: 485.449
INFO:tensorflow:loss = 2.2439e+08, step = 4101 (0.206 sec)
INFO:tensorflow:global_step/sec: 485.478
INFO:tensorflow:loss = 3.11015e+08, step = 4201 (0.206 sec)
INFO:tensorflow:global_step/sec: 467.359
INFO:tensorflow:loss = 3.30783e+08, step = 4301 (0.214 sec)
INFO:tensorflow:global_step/sec: 470.685
INFO:tensorflow:loss = 1.86487e+08, step = 4401 (0.212 sec)
INFO:tensorflow:global_step/sec: 469.766
INFO:tensorflow:loss = 2.14433e+08, step = 4501 (0.213 sec)
INFO:tensorflow:global_step/sec: 453.857
INFO:tensorflow:loss = 1.76995e+08, step = 4601 (0.220 sec)
INFO:tensorflow:global_step/sec: 460.425
INFO:tensorflow:loss = 2.38683e+08, step = 4701 (0.217 sec)
INFO:tensorflow:global_step/sec: 470.707
INFO:tensorflow:loss = 2.83825e+08, step = 4801 (0.212 sec)
INFO:tensorflow:global_step/sec: 474.829
INFO:tensorflow:loss = 2.53666e+08, step = 4901 (0.211 sec)
INFO:tensorflow:global_step/sec: 486.946
INFO:tensorflow:loss = 2.04523e+08, step = 5001 (0.205 sec)
INFO:tensorflow:global_step/sec: 487.178
INFO:tensorflow:loss = 2.86669e+08, step = 5101 (0.205 sec)
INFO:tensorflow:global_step/sec: 487.332
INFO:tensorflow:loss = 2.7821e+08, step = 5201 (0.205 sec)
INFO:tensorflow:global_step/sec: 487.092
INFO:tensorflow:loss = 2.59791e+08, step = 5301 (0.205 sec)
INFO:tensorflow:global_step/sec: 491.003
INFO:tensorflow:loss = 2.47141e+08, step = 5401 (0.204 sec)
INFO:tensorflow:global_step/sec: 491.106
INFO:tensorflow:loss = 2.37231e+08, step = 5501 (0.204 sec)
INFO:tensorflow:global_step/sec: 487.993
INFO:tensorflow:loss = 2.72222e+08, step = 5601 (0.205 sec)
INFO:tensorflow:global_step/sec: 484.965
INFO:tensorflow:loss = 2.79429e+08, step = 5701 (0.206 sec)
INFO:tensorflow:global_step/sec: 487.171
INFO:tensorflow:loss = 3.34573e+08, step = 5801 (0.205 sec)
INFO:tensorflow:global_step/sec: 487.233
INFO:tensorflow:loss = 3.56468e+08, step = 5901 (0.205 sec)
INFO:tensorflow:global_step/sec: 484.368
INFO:tensorflow:loss = 2.97041e+08, step = 6001 (0.207 sec)
INFO:tensorflow:global_step/sec: 467.584
INFO:tensorflow:loss = 2.29266e+08, step = 6101 (0.213 sec)
INFO:tensorflow:global_step/sec: 474.962
INFO:tensorflow:loss = 2.10434e+08, step = 6201 (0.211 sec)
INFO:tensorflow:global_step/sec: 471.391
INFO:tensorflow:loss = 1.9858e+08, step = 6301 (0.212 sec)
INFO:tensorflow:global_step/sec: 455.808
INFO:tensorflow:loss = 3.40392e+08, step = 6401 (0.219 sec)
INFO:tensorflow:global_step/sec: 449.701
INFO:tensorflow:loss = 1.35302e+08, step = 6501 (0.223 sec)
INFO:tensorflow:global_step/sec: 447.52
INFO:tensorflow:loss = 2.45073e+08, step = 6601 (0.223 sec)
INFO:tensorflow:global_step/sec: 472.151
INFO:tensorflow:loss = 1.8786e+08, step = 6701 (0.212 sec)
INFO:tensorflow:global_step/sec: 486.783
INFO:tensorflow:loss = 2.59138e+08, step = 6801 (0.205 sec)
INFO:tensorflow:global_step/sec: 487.139
INFO:tensorflow:loss = 2.56774e+08, step = 6901 (0.205 sec)
INFO:tensorflow:global_step/sec: 480.202
INFO:tensorflow:loss = 2.22381e+08, step = 7001 (0.208 sec)
INFO:tensorflow:global_step/sec: 449.518
INFO:tensorflow:loss = 3.19742e+08, step = 7101 (0.222 sec)
INFO:tensorflow:global_step/sec: 458.642
INFO:tensorflow:loss = 1.45798e+08, step = 7201 (0.218 sec)
INFO:tensorflow:global_step/sec: 437.489
INFO:tensorflow:loss = 2.8065e+08, step = 7301 (0.229 sec)
INFO:tensorflow:global_step/sec: 433.284
INFO:tensorflow:loss = 3.20594e+08, step = 7401 (0.231 sec)
INFO:tensorflow:global_step/sec: 420.923
INFO:tensorflow:loss = 2.86083e+08, step = 7501 (0.238 sec)
INFO:tensorflow:global_step/sec: 452.777
INFO:tensorflow:loss = 3.02958e+08, step = 7601 (0.221 sec)
INFO:tensorflow:global_step/sec: 426.444
INFO:tensorflow:loss = 2.35591e+08, step = 7701 (0.234 sec)
INFO:tensorflow:global_step/sec: 414.848
INFO:tensorflow:loss = 2.33625e+08, step = 7801 (0.241 sec)
INFO:tensorflow:global_step/sec: 467.736
INFO:tensorflow:loss = 2.14244e+08, step = 7901 (0.214 sec)
INFO:tensorflow:global_step/sec: 470.138
INFO:tensorflow:loss = 2.29226e+08, step = 8001 (0.213 sec)
INFO:tensorflow:global_step/sec: 452.767
INFO:tensorflow:loss = 3.2403e+08, step = 8101 (0.222 sec)
INFO:tensorflow:global_step/sec: 463.772
INFO:tensorflow:loss = 2.40912e+08, step = 8201 (0.216 sec)
INFO:tensorflow:global_step/sec: 457.843
INFO:tensorflow:loss = 2.55732e+08, step = 8301 (0.218 sec)
INFO:tensorflow:global_step/sec: 446.67
INFO:tensorflow:loss = 2.01069e+08, step = 8401 (0.224 sec)
INFO:tensorflow:global_step/sec: 426.5
INFO:tensorflow:loss = 2.51314e+08, step = 8501 (0.235 sec)
INFO:tensorflow:global_step/sec: 466.806
INFO:tensorflow:loss = 2.33035e+08, step = 8601 (0.213 sec)
INFO:tensorflow:global_step/sec: 477.854
INFO:tensorflow:loss = 2.13737e+08, step = 8701 (0.209 sec)
INFO:tensorflow:global_step/sec: 462.588
INFO:tensorflow:loss = 2.20099e+08, step = 8801 (0.216 sec)
INFO:tensorflow:global_step/sec: 483.643
INFO:tensorflow:loss = 2.17736e+08, step = 8901 (0.207 sec)
INFO:tensorflow:global_step/sec: 487.195
INFO:tensorflow:loss = 3.29561e+08, step = 9001 (0.205 sec)
INFO:tensorflow:global_step/sec: 487.331
INFO:tensorflow:loss = 2.18982e+08, step = 9101 (0.205 sec)
INFO:tensorflow:global_step/sec: 477.163
INFO:tensorflow:loss = 2.73778e+08, step = 9201 (0.210 sec)
INFO:tensorflow:global_step/sec: 464.112
INFO:tensorflow:loss = 1.85688e+08, step = 9301 (0.216 sec)
INFO:tensorflow:global_step/sec: 481.984
INFO:tensorflow:loss = 2.32726e+08, step = 9401 (0.207 sec)
INFO:tensorflow:global_step/sec: 487.21
INFO:tensorflow:loss = 2.143e+08, step = 9501 (0.205 sec)
INFO:tensorflow:global_step/sec: 482.697
INFO:tensorflow:loss = 2.24054e+08, step = 9601 (0.207 sec)
INFO:tensorflow:global_step/sec: 467.808
INFO:tensorflow:loss = 3.07036e+08, step = 9701 (0.214 sec)
INFO:tensorflow:global_step/sec: 464.613
INFO:tensorflow:loss = 2.25359e+08, step = 9801 (0.215 sec)
INFO:tensorflow:global_step/sec: 486.992
INFO:tensorflow:loss = 2.78171e+08, step = 9901 (0.205 sec)
INFO:tensorflow:Saving checkpoints for 10000 into /tmp/output_dir/model.ckpt.
INFO:tensorflow:Loss for final step: 2.36605e+08.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:Rank of input Tensor (1) should be the same as output_rank (2) for column. Will attempt to expand dims. It is highly recommended that you resize your input, as this behavior may change.
WARNING:tensorflow:From /usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/estimators/head.py:625: scalar_summary (from tensorflow.python.ops.logging_ops) is deprecated and will be removed after 2016-11-30.
Instructions for updating:
Please switch to tf.summary.scalar. Note that tf.summary.scalar uses the node name instead of the tag. This means that TensorFlow will automatically de-duplicate summary names based on the scope they are created in. Also, passing a tensor or list of tags to a scalar summary op is no longer supported.
INFO:tensorflow:Starting evaluation at 2017-06-15-00:13:58
INFO:tensorflow:Restoring parameters from /tmp/output_dir/model.ckpt-10000
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:Finished evaluation at 2017-06-15-00:13:59
INFO:tensorflow:Saving dict for global step 10000: global_step = 10000, loss = 2.03137e+08
Out[83]:
({'global_step': 10000, 'loss': 2.0313659e+08}, [])