プリンキピア

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

12.7.2. Preconditioning12.7.2 前条件づけ

Convex optimization problems are good for analyzing the characteristics of algorithms. After all, for most nonconvex problems it is difficult to derive meaningful theoretical guarantees, but intuition and insight often carry over. Let’s look at the problem of minimizing f(𝐱)=12𝐱⊤𝐐𝐱+𝐜⊤𝐱+b.
英語のヒント
凸最適化問題は、アルゴリズムの特徴を解析するのに向いている。結局のところ、ほとんどの非凸の問題では、意味のある理論的な保証を導くのは難しいが、直観と洞察はしばしば引き継がれる。f(𝐱)=12𝐱⊤𝐐𝐱+𝐜⊤𝐱+bを最小化する問題を見よう。
As we saw in Section 12.6, it is possible to rewrite this problem in terms of its eigendecomposition 𝐐=𝐔⊤𝚲𝐔 to arrive at a much simplified problem where each coordinate can be solved individually:
英語のヒント
12.6節で見たように、この問題をその固有値分解𝐐=𝐔⊤𝚲𝐔で書き直すと、各座標を個別に解ける、ずっと簡単な問題にたどり着ける。
f(𝐱)=f¯(𝐱¯)=12𝐱¯⊤𝚲𝐱¯+𝐜¯⊤𝐱¯+b.(12.7.1)
Here we used 𝐱¯=𝐔𝐱 and consequently 𝐜¯=𝐔𝐜. The modified problem has as its minimizer 𝐱¯=−𝚲−1𝐜¯ and minimum value −12𝐜¯⊤𝚲−1𝐜¯+b. This is much easier to compute since 𝚲 is a diagonal matrix containing the eigenvalues of 𝐐.
英語のヒント
ここで𝐱¯=𝐔𝐱とし、したがって𝐜¯=𝐔𝐜とした。変更した問題は、最小化点𝐱¯=−𝚲−1𝐜¯と最小値−12𝐜¯⊤𝚲−1𝐜¯+bをもつ。𝚲は𝐐の固有値を含む対角行列なので、これはずっと計算しやすい。
If we perturb 𝐜 slightly we would hope to find only slight changes in the minimizer of f. Unfortunately this is not the case. While slight changes in 𝐜 lead to equally slight changes in 𝐜¯, this is not the case for the minimizer of f (and of f¯ respectively). Whenever the eigenvalues 𝚲i are large we will see only small changes in x¯i and in the minimum of f¯. Conversely, for small 𝚲i changes in x¯i can be dramatic. The ratio between the largest and the smallest eigenvalue is called the condition number of an optimization problem.
英語のヒント
𝐜を少しかき乱したら、fの最小化点にもわずかな変化しか見られないことを期待したい。残念ながら、そうはならない。𝐜のわずかな変化は𝐜¯に同じくらいわずかな変化しか生まないが、fの(そしてそれぞれf¯の)最小化点についてはそうではない。固有値𝚲iが大きいときはいつでも、x¯iとf¯の最小値には小さな変化しか見られない。逆に、𝚲iが小さいと、x¯iの変化は劇的になりうる。最大の固有値と最小の固有値の比を、最適化問題の条件数と呼ぶ。
κ=𝚲1𝚲d.(12.7.2)
If the condition number κ is large, it is difficult to solve the optimization problem accurately. We need to ensure that we are careful in getting a large dynamic range of values right. Our analysis leads to an obvious, albeit somewhat naive question: couldn’t we simply “fix” the problem by distorting the space such that all eigenvalues are 1. In theory this is quite easy: we only need the eigenvalues and eigenvectors of 𝐐 to rescale the problem from 𝐱 to one in 𝐳=def𝚲12𝐔𝐱. In the new coordinate system 𝐱⊤𝐐𝐱 could be simplified to ∥𝐳∥2. Alas, this is a rather impractical suggestion. Computing eigenvalues and eigenvectors is in general much more expensive than solving the actual problem.
英語のヒント
条件数κが大きいと、最適化問題を正確に解くのは難しい。値の大きなダイナミックレンジを正しく扱うよう気をつける必要がある。この解析から、明らかな、少し素朴ではあるが、次の問いが生まれる。すべての固有値が1になるように空間をゆがめて、問題を単に「直す」ことはできないだろうか。理論的には、これはとても簡単である。𝐐の固有値と固有ベクトルさえあれば、問題を𝐱から𝐳=def𝚲12𝐔𝐱での問題へと再スケールできる。新しい座標系では、𝐱⊤𝐐𝐱は∥𝐳∥2に簡単にできる。残念ながら、これはかなり実用的でない提案である。固有値と固有ベクトルを計算するのは、一般に実際の問題を解くよりずっと高くつく。
While computing eigenvalues exactly might be expensive, guessing them and computing them even somewhat approximately may already be a lot better than not doing anything at all. In particular, we could use the diagonal entries of 𝐐 and rescale it accordingly. This is much cheaper than computing eigenvalues.
英語のヒント
固有値を厳密に計算するのは高くつくかもしれないが、それを推測し、多少なりとも近似的に計算するだけでも、何もしないよりずっとよいかもしれない。特に、𝐐の対角成分を使い、それに応じて再スケールできる。これは固有値を計算するよりずっと安い。
𝐐˜=diag−12(𝐐)𝐐diag−12(𝐐).(12.7.3)
In this case we have 𝐐˜ij=𝐐ij/𝐐ii𝐐jj and specifically 𝐐˜ii=1 for all i. In most cases this simplifies the condition number considerably. For instance, the cases we discussed previously, this would entirely eliminate the problem at hand since the problem is axis aligned.
英語のヒント
この場合、𝐐˜ij=𝐐ij/𝐐ii𝐐jjとなり、特にすべてのiについて𝐐˜ii=1となる。ほとんどの場合、これで条件数がかなり簡単になる。たとえば、前に論じた場合では、問題が軸にそろっているので、これで目の前の問題が完全に取り除かれる。
Unfortunately we face yet another problem: in deep learning we typically do not even have access to the second derivative of the objective function: for 𝐱∈ℝd the second derivative even on a minibatch may require 𝒪(d2) space and work to compute, thus making it practically infeasible. The ingenious idea of Adagrad is to use a proxy for that elusive diagonal of the Hessian that is both relatively cheap to compute and effective—the magnitude of the gradient itself.
英語のヒント
残念ながら、さらに別の問題に直面する。深層学習では、ふつう目的関数の2階導関数にアクセスすることさえできない。𝐱∈ℝdでは、ミニバッチについてでさえ、2階導関数を計算するのに𝒪(d2)の空間と作業が要るかもしれず、実際上不可能になる。Adagradの独創的な考えは、とらえにくいヘッセ行列の対角成分の代わりに、計算が比較的安く、しかも効果的な代用品、つまり勾配そのものの大きさを使うことである。
In order to see why this works, let’s look at f¯(𝐱¯). We have that
英語のヒント
なぜこれがうまくいくかを見るため、f¯(𝐱¯)を見よう。次が成り立つ。
∂𝐱¯f¯(𝐱¯)=𝚲𝐱¯+𝐜¯=𝚲(𝐱¯−𝐱¯0),(12.7.4)
where 𝐱¯0 is the minimizer of f¯. Hence the magnitude of the gradient depends both on 𝚲 and the distance from optimality. If 𝐱¯−𝐱¯0 did not change, this would be all that is needed. After all, in this case the magnitude of the gradient ∂𝐱¯f¯(𝐱¯) suffices. Since AdaGrad is a stochastic gradient descent algorithm, we will see gradients with nonzero variance even at optimality. As a result we can safely use the variance of the gradients as a cheap proxy for the scale of the Hessian. A thorough analysis is beyond the scope of this section (it would be several pages). We refer the reader to (Duchi et al., 2011) for details.
英語のヒント
ここで𝐱¯0はf¯の最小化点である。したがって、勾配の大きさは、𝚲と最適からの距離の両方に依存する。𝐱¯−𝐱¯0が変わらなければ、これで必要なものはすべてである。結局のところ、この場合は勾配の大きさ∂𝐱¯f¯(𝐱¯)で十分である。AdaGradは確率的勾配降下法のアルゴリズムなので、最適な点でさえ分散がゼロでない勾配が見られる。その結果、勾配の分散を、ヘッセ行列のスケールの安価な代用品として安心して使える。徹底した解析はこの節の範囲を超える(数ページになるだろう)。詳しくは(Duchi et al., 2011)を参照。