liveBook · Manning

Training dataset

As explained in Deep Learning with Python, Third Edition

The subset of data used to fit a model's parameters from examples, here emphasized as being small in size.

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

How Deep Learning with Python, Third Edition covers it

How deep it goes
Explains batching, epochs, preprocessing, leakage prevention, and validation roles, but does not derive dataset-size selection.
Examples
Uses MNIST images and IMDb reviews, including their preprocessing, labels, dataset sizes, and Keras loading examples.
What it assumes
Assumes labeled input examples and a prediction task, while introducing vectorization, normalization, and validation splitting.
What you can do after
Apply it via Keras by preprocessing examples, separating evaluation data, and fitting a model with mini-batch training.
How it connects
Connects training datasets to model weights, loss functions, optimizers, validation sets, test sets, and overfitting.

Also explained in

Compare how 36 books explain training dataset →

Related concepts

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