Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created February 3, 2018 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NMZivkovic/c428e674d9d10b618080b3d8c15fbbc4 to your computer and use it in GitHub Desktop.
Save NMZivkovic/c428e674d9d10b618080b3d8c15fbbc4 to your computer and use it in GitHub Desktop.
# Define evaluation function
def evaluation_function(attributes, classes, batch_size):
attributes=dict(attributes)
if classes is None:
inputs = attributes
else:
inputs = (attributes, classes)
dataset = tf.data.Dataset.from_tensor_slices(inputs)
assert batch_size is not None, "batch_size must not be None"
dataset = dataset.batch(batch_size)
return dataset.make_one_shot_iterator().get_next()
# Evaluate the model.
eval_result = classifier.evaluate(
input_fn=lambda:evaluation_function(test_x, test_y, 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment