Due to its ability to reconstruct images, RBM can be used to generate more data from the existing data. We can see the original and reconstructed MNIST images by making a small helper plotting code:
row, col = 2, 8
idx = np.random.randint(0, 100, row * col // 2)
f, axarr = plt.subplots(row, col, sharex=True, sharey=True, figsize=(20,4))
for fig, row in zip([Xtest_noisy,out], axarr):
for i,ax in zip(idx,row):
ax.imshow(fig[i].reshape((28, 28)), cmap='Greys_r')
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
We get the result as follows:
![](http://images-20200215.ebookreading.net/16/3/3/9781788293594/9781788293594__tensorflow-1x-deep__9781788293594__assets__ceafa00a-4ca3-442a-8258-6a45a8494ef7.png)