プリンキピア

第22章付録:深層学習のための数学

22.4.2. Geometry of Gradients and Gradient Descent22.4.2 勾配の幾何学と勾配降下法

Consider the expression from (22.4.5) again:
英語のヒント
式(22.4.5)の表現をもう一度考えよう。
L(𝐰+𝝐)≈L(𝐰)+𝝐⋅∇𝐰L(𝐰).(22.4.9)
Let’s suppose that I want to use this to help minimize our loss L. Let’s understand geometrically the algorithm of gradient descent first described in Section 2.5. What we will do is the following:
英語のヒント
これを使って損失Lを最小化したいとしよう。2.5節で最初に述べた勾配降下法のアルゴリズムを、幾何学的に理解しよう。行うのは次のことである。
  1. Start with a random choice for the initial parameters 𝐰.
    英語のヒント
    初期パラメータ𝐰をランダムに選ぶことから始める。
  2. Find the direction 𝐯 that makes L decrease the most rapidly at 𝐰.
    英語のヒント
    𝐰でLを最も速く減らす方向𝐯を見つける。
  3. Take a small step in that direction: 𝐰→𝐰+ϵ𝐯.
    英語のヒント
    その方向に小さな一歩を進める。𝐰→𝐰+ϵ𝐯。
  4. Repeat.
    英語のヒント
    繰り返す。
The only thing we do not know exactly how to do is to compute the vector 𝐯 in the second step. We will call such a direction the direction of steepest descent. Using the geometric understanding of dot products from Section 22.1, we see that we can rewrite (22.4.5) as
英語のヒント
正確にどうすればよいかがわからない唯一のことは、2番目の手順でのベクトル𝐯の計算である。このような方向を最急降下の方向と呼ぶ。22.1節の内積の幾何学的な理解を使うと、式(22.4.5)を次のように書き直せることがわかる。
L(𝐰+𝐯)≈L(𝐰)+𝐯⋅∇𝐰L(𝐰)=L(𝐰)+∥∇𝐰L(𝐰)∥cos⁡(θ).(22.4.10)
Note that we have taken our direction to have length one for convenience, and used θ for the angle between 𝐯 and ∇𝐰L(𝐰). If we want to find the direction that decreases L as rapidly as possible, we want to make this expression as negative as possible. The only way the direction we pick enters into this equation is through cos⁡(θ), and thus we wish to make this cosine as negative as possible. Now, recalling the shape of cosine, we can make this as negative as possible by making cos⁡(θ)=−1 or equivalently making the angle between the gradient and our chosen direction to be π radians, or equivalently 180 degrees. The only way to achieve this is to head in the exact opposite direction: pick 𝐯 to point in the exact opposite direction to ∇𝐰L(𝐰)!
英語のヒント
便宜のため方向の長さを1にとり、𝐯と∇𝐰L(𝐰)の間の角度にθを使ったことに注意しよう。Lをできるだけ速く減らす方向を見つけたいなら、この式をできるだけ負にしたい。選ぶ方向がこの式に入ってくるのはcos⁡(θ)を通してだけなので、このコサインをできるだけ負にしたい。ここで、コサインの形を思い出すと、cos⁡(θ)=−1とすること、あるいは同じことだが、勾配と選んだ方向の間の角度をπラジアン、つまり180度にすることで、これをできるだけ負にできる。これを実現する唯一の方法は、ちょうど反対の方向に向かうことである。𝐯を、∇𝐰L(𝐰)とちょうど反対の方向を向くように選ぶのである。
This brings us to one of the most important mathematical concepts in machine learning: the direction of steepest decent points in the direction of −∇𝐰L(𝐰). Thus our informal algorithm can be rewritten as follows.
英語のヒント
これにより、機械学習で最も重要な数学的概念の一つにたどり着く。最急降下の方向は−∇𝐰L(𝐰)の方向を向く。したがって、非形式的なアルゴリズムは次のように書き直せる。
  1. Start with a random choice for the initial parameters 𝐰.
    英語のヒント
    初期パラメータ𝐰をランダムに選ぶことから始める。
  2. Compute ∇𝐰L(𝐰).
    英語のヒント
    ∇𝐰L(𝐰)を計算する。
  3. Take a small step in the opposite of that direction: 𝐰←𝐰−ϵ∇𝐰L(𝐰).
    英語のヒント
    その方向と反対に小さな一歩を進める。𝐰←𝐰−ϵ∇𝐰L(𝐰)。
  4. Repeat.
    英語のヒント
    繰り返す。
This basic algorithm has been modified and adapted many ways by many researchers, but the core concept remains the same in all of them. Use the gradient to find the direction that decreases the loss as rapidly as possible, and update the parameters to take a step in that direction.
英語のヒント
この基本的なアルゴリズムは多くの研究者によってさまざまに修正・改良されてきたが、中核の概念はどれでも同じままである。勾配を使って損失をできるだけ速く減らす方向を見つけ、その方向に一歩進むようにパラメータを更新するのである。