A training dataset is the subset of labeled examples used to fit a model’s parameters. The model processes it in batches, compares predictions with targets, and updates weights to reduce loss. section 2.5 section 20.1.1
MNIST as a training dataset
The MNIST example stores 60,000 flattened, normalized images as training data and 10,000 as test data. A two-layer model fits its weights by processing the training images in batches of 128 for five epochs. section 2.5
IMDb sentiment training data
The IMDb dataset assigns 25,000 reviews to training and 25,000 to testing, with balanced positive and negative labels. Restricting input to the 10,000 most frequent training words keeps the vector representation manageable. section 4.1.1
Use the training dataset within a disciplined workflow:
- Define separate training, validation, and test sets, keeping validation and test labels from leaking into training data. section 20.1.5
- Vectorize and preprocess training examples before presenting them to a neural network. section 20.1.5
- Use training performance to fit weights, but make architecture and hyperparameter decisions from validation performance rather than training or test performance. section 2.5 section 20.1.5
(train_images, train_labels), (test_images, test_labels) = mnist.load_data() train_images = train_images.reshape((60000, 28 * 28)) train_images = train_images.astype("float32") / 255 test_images = test_images.reshape((10000, 28 * 28)) test_images = test_images.astype("float32") / 255
Inspect the concrete NumPy preprocessing used to reshape and normalize training images before fitting. section 2.5



































