プリンキピア

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

12.2.3. Constraints12.2.3 制約

One of the nice properties of convex optimization is that it allows us to handle constraints efficiently. That is, it allows us to solve constrained optimization problems of the form:
英語のヒント
凸最適化のよい性質の一つは、制約を効率よく扱えることである。つまり、次の形の制約つき最適化問題を解ける。
minimize 𝐱f(𝐱) subject to ci(𝐱)≤0 for all i∈{1,…,n},(12.2.16)
where f is the objective and the functions ci are constraint functions. To see what this does consider the case where c1(𝐱)=∥𝐱∥2−1. In this case the parameters 𝐱 are constrained to the unit ball. If a second constraint is c2(𝐱)=𝐯⊤𝐱+b, then this corresponds to all 𝐱 lying on a half-space. Satisfying both constraints simultaneously amounts to selecting a slice of a ball.
英語のヒント
ここで、fは目的関数であり、関数ciは制約関数である。これが何をするかを見るため、c1(𝐱)=∥𝐱∥2−1の場合を考えよう。この場合、パラメータ𝐱は単位球に制約される。二つ目の制約がc2(𝐱)=𝐯⊤𝐱+bなら、これは半空間にあるすべての𝐱に対応する。両方の制約を同時に満たすことは、球の一切れを選ぶことにあたる。

12.2.3.1. Lagrangian12.2.3.1 ラグランジュ関数

In general, solving a constrained optimization problem is difficult. One way of addressing it stems from physics with a rather simple intuition. Imagine a ball inside a box. The ball will roll to the place that is lowest and the forces of gravity will be balanced out with the forces that the sides of the box can impose on the ball. In short, the gradient of the objective function (i.e., gravity) will be offset by the gradient of the constraint function (the ball need to remain inside the box by virtue of the walls “pushing back”). Note that some constraints may not be active: the walls that are not touched by the ball will not be able to exert any force on the ball.
英語のヒント
一般に、制約つき最適化問題を解くのは難しい。それに取り組む一つの方法は物理学から来ており、かなり単純な直観にもとづく。箱の中のボールを想像してほしい。ボールは最も低い場所へ転がり、重力は、箱の側面がボールに及ぼしうる力と釣り合う。手短に言えば、目的関数の勾配(つまり重力)は、制約関数の勾配によって相殺される(壁が「押し返す」おかげで、ボールは箱の中にとどまる必要がある)。いくつかの制約は効いていないかもしれないことに注意してほしい。ボールが触れていない壁は、ボールにどんな力も及ぼせない。
Skipping over the derivation of the Lagrangian L, the above reasoning can be expressed via the following saddle point optimization problem:
英語のヒント
ラグランジュ関数Lの導出は飛ばすが、上の推論は次の鞍点の最適化問題で表せる。
L(𝐱,α1,…,αn)=f(𝐱)+∑i=1nαici(𝐱) where αi≥0.(12.2.17)
Here the variables αi (i=1,…,n) are the so-called Lagrange multipliers that ensure that constraints are properly enforced. They are chosen just large enough to ensure that ci(𝐱)≤0 for all i. For instance, for any 𝐱 where ci(𝐱)<0 naturally, we’d end up picking αi=0. Moreover, this is a saddle point optimization problem where one wants to maximize L with respect to all αi and simultaneously minimize it with respect to 𝐱. There is a rich body of literature explaining how to arrive at the function L(𝐱,α1,…,αn). For our purposes it is sufficient to know that the saddle point of L is where the original constrained optimization problem is solved optimally.
英語のヒント
ここで変数αi(i=1,…,n)は、いわゆるラグランジュ乗数であり、制約がきちんと守られるようにする。それらは、すべてのiについてci(𝐱)≤0となるのにちょうど足りる大きさに選ばれる。たとえば、もともとci(𝐱)<0となる𝐱については、結局αi=0を選ぶことになる。さらに、これは、Lをすべてのαiについて最大化し、同時に𝐱について最小化したい鞍点の最適化問題である。関数L(𝐱,α1,…,αn)にどうたどり着くかを説明する文献は豊富にある。ここでの目的には、Lの鞍点で元の制約つき最適化問題が最適に解けていることを知っていれば十分である。

12.2.3.2. Penalties12.2.3.2 ペナルティ

