プリンキピア

第19章ハイパーパラメータ最適化

19.4. Multi-Fidelity Hyperparameter Optimization19.4 マルチフィデリティのハイパーパラメータ最適化

Training neural networks can be expensive even on moderate size datasets. Depending on the configuration space (Section 19.1.1.2), hyperparameter optimization requires tens to hundreds of function evaluations to find a well-performing hyperparameter configuration. As we have seen in Section 19.3, we can significantly speed up the overall wall-clock time of HPO by exploiting parallel resources, but this does not reduce the total amount of compute required.
英語のヒント
ニューラルネットワークの訓練は、中程度の大きさのデータセットでも高くつきうる。設定空間(19.1.1.2節)によっては、ハイパーパラメータ最適化は、性能のよいハイパーパラメータの設定を見つけるのに数十から数百回の関数評価を必要とする。19.3節で見たように、並列の資源を利用すればHPOの全体の実時間を大幅に短縮できるが、それで必要な総計算量が減るわけではない。
In this section, we will show how the evaluation of hyperparameter configurations can be sped up. Methods such as random search allocate the same amount of resources (e.g., number of epochs, training data points) to each hyperparameter evaluation. Fig. 19.4.1 depicts learning curves of a set of neural networks trained with different hyperparameter configurations. After a few epochs we are already able to visually distinguish between well-performing and suboptimal configurations. However, the learning curves are noisy, and we might still require the full amount of 100 epochs to identify the best performing one.
英語のヒント
この節では、ハイパーパラメータの設定の評価をどう速められるかを示す。ランダム探索のような方法は、各ハイパーパラメータの評価に同じ量の資源(たとえばエポック数や訓練データ点)を割り当てる。図19.4.1は、異なるハイパーパラメータの設定で訓練した一組のニューラルネットワークの学習曲線を描いている。数エポックの後には、性能のよい設定と最適でない設定をすでに目で区別できる。しかし、学習曲線はノイズを含んでおり、最も性能のよいものを見つけるには、やはり100エポックをまるごと必要とするかもしれない。
Fig. 19.4.1図19.4.1
Learning curves of random hyperparameter configurations
英語のヒント
ランダムなハイパーパラメータの設定の学習曲線
Multi-fidelity hyperparameter optimization allocates more resources to promising configurations and stop evaluations of poorly performing ones early. This speeds up the optimization process, since we can try a larger number of configurations for the same total amount of resources.
英語のヒント
マルチフィデリティのハイパーパラメータ最適化は、有望な設定により多くの資源を割り当て、性能の悪い設定の評価は早めに止める。同じ総量の資源でより多くの設定を試せるので、これは最適化の過程を速める。
More formally, we expand our definition in Section 19.1.1, such that our objective function f(𝐱,r) gets an additional input r∈[rmin,rmax], specifying the amount of resources that we are willing to spend for the evaluation of configuration 𝐱. We assume that the error f(𝐱,r) decreases with r, whereas the computational cost c(𝐱,r) increases. Typically, r represents the number of epochs for training the neural network, but it could also be the training subset size or the number of cross-validation folds.
英語のヒント
もっと形式的には、19.1.1節の定義を拡張して、目的関数f(𝐱,r)が追加の入力r∈[rmin,rmax]をとるようにする。これは、設定𝐱の評価に費やしてよい資源の量を指定する。誤差f(𝐱,r)はrとともに減り、一方で計算のコストc(𝐱,r)は増えると仮定する。ふつう、rはニューラルネットワークを訓練するエポック数を表すが、訓練の部分集合の大きさや、交差検証の分割数でもよい。
from collections import defaultdict
import numpy as np
from scipy import stats
from d2l import torch as d2l

d2l.set_figsize()