第5章多層パーセプトロン
5.4. Numerical Stability and Initialization5.4 数値の安定性と初期化
Thus far, every model that we have implemented required that we initialize its parameters according to some pre-specified distribution. Until now, we took the initialization scheme for granted, glossing over the details of how these choices are made. You might have even gotten the impression that these choices are not especially important. On the contrary, the choice of initialization scheme plays a significant role in neural network learning, and it can be crucial for maintaining numerical stability. Moreover, these choices can be tied up in interesting ways with the choice of the nonlinear activation function. Which function we choose and how we initialize parameters can determine how quickly our optimization algorithm converges. Poor choices here can cause us to encounter exploding or vanishing gradients while training. In this section, we delve into these topics in greater detail and discuss some useful heuristics that you will find useful throughout your career in deep learning.
英語のヒント
これまで実装してきたどのモデルでも、あらかじめ指定した何らかの分布に従ってパラメータを初期化する必要があった。今までは、初期化のやり方を当然のものとして受け入れ、その選び方の細部は素通りしてきた。こうした選択はそれほど重要ではない、という印象さえもったかもしれない。それどころか、初期化のやり方の選択はニューラルネットワークの学習で大きな役割を果たし、数値の安定性を保つうえで決定的に重要になりうる。さらに、こうした選択は、非線形の活性化関数の選択と興味深い形で結びつきうる。どの関数を選び、パラメータをどう初期化するかによって、最適化アルゴリズムがどれだけ速く収束するかが決まりうる。ここでまずい選択をすると、訓練中に勾配の爆発や消失に出くわすことがある。この節では、これらの話題をもっと詳しく掘り下げ、深層学習の仕事全体を通じて役に立つ、いくつかの有用な経験則を論じる。
%matplotlib inline
import torch
from d2l import torch as d2l