liveBook · Manning

Objective function

As explained in Designing Deep Learning Systems: A guide for software engineers

A function that maps hyperparameter settings and their resulting training outcomes to a scalar value to be minimized or maximized.

An objective function is the callable at the center of a hyperparameter optimization (HPO) trial. It receives suggested hyperparameters, trains a model with them, evaluates the completed model, and returns a numeric score for the HPO algorithm to minimize or maximize. section 5.4

An HPO workflow uses the objective function to:

  • Read candidate hyperparameters from the library’s trial, args, or config object. section 5.4.1 section 5.4.2
  • Run model training and evaluation for the selected configuration. section 5.4
  • Return the evaluation value so the search algorithm can select later candidates. section 5.3.2
  • Report intermediate metrics when the execution framework supports trial monitoring or early stopping. section 5.4.3

Hyperopt classifier search

Define objective(args) as a wrapper around train(args) and evaluate(model). Pair it with a search space containing naive Bayes, SVM, and decision-tree alternatives, then let TPE run up to ten trials to optimize model accuracy. section 5.4.1

Figure 5.11 An objective function receives the hyperparameters as input and returns a score.

Use the workflow diagram to trace hyperparameters into training and evaluation, then follow the returned score back into optimization. section 5.4

How Designing Deep Learning Systems: A guide for software engineers covers it

How deep it goes
Explains inputs, training, evaluation, returned scores, and metric reporting, but defers detailed optimization algorithms.
Examples
Uses Hyperopt classifier selection, Optuna regressors, and Ray Tune convolutional-network accuracy reporting.
What it assumes
Assumes model training and evaluation code, while introducing how libraries supply hyperparameters and consume objective scores.
What you can do after
Build it from scratch: wrap training and evaluation in a callable accepted by Hyperopt, Optuna, or Ray Tune.
How it connects
Connects hyperparameter optimization, search spaces, model training, model evaluation, trial history, and early stopping.

Also explained in

Compare how 30 books explain objective function →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Designing Deep Learning Systems: A guide for software engineers. The section links point to the parts of the book it draws on.