第12章最適化アルゴリズム
12.8.1. The Algorithm12.8.1 アルゴリズム
Let’s write out the equations in detail.
英語のヒント
式を詳しく書き出そう。
(12.8.1)
The constant is typically set to to ensure that we do not suffer from division by zero or overly large step sizes. Given this expansion we are now free to control the learning rate independently of the scaling that is applied on a per-coordinate basis. In terms of leaky averages we can apply the same reasoning as previously applied in the case of the momentum method. Expanding the definition of yields
英語のヒント
定数はふつうに設定され、ゼロでの割り算や大きすぎるステップの大きさに悩まされないようにする。この展開が与えられたので、いまや、座標ごとに当てはめられるスケーリングとは独立に、学習率を自由に制御できる。漏れのある平均については、前にモメンタム法の場合に当てはめたのと同じ推論を当てはめられる。の定義を展開すると、次が得られる。
(12.8.2)
As before in Section 12.6 we use . Hence the sum of weights is normalized to with a half-life time of an observation of . Let’s visualize the weights for the past 40 time steps for various choices of .
英語のヒント
12.6節で前にしたように、を使う。したがって、重みの和はに正規化され、観測の半減期はである。のさまざまな選び方について、過去40時間ステップの重みを可視化しよう。
import math
import torch
from d2l import torch as d2l
d2l.set_figsize()
gammas = [0.95, 0.9, 0.8, 0.7]
for gamma in gammas:
x = torch.arange(40).detach().numpy()
d2l.plt.plot(x, (1-gamma) * gamma ** x, label=f'gamma = {gamma:.2f}')
d2l.plt.xlabel('time');