Plotting the weights

Let's plot the weights visually and plot them using Matplotlib:

wts = autoencoder.get_weights()dim = math.ceil(math.sqrt(autoencoder.num_hidden))plt.figure(1, figsize=(dim, dim))for i in range(0, autoencoder.num_hidden):    im = wts.flatten()[i::autoencoder.num_hidden].reshape((28, 28))    ax = plt.subplot(dim, dim, i + 1)    for label in (ax.get_xticklabels() + ax.get_yticklabels()):        label.set_fontsize(8)    #plt.title('Feature Weights ' + str(i))    plt.imshow(im, cmap="gray", clim=(-1.0, 1.0))plt.suptitle('Additive Gaussian Noise AutoEncoder Weights', fontsize=15, y=0.95)plt.savefig('figures/additive_gaussian_weights.png')plt.show()
Weights of the neurons in hidden layers for the Additive Gaussian Auto Encoder

Get Neural Network Programming with TensorFlow now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.