Preparing the dataset

Load the MNIST dataset:

(x_train, _), (x_test, _) = mnist.load_data()

Normalize the dataset:

x_train = x_train.astype('float32') / 255.
x_test = x_test.astype('float32') / 255.

Reshape the dataset:

x_train = x_train.reshape((len(x_train), np.prod(x_train.shape[1:])))
x_test = x_test.reshape((len(x_test), np.prod(x_test.shape[1:])))

Now let's define some important parameters:

batch_size = 100
original_dim = 784
latent_dim = 2
intermediate_dim = 256
epochs = 50
epsilon_std = 1.0
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset