プリンキピア

第12章最適化アルゴリズム

12.4.4. Stochastic Gradients and Finite Samples12.4.4 確率的な勾配と有限の標本

So far we have played a bit fast and loose when it comes to talking about stochastic gradient descent. We posited that we draw instances xi, typically with labels yi from some distribution p(x,y) and that we use this to update the model parameters in some manner. In particular, for a finite sample size we simply argued that the discrete distribution p(x,y)=1n∑i=1nδxi(x)δyi(y) for some functions δxi and δyi allows us to perform stochastic gradient descent over it.
英語のヒント
ここまで、確率的勾配降下法について話すとき、少しいいかげんだった。ある分布p(x,y)から、ふつうはラベルyiつきの事例xiを引き、それを使って何らかのやり方でモデルのパラメータを更新すると仮定した。特に、有限の標本の大きさについては、ある関数δxiとδyiによる離散分布p(x,y)=1n∑i=1nδxi(x)δyi(y)の上で確率的勾配降下法を行えると、単に論じた。
However, this is not really what we did. In the toy examples in the current section we simply added noise to an otherwise non-stochastic gradient, i.e., we pretended to have pairs (xi,yi). It turns out that this is justified here (see the exercises for a detailed discussion). More troubling is that in all previous discussions we clearly did not do this. Instead we iterated over all instances exactly once. To see why this is preferable consider the converse, namely that we are sampling n observations from the discrete distribution with replacement. The probability of choosing an element i at random is 1/n. Thus to choose it at least once is
英語のヒント
しかし、これは実際にやったことではない。この節のおもちゃの例では、本来は確率的でない勾配に単にノイズを加えた。つまり、組(xi,yi)があるふりをした。ここではこれが正当化されることがわかる(詳しい議論は練習問題を参照)。もっと困るのは、これまでのすべての議論で、明らかにこうしていなかったことである。代わりに、すべての事例をちょうど1回ずつ反復した。なぜこれが好ましいかを見るため、逆の場合、つまり離散分布からn個の観測を復元抽出する場合を考えよう。要素iをランダムに選ぶ確率は1/nである。したがって、それを少なくとも1回選ぶ確率は次のとおりである。
P(choose i)=1−P(omit i)=1−(1−1/n)n≈1−e−1≈0.63.(12.4.18)
A similar reasoning shows that the probability of picking some sample (i.e., training example) exactly once is given by
英語のヒント
同じような推論で、ある標本(つまり訓練事例)をちょうど1回選ぶ確率は次で与えられることがわかる。
(n1)1n(1−1n)n−1=nn−1(1−1n)n≈e−1≈0.37.(12.4.19)
Sampling with replacement leads to an increased variance and decreased data efficiency relative to sampling without replacement. Hence, in practice we perform the latter (and this is the default choice throughout this book). Last note that repeated passes through the training dataset traverse it in a different random order.
英語のヒント
復元抽出は、非復元抽出に比べて、分散を増やし、データの効率を下げる。したがって、実際には後者を行う(そして、これがこの本を通じてのデフォルトの選択である)。最後に、訓練データセットを繰り返し通るときは、毎回違うランダムな順序でたどることに注意してほしい。