第22章付録:深層学習のための数学
22.5.5. Multiple Integrals22.5.5 重積分
In some cases, we will need to work in higher dimensions. For instance, suppose that we have a function of two variables, like and we want to know the volume under when ranges over and ranges over .
英語のヒント
場合によっては、より高い次元で作業する必要がある。たとえば、のような2変数の関数があり、がの範囲を、がの範囲を動くときのの下の体積を知りたいとする。
# Construct grid and compute function
x, y = torch.meshgrid(torch.linspace(-2, 2, 101), torch.linspace(-2, 2, 101))
z = torch.exp(- x**2 - y**2)
# Plot function
ax = d2l.plt.figure().add_subplot(111, projection='3d')
ax.plot_wireframe(x, y, z)
d2l.plt.xlabel('x')
d2l.plt.ylabel('y')
d2l.plt.xticks([-2, -1, 0, 1, 2])
d2l.plt.yticks([-2, -1, 0, 1, 2])
d2l.set_figsize()
ax.set_xlim(-2, 2)
ax.set_ylim(-2, 2)
ax.set_zlim(0, 1)
ax.dist = 12We write this as
英語のヒント
これを次のように書く。
(22.5.26)
Suppose that we wish to compute this integral. My claim is that we can do this by iteratively computing first the integral in and then shifting to the integral in , that is to say
英語のヒント
この積分を計算したいとする。ここで主張したいのは、まずについて積分を計算し、それからについての積分に移るというように、繰り返し計算すればこれができるということである。つまり、
(22.5.27)
Let’s see why this is.
英語のヒント
これがなぜなのかを見よう。
Consider the figure above where we have split the function into squares which we will index with integer coordinates . In this case, our integral is approximately
英語のヒント
上の図で、関数をの正方形に分割し、それを整数の座標で添字づけたとしよう。この場合、積分はおよそ次のようになる。
(22.5.28)
Once we discretize the problem, we may add up the values on these squares in whatever order we like, and not worry about changing the values. This is illustrated in Fig. 22.5.3. In particular, we can say that
英語のヒント
いったん問題を離散化すれば、これらの正方形の上の値を好きな順序で足し合わせてよく、値が変わることを心配する必要はない。これを図22.5.3に図示する。とくに、次のように言える。
(22.5.29)
Fig. 22.5.3図22.5.3
Illustrating how to decompose a sum over many squares as a sum over first the columns (1), then adding the column sums together (2).
英語のヒント
多くの正方形にわたる和を、まず列にわたる和(1)、それから列の和を足し合わせる(2)ことに分解する方法の図解。
The sum on the inside is precisely the discretization of the integral
英語のヒント
内側の和は、まさに次の積分の離散化である。
(22.5.30)
Finally, notice that if we combine these two expressions we get
英語のヒント
最後に、この二つの式を組み合わせると、次が得られることに注意しよう。
(22.5.31)
Thus putting it all together, we have that
英語のヒント
したがって、すべてをまとめると、次が得られる。
(22.5.32)
Notice that, once discretized, all we did was rearrange the order in which we added a list of numbers. This may make it seem like it is nothing, however this result (called Fubini’s Theorem) is not always true! For the type of mathematics encountered when doing machine learning (continuous functions), there is no concern, however it is possible to create examples where it fails (for example the function over the rectangle ).
英語のヒント
いったん離散化すれば、したことは数のリストを足し合わせる順序を並べ替えただけであることに注意しよう。そのため何でもないことのように思えるかもしれないが、この結果(フビニの定理と呼ばれる)はいつも正しいとはかぎらない。機械学習をするときに出会う種類の数学(連続関数)では心配はないが、これが成り立たない例を作ることはできる(たとえば、長方形上の関数)。
Note that the choice to do the integral in first, and then the integral in was arbitrary. We could have equally well chosen to do first and then to see
英語のヒント
まずについて積分し、それからについて積分するという選び方は任意だったことに注意しよう。同じように、まず、それからを選んでも、次がわかる。
(22.5.33)
Often times, we will condense down to vector notation, and say that for this is
英語のヒント
多くの場合、ベクトル記法に凝縮して、について次のように書く。
(22.5.34)