プリンキピア

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

12.2.1. Definitions12.2.1 定義

Before convex analysis, we need to define convex sets and convex functions. They lead to mathematical tools that are commonly applied to machine learning.
英語のヒント
凸解析の前に、凸集合と凸関数を定義する必要がある。それらは、機械学習によく当てはめられる数学的な道具につながる。

12.2.1.1. Convex Sets12.2.1.1 凸集合

Sets are the basis of convexity. Simply put, a set 𝒳 in a vector space is convex if for any a,b∈𝒳 the line segment connecting a and b is also in 𝒳. In mathematical terms this means that for all λ∈[0,1] we have
英語のヒント
集合は凸性の基礎である。簡単に言えば、ベクトル空間の集合𝒳が凸であるとは、どのa,b∈𝒳についても、aとbを結ぶ線分がやはり𝒳に含まれることである。数学の言葉で言えば、これは、すべてのλ∈[0,1]について次が成り立つことを意味する。
λa+(1−λ)b∈𝒳 whenever a,b∈𝒳.(12.2.1)
This sounds a bit abstract. Consider Fig. 12.2.1. The first set is not convex since there exist line segments that are not contained in it. The other two sets suffer no such problem.
英語のヒント
これは少し抽象的に聞こえる。図12.2.1を考えよう。最初の集合は凸ではない。そこに含まれない線分があるからである。ほかの二つの集合には、そのような問題はない。
Fig. 12.2.1図12.2.1
The first set is nonconvex and the other two are convex.
英語のヒント
最初の集合は凸でなく、ほかの二つは凸である。
Definitions on their own are not particularly useful unless you can do something with them. In this case we can look at intersections as shown in Fig. 12.2.2. Assume that 𝒳 and 𝒴 are convex sets. Then 𝒳∩𝒴 is also convex. To see this, consider any a,b∈𝒳∩𝒴. Since 𝒳 and 𝒴 are convex, the line segments connecting a and b are contained in both 𝒳 and 𝒴. Given that, they also need to be contained in 𝒳∩𝒴, thus proving our theorem.
英語のヒント
定義は、それを使って何かができなければ、それだけではあまり役に立たない。この場合、図12.2.2に示すように、共通部分を見ることができる。𝒳と𝒴が凸集合だとする。すると、𝒳∩𝒴も凸である。これを確かめるには、任意のa,b∈𝒳∩𝒴を考える。𝒳と𝒴は凸なので、aとbを結ぶ線分は、𝒳と𝒴の両方に含まれる。そうであれば、その線分は𝒳∩𝒴にも含まれなければならず、これで定理が証明される。
Fig. 12.2.2図12.2.2
The intersection between two convex sets is convex.
英語のヒント
二つの凸集合の共通部分は凸である。
We can strengthen this result with little effort: given convex sets 𝒳i, their intersection ∩i𝒳i is convex. To see that the converse is not true, consider two disjoint sets 𝒳∩𝒴=∅. Now pick a∈𝒳 and b∈𝒴. The line segment in Fig. 12.2.3 connecting a and b needs to contain some part that is neither in 𝒳 nor in 𝒴, since we assumed that 𝒳∩𝒴=∅. Hence the line segment is not in 𝒳∪𝒴 either, thus proving that in general unions of convex sets need not be convex.
英語のヒント
この結果は、わずかな手間で強められる。凸集合𝒳iが与えられたとき、その共通部分∩i𝒳iは凸である。逆が成り立たないことを見るため、互いに素な二つの集合𝒳∩𝒴=∅を考える。ここで、a∈𝒳とb∈𝒴を選ぶ。aとbを結ぶ図12.2.3の線分は、𝒳にも𝒴にもない部分を含まなければならない。𝒳∩𝒴=∅と仮定したからである。したがって、その線分は𝒳∪𝒴にも含まれず、一般に凸集合の和集合は凸である必要がないことが証明される。
Fig. 12.2.3図12.2.3
The union of two convex sets need not be convex.
英語のヒント
二つの凸集合の和集合は凸である必要がない。
Typically the problems in deep learning are defined on convex sets. For instance, ℝd, the set of d-dimensional vectors of real numbers, is a convex set (after all, the line between any two points in ℝd remains in ℝd). In some cases we work with variables of bounded length, such as balls of radius r as defined by {𝐱|𝐱∈ℝd and ∥𝐱∥≤r}.
英語のヒント
ふつう、深層学習の問題は凸集合の上で定義される。たとえば、d次元の実数ベクトルの集合ℝdは凸集合である(結局のところ、ℝdの任意の2点を結ぶ線はℝdの中にとどまる)。場合によっては、{𝐱|𝐱∈ℝd and ∥𝐱∥≤r}で定義される半径rの球のように、長さが有界な変数を扱う。

12.2.1.2. Convex Functions12.2.1.2 凸関数

Now that we have convex sets we can introduce convex functions f. Given a convex set 𝒳, a function f:𝒳→ℝ is convex if for all x,x′∈𝒳 and for all λ∈[0,1] we have
英語のヒント
凸集合ができたので、凸関数fを導入できる。凸集合𝒳が与えられたとき、関数f:𝒳→ℝが凸であるとは、すべてのx,x′∈𝒳とすべてのλ∈[0,1]について次が成り立つことである。
λf(x)+(1−λ)f(x′)≥f(λx+(1−λ)x′).(12.2.2)
To illustrate this let’s plot a few functions and check which ones satisfy the requirement. Below we define a few functions, both convex and nonconvex.
英語のヒント
これを示すため、いくつかの関数をプロットし、どれが条件を満たすか確かめよう。以下では、凸のものと非凸のものを含む、いくつかの関数を定義する。
f = lambda x: 0.5 * x**2  # Convex
g = lambda x: torch.cos(np.pi * x)  # Nonconvex
h = lambda x: torch.exp(0.5 * x)  # Convex

x, segment = torch.arange(-2, 2, 0.01), torch.tensor([-1.5, 1])
d2l.use_svg_display()
_, axes = d2l.plt.subplots(1, 3, figsize=(9, 3))
for ax, func in zip(axes, [f, g, h]):
    d2l.plot([x, segment], [func(x), func(segment)], axes=ax)
As expected, the cosine function is nonconvex, whereas the parabola and the exponential function are. Note that the requirement that 𝒳 is a convex set is necessary for the condition to make sense. Otherwise the outcome of f(λx+(1−λ)x′) might not be well defined.
英語のヒント
予想どおり、余弦関数は非凸であり、放物線と指数関数は凸である。条件が意味をもつには、𝒳が凸集合であるという要件が必要であることに注意してほしい。そうでなければ、f(λx+(1−λ)x′)の結果がきちんと定義されないかもしれない。

12.2.1.3. Jensen’s Inequality12.2.1.3 イェンセンの不等式

Given a convex function f, one of the most useful mathematical tools is Jensen’s inequality. It amounts to a generalization of the definition of convexity:
英語のヒント
凸関数fが与えられたとき、最も役に立つ数学的な道具の一つはイェンセンの不等式である。これは凸性の定義を一般化したものにあたり、次のとおりである。
∑iαif(xi)≥f(∑iαixi) and EX[f(X)]≥f(EX[X]),(12.2.3)
where αi are nonnegative real numbers such that ∑iαi=1 and X is a random variable. In other words, the expectation of a convex function is no less than the convex function of an expectation, where the latter is usually a simpler expression. To prove the first inequality we repeatedly apply the definition of convexity to one term in the sum at a time.
英語のヒント
ここで、αiは∑iαi=1を満たす非負の実数であり、Xは確率変数である。言い換えると、凸関数の期待値は、期待値の凸関数以上である。後者はふつう、もっと単純な式になる。最初の不等式を証明するには、凸性の定義を和の一つの項ずつに繰り返し当てはめる。
One of the common applications of Jensen’s inequality is to bound a more complicated expression by a simpler one. For example, its application can be with regard to the log-likelihood of partially observed random variables. That is, we use
英語のヒント
イェンセンの不等式のよくある応用の一つは、もっと複雑な式をもっと単純な式で押さえることである。たとえば、部分的に観測された確率変数の対数尤度について応用できる。つまり、次を使う。
EY∼P(Y)[−log⁡P(X∣Y)]≥−log⁡P(X),(12.2.4)
since ∫P(Y)P(X∣Y)dY=P(X). This can be used in variational methods. Here Y is typically the unobserved random variable, P(Y) is the best guess of how it might be distributed, and P(X) is the distribution with Y integrated out. For instance, in clustering Y might be the cluster labels and P(X∣Y) is the generative model when applying cluster labels.
英語のヒント
これは∫P(Y)P(X∣Y)dY=P(X)だからである。これは変分法で使える。ここで、Yはふつう観測されない確率変数であり、P(Y)はそれがどう分布しているかについての最良の推測であり、P(X)はYを積分消去した分布である。たとえばクラスタリングでは、Yはクラスタのラベルであり、P(X∣Y)はクラスタのラベルを当てはめるときの生成モデルである。