Using Optuna for hyperparameter search
Optuna is one of the hyperparameter search tools that supports PyTorch. You can read in detail about the search strategies used by the tool, such as TPE (Tree-Structured Parzen Estimation) and CMA-ES (Covariance Matrix Adaptation Evolution Strategy) in the Optuna paper, at https://arxiv.org/pdf/1907.10902.pdf. Besides the advanced hyperparameter search methodologies, the tool provides a sleek API, which we will explore in a moment.
Tool citation
Optuna: A Next-Generation Hyperparameter Optimization Framework.
Takuya Akiba, Shotaro Sano, Toshihiko Yanase, Takeru Ohta, and Masanori Koyama (2019, in KDD).
In this section, we will once again build and train the MNIST
model, this time using Optuna to figure out the optimal hyperparameter setting. We will discuss important parts of the code step by step, in the form of an exercise. The full code can be found here:
https://github.com/PacktPublishing/Mastering-PyTorch/blob/master/Chapter12...