第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 the line segment connecting and is also in . In mathematical terms this means that for all we have
英語のヒント
集合は凸性の基礎である。簡単に言えば、ベクトル空間の集合が凸であるとは、どのについても、とを結ぶ線分がやはりに含まれることである。数学の言葉で言えば、これは、すべてのについて次が成り立つことを意味する。
(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 . Since and are convex, the line segments connecting and are contained in both and . Given that, they also need to be contained in , thus proving our theorem.
英語のヒント
定義は、それを使って何かができなければ、それだけではあまり役に立たない。この場合、図12.2.2に示すように、共通部分を見ることができる。とが凸集合だとする。すると、も凸である。これを確かめるには、任意のを考える。とは凸なので、とを結ぶ線分は、との両方に含まれる。そうであれば、その線分はにも含まれなければならず、これで定理が証明される。
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 , their intersection is convex. To see that the converse is not true, consider two disjoint sets . Now pick and . The line segment in Fig. 12.2.3 connecting and 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.
英語のヒント
この結果は、わずかな手間で強められる。凸集合が与えられたとき、その共通部分は凸である。逆が成り立たないことを見るため、互いに素な二つの集合を考える。ここで、とを選ぶ。とを結ぶ図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, , the set of -dimensional vectors of real numbers, is a convex set (after all, the line between any two points in remains in ). In some cases we work with variables of bounded length, such as balls of radius as defined by .
英語のヒント
ふつう、深層学習の問題は凸集合の上で定義される。たとえば、次元の実数ベクトルの集合は凸集合である(結局のところ、の任意の2点を結ぶ線はの中にとどまる)。場合によっては、で定義される半径の球のように、長さが有界な変数を扱う。
12.2.1.2. Convex Functions12.2.1.2 凸関数
Now that we have convex sets we can introduce convex functions . Given a convex set , a function is convex if for all and for all we have
英語のヒント
凸集合ができたので、凸関数を導入できる。凸集合が与えられたとき、関数が凸であるとは、すべてのとすべてのについて次が成り立つことである。
(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 might not be well defined.
英語のヒント
予想どおり、余弦関数は非凸であり、放物線と指数関数は凸である。条件が意味をもつには、が凸集合であるという要件が必要であることに注意してほしい。そうでなければ、の結果がきちんと定義されないかもしれない。
12.2.1.3. Jensen’s Inequality12.2.1.3 イェンセンの不等式
Given a convex function , one of the most useful mathematical tools is Jensen’s inequality. It amounts to a generalization of the definition of convexity:
英語のヒント
凸関数が与えられたとき、最も役に立つ数学的な道具の一つはイェンセンの不等式である。これは凸性の定義を一般化したものにあたり、次のとおりである。
(12.2.3)
where are nonnegative real numbers such that and 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.
英語のヒント
ここで、はを満たす非負の実数であり、は確率変数である。言い換えると、凸関数の期待値は、期待値の凸関数以上である。後者はふつう、もっと単純な式になる。最初の不等式を証明するには、凸性の定義を和の一つの項ずつに繰り返し当てはめる。
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
英語のヒント
イェンセンの不等式のよくある応用の一つは、もっと複雑な式をもっと単純な式で押さえることである。たとえば、部分的に観測された確率変数の対数尤度について応用できる。つまり、次を使う。
(12.2.4)
since . This can be used in variational methods. Here is typically the unobserved random variable, is the best guess of how it might be distributed, and is the distribution with integrated out. For instance, in clustering might be the cluster labels and is the generative model when applying cluster labels.
英語のヒント
これはだからである。これは変分法で使える。ここで、はふつう観測されない確率変数であり、はそれがどう分布しているかについての最良の推測であり、はを積分消去した分布である。たとえばクラスタリングでは、はクラスタのラベルであり、はクラスタのラベルを当てはめるときの生成モデルである。