Slide 86
Slide 86 text
Confidential & Proprietary
Define our input function
def my_input_fn(file_path, repeat_count):
def decode_csv(line):
features = tf.decode_csv(line, [[0.],[0.],[0.],[0.],[0.],[0.],[0.],[0.]])
label = features[-1:]
del features[-1]
return dict(zip(feature_names, features)), label
dataset = (tf.data.TextLineDataset(file_path)
.map(decode_csv)
.shuffle(buffer_size=256)
.repeat(repeat_count)
.batch(8))
iterator = dataset.make_one_shot_iterator()
batch_features, batch_labels = iterator.get_next()
return batch_features, batch_labels
@SRobTweets