The MNIST dataset contains labeled images of handwritten digits. Each image is a 28-by-28 matrix of integer pixel values from 0 to 255; zero represents white and 255 represents dark. Although digit recognition is classification, the numeric labels can also serve as continuous regression targets. section 13.1
A practical MNIST workflow represents and prepares the data as follows:
- Load the images with PyTorch and torchvision, convert them to tensors, and normalize pixel values using mean 0.1307 and standard deviation 0.3081. section 13.2.2 section 13.2.4
- Flatten each 28-by-28 image into 784 features while retaining its digit label as the target. section 13.2.2 section 13.2.4
- Train and test a Gaussian process by selecting 1,000 training images and 500 test images, then evaluate mean absolute prediction error. section 13.2.4
Figure 13.2 A data point from the MNIST dataset, which is an image with 28 rows and 28 columns of pixels, represented as a PyTorch tensor
Inspect a representative digit as both a 28-by-28 image and a PyTorch tensor of pixel values. section 13.1 section 13.2.2