One way of satisfying constrained optimization problems at least approximately is to adapt the Lagrangian L. Rather than satisfying ci(𝐱)≤0 we simply add αici(𝐱) to the objective function f(x). This ensures that the constraints will not be violated too badly.
英語のヒント
制約つき最適化問題を少なくとも近似的に満たす一つの方法は、ラグランジュ関数Lを手直しすることである。ci(𝐱)≤0を満たす代わりに、単にαici(𝐱)を目的関数f(x)に加える。こうすれば、制約がひどく破られることはない。
In fact, we have been using this trick all along. Consider weight decay in Section 3.7. In it we add λ2∥𝐰∥2 to the objective function to ensure that 𝐰 does not grow too large. From the constrained optimization point of view we can see that this will ensure that ∥𝐰∥2−r2≤0 for some radius r. Adjusting the value of λ allows us to vary the size of 𝐰.
英語のヒント
実は、この手はずっと使ってきた。3.7節の重み減衰を考えよう。そこでは、𝐰が大きくなりすぎないように、λ2∥𝐰∥2を目的関数に加える。制約つき最適化の観点から見ると、これは、ある半径rについて∥𝐰∥2−r2≤0となるようにするものだとわかる。λの値を調整すれば、𝐰の大きさを変えられる。
In general, adding penalties is a good way of ensuring approximate constraint satisfaction. In practice this turns out to be much more robust than exact satisfaction. Furthermore, for nonconvex problems many of the properties that make the exact approach so appealing in the convex case (e.g., optimality) no longer hold.
英語のヒント
一般に、ペナルティを加えることは、制約を近似的に満たすためのよい方法である。実際には、これは厳密に満たすよりずっと頑健であることがわかる。さらに、非凸の問題では、凸の場合に厳密なやり方をとても魅力的にしている性質の多く(たとえば最適性)が、もはや成り立たない。

12.2.3.3. Projections12.2.3.3 射影

An alternative strategy for satisfying constraints is projections. Again, we encountered them before, e.g., when dealing with gradient clipping in Section 9.5. There we ensured that a gradient has length bounded by θ via
英語のヒント
制約を満たすための別の戦略は射影である。これも前に出てきた。たとえば、9.5節で勾配クリッピングを扱ったときである。そこでは、次のようにして、勾配の長さがθ以下になるようにした。
𝐠←𝐠⋅min(1,θ/∥𝐠∥).(12.2.18)
This turns out to be a projection of 𝐠 onto the ball of radius θ. More generally, a projection on a convex set 𝒳 is defined as
英語のヒント
これは、𝐠を半径θの球へ射影することにあたる。もっと一般に、凸集合𝒳への射影は次のように定義される。
Proj𝒳(𝐱)=argmin𝐱′∈𝒳∥𝐱−𝐱′∥,(12.2.19)
which is the closest point in 𝒳 to 𝐱.
英語のヒント
これは、𝒳の中で𝐱に最も近い点である。
Fig. 12.2.4図12.2.4
Convex Projections.
英語のヒント
凸射影。
The mathematical definition of projections may sound a bit abstract. Fig. 12.2.4 explains it somewhat more clearly. In it we have two convex sets, a circle and a diamond. Points inside both sets (yellow) remain unchanged during projections. Points outside both sets (black) are projected to the points inside the sets (red) that are closet to the original points (black). While for ℓ2 balls this leaves the direction unchanged, this need not be the case in general, as can be seen in the case of the diamond.
英語のヒント
射影の数学的な定義は、少し抽象的に聞こえるかもしれない。図12.2.4は、それをもう少しわかりやすく説明している。そこには、円とひし形という二つの凸集合がある。二つの集合それぞれの内側の点(黄)は、射影のあいだ変わらない。二つの集合それぞれの外側の点(黒)は、集合の内側の点のうち、元の点(黒)に最も近い点(赤)へ射影される。ℓ2球ではこれで向きは変わらないが、ひし形の場合に見られるように、一般にはそうなるとは限らない。
One of the uses for convex projections is to compute sparse weight vectors. In this case we project weight vectors onto an ℓ1 ball, which is a generalized version of the diamond case in Fig. 12.2.4.
英語のヒント
凸射影の使い道の一つは、疎な重みベクトルを計算することである。この場合、重みベクトルをℓ1球へ射影する。これは、図12.2.4のひし形の場合を一般化したものである。