liveBook · Manning

Hyperparameter tuning

As explained in Distributed Machine Learning Patterns

Hyperparameter tuning is the process of selecting hyperparameter values by evaluating models trained with different configurations.

Hyperparameter tuning selects configuration values by training and evaluating models across alternatives. With TensorFlow and Keras Tuner, a model-building function exposes tunable parameters such as layer width and learning rate. section 8.1.1

A practical tuning workflow:

  • Define search ranges, such as 32–512 dense-layer units and Adam learning rates of 0.01, 0.001, or 0.0001. section 8.1.1
  • Select a strategy such as Hyperband, which combines adaptive resource allocation with early stopping. section 8.1.1
  • Search against validation accuracy, stop unpromising training with validation-loss patience, then rebuild and train the best model. section 8.1.1

MNIST with Keras Tuner

A TensorFlow/Keras model tunes its first dense layer and Adam learning rate over MNIST, searches with Hyperband, and evaluates the resulting model on test data. section 8.1.1

Listing 8.16 The Hyperband model tuner
tuner = kt.Hyperband(model_builder,
                    objective='val_accuracy',
                    max_epochs=10,
                    factor=3,
                    directory='my_dir',
                    project_name='intro_to_kt')

Inspect the Hyperband tuner configuration, including the validation objective, epoch limit, search factor, and output directory. section 8.1.1

How Distributed Machine Learning Patterns covers it

How deep it goes
Explains search spaces, Hyperband, validation objectives, early stopping, and final retraining without detailing tuner internals.
Examples
Uses an MNIST dense neural network with tunable layer units and Adam learning rates.
What it assumes
Assumes basic TensorFlow/Keras model training and introduces tuning through a model builder and tuner.
What you can do after
Apply it via Keras Tuner to search configurations, retrieve the best hyperparameters, retrain, and evaluate a model.
How it connects
Connects model training with validation accuracy, learning rate, early stopping, Hyperband, and test evaluation.

Also explained in

Compare how 18 books explain hyperparameter tuning →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Distributed Machine Learning Patterns. The section links point to the parts of the book it draws on.