Last active
November 12, 2018 20:14
-
-
Save yoel-zeldes/bbce71abdc6e9aff772c15b3c1182783 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plot_samples(samples): | |
IMAGE_WIDTH = 0.7 | |
plt.figure(figsize=(IMAGE_WIDTH * num_digits, | |
len(samples) * IMAGE_WIDTH)) | |
for epoch, images in enumerate(samples): | |
for digit, image in enumerate(images): | |
plt.subplot(len(samples), | |
num_digits, | |
epoch * num_digits + digit + 1) | |
plt.imshow(image.reshape((28, 28)), | |
cmap='Greys_r') | |
plt.gca().xaxis.set_visible(False) | |
if digit == 0: | |
plt.gca().yaxis.set_ticks([]) | |
plt.ylabel('epoch {}'.format(epoch + 1), | |
verticalalignment='center', | |
horizontalalignment='right', | |
rotation=0, | |
fontsize=14) | |
else: | |
plt.gca().yaxis.set_visible(False) | |
plot_samples(samples) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment