In Chapter 1 the MNIST dataset is discussed and the associated classification problem. The dataset contain 60,000 images of handwritten digits 0 - 9. The data is originally in a tensor of 28x28*60,000. The data is converted to a matrix that 28x28 columns and 60,000 rows. Each column is a pixel in the 28x28 image. The values are on a grey scale from 0 - 255. The data is normalized to values between 0 and 1.
What does the Neural Network look like?
> network <- keras_model_sequential() %>%
> layer_dense(units = 512, activation = "relu", input_shape =
c(28 * 28)) %>%
> layer_dense(units = 10, activation = "softmax")
Try a deeper Neural Network and add dropout layers. Does the model fit better?
> network <- keras_model_sequential() %>%
> layer_dense(units = 512, activation = "relu",
input_shape = c(28 * 28)) %>%
> layer_dropout(rate = 0.4) %>%
> layer_dense(units = 128, activation = "relu") %>%
> layer_dropout(rate = 0.3) %>%
> layer_dense(units = 10, activation = "softmax")