liveBook · Manning

Optuna

As explained in Inside Deep Learning: Math, Algorithms, Models

A hyperparameter-optimization library that searches parameter spaces by running trials and using a model to guide new suggestions.

Optuna tunes neural-network hyperparameters when gradient descent cannot choose them directly, such as learning rate, momentum, layer count, and hidden-unit counts. It replaces costly grid-search combinations with sequential trials guided by a learned model and an available compute budget. section 5.4 section 5.4.1

A practical Optuna workflow is:

  • Define an objective function that accepts a trial, requests parameter guesses with trial.suggest functions, trains or evaluates a model, and returns one numeric score to minimize or maximize. section 5.4.1
  • Create a study with the desired direction and call study.optimize with a trial count; Optuna uses each result to improve later guesses. section 5.4.1
  • Inspect study.best_params or visualize the search, then retrain a model using the selected hyperparameters and evaluate it on held-out data. section 5.5

A toy minimization problem

For f(x, y) = abs((x − 3)(y + 2)), the objective samples x and y over supplied ranges and returns the function value. After 100 trials, the reported best parameters approach x = 3 and y = −2, illustrating how trial results guide subsequent guesses. section 5.4.1

How Inside Deep Learning: Math, Algorithms, Models covers it

How deep it goes
Explains objective functions, bounded suggestions, studies, trials, and best-parameter retrieval, but defers Optuna’s technical internals.
Examples
Uses a two-variable toy function, trial logs, best-parameter output, contour visualization, and a FashionMNIST neural-network exercise.
What it assumes
Assumes familiarity with neural-network training and hyperparameters while teaching the Optuna interface from the objective function onward.
What you can do after
Apply Optuna by writing an objective, running trials, retrieving parameters, and evaluating a retrained neural network.
How it connects
Connects hyperparameter optimization with grid search, Bayesian methods, stochastic gradient descent, learning-rate schedules, and neural-network architectures.

Also explained in

Compare how 3 books explain Optuna →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Inside Deep Learning: Math, Algorithms, Models. The section links point to the parts of the book it draws on.