1 MNIST Dataset

MNIST is a widely known dataset in machine learning area. It consists of 70K small images (resoution 28x28, 60K for training, and 10K for testing) of handwritten digits 0~9 by high school students and employees of the US Census Bureau.

We may load MNIST dataset from R:Keras and display the images using the following codes.

mnist <- dataset_mnist()
train_images <- mnist$train$x
train_labels <- mnist$train$y
par(mfrow=c(10,6), mar=rep(1,4))
for (i in seq(0,9)) {
  idx = which(train_labels == i)
  for (j in sample(length(idx), 6))
  plot(as.raster(train_images[idx[j],,], max = 255))