In this section, we will build a VAE model so that we can reconstruct fashion MNIST images. Let's start by defining the network parameters of our VAE:
- First, we need to define some variables that will set the network parameters, batch size, input dimension, latent dimension, and the number of epochs:
# network parametersbatch_size <- 100Linput_dim <- 784L
latent_dim <- 2Lepochs <- 10
- Let's define the input layer and the hidden layer of the encoder part of the VAE:
# VAE input layer and hidden layer encoderinput <- layer_input(shape = c(input_dim))x <- input %>% layer_dense(units = 256, activation = "relu")
- Now, we configure the dense layers that represent the mean and log of the standard deviation of the latent distribution: ...