Basic autoencoder plot of weights

Once the training is done show the plot of weights using the Matplotlib library using code listing:

print("Total cost: " + str(autoencoder.calc_total_cost(X_test)))wts = autoencoder.getWeights()dim = math.ceil(math.sqrt(autoencoder.n_hidden))plt.figure(1, figsize=(dim, dim))for i in range(0, autoencoder.n_hidden):    im = wts.flatten()[i::autoencoder.n_hidden].reshape((28, 28))    ax = plt.subplot(dim, dim, i + 1)    for label in (ax.get_xticklabels() + ax.get_yticklabels()):        label.set_fontname('Arial')        label.set_fontsize(8)    # plt.title('Feature Weights ' + str(i))    plt.imshow(im, cmap="gray", clim=(-1.0, 1.0))plt.suptitle('Basic AutoEncoder Weights', fontsize=15, y=0.95)#plt.title("Test Title", y=1.05)plt.savefig( ...

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.