Skip to content

Instantly share code, notes, and snippets.

@z-a-f
Last active May 31, 2018 00:23
Show Gist options
  • Save z-a-f/6555f515d472a1af93960599ff5078cf to your computer and use it in GitHub Desktop.
Save z-a-f/6555f515d472a1af93960599ff5078cf to your computer and use it in GitHub Desktop.
import keras
# Get the data
(train_images, train_labels), (test_images, test_labels) = keras.datasets.mnist.load_data()
train_images = preprocess_images(train_images)
test_images = preprocess_images(test_images)
train_labels = preprocess_labels(train_labels)
test_labels = preprocess_labels(test_labels)
# Get the model
network = get_model()
# Fit the model
history = network.fit(train_images, train_labels, epochs=20, batch_size=128)
# Evaluate the model
test_loss, test_acc = network.evaluate(test_images, test_labels)
print 'test_acc:', test_acc
print 'test_loss:', test_loss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment