liveBook · Manning

MNIST dataset

As explained in Deep Learning with R, Third Edition

MNIST is a dataset of grayscale 28-by-28 pixel images of handwritten digits labeled from 0 through 9.

MNIST contains grayscale 28 × 28 images of handwritten digits labeled from 0 through 9. It provides 60,000 training images and 10,000 test images for classification. section 2.1

The dataset is organized into four corresponding arrays:

  • train_images and train_labels provide images and digit labels for learning. section 2.1
  • test_images and test_labels provide held-out images and labels for evaluation. section 2.1
  • Images are stored as arrays, while labels identify classes from 0 through 9. section 2.1

Load MNIST in Keras

library(keras3) [[train_images, train_labels], [test_images, test_labels]] <- dataset_mnist() section 2.1

Listing 2.1 Loading the MNIST dataset in Keras
library(keras3)
.[.[train_images, train_labels], .[test_images, test_labels]] <-
  dataset_mnist()

Inspect the runnable R/Keras loading example and connect each returned array to the training and test workflow. section 2.1

How Deep Learning with R, Third Edition covers it

How deep it goes
Defines image dimensions, class labels, array organization, and train-test roles, while deferring detailed model mechanics.
Examples
Uses Keras array loading, sample digit images, array structures, and corresponding training and test labels.
What it assumes
Introduces the dataset and workflow without requiring prior Keras experience.
What you can do after
Operate Keras to load MNIST arrays for training a handwritten-digit classifier and evaluating predictions.
How it connects
Connects images and labels with classification, neural networks, training sets, test sets, samples, and classes.

Also explained in

Compare how 5 books explain MNIST dataset →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.