プリンキピア

第18章ガウス過程

18.2.2. A Simple Gaussian Process18.2.2 単純なガウス過程

Suppose f(x)=w0+w1x, and w0,w1∼𝒩(0,1), with w0,w1,x all in one dimension. We can equivalently write this function as the inner product f(x)=(w0,w1)(1,x)⊤. In (18.2.1) above, w=(w0,w1)⊤ and ϕ(x)=(1,x)⊤.
英語のヒント
f(x)=w0+w1x、w0,w1∼𝒩(0,1)とし、w0,w1,xはすべて1次元であるとしよう。この関数は、内積f(x)=(w0,w1)(1,x)⊤として同値に書ける。上の(18.2.1)では、w=(w0,w1)⊤、ϕ(x)=(1,x)⊤である。
For any x, f(x) is a sum of two Gaussian random variables. Since Gaussians are closed under addition, f(x) is also a Gaussian random variable for any x. In fact, we can compute for any particular x that f(x) is 𝒩(0,1+x2). Similarly, the joint distribution for any collection of function values, (f(x1),…,f(xn)), for any collection of inputs x1,…,xn, is a multivariate Gaussian distribution. Therefore f(x) is a Gaussian process.
英語のヒント
任意のxについて、f(x)は二つのガウス確率変数の和である。ガウス分布は足し算について閉じているので、任意のxについてf(x)もガウス確率変数である。実際、任意の特定のxについて、f(x)が𝒩(0,1+x2)に従うことを計算できる。同じように、入力の任意の集まりx1,…,xnについての関数の値の任意の集まり(f(x1),…,f(xn))の同時分布は、多変量ガウス分布である。したがって、f(x)はガウス過程である。
In short, f(x) is a random function, or a distribution over functions. We can gain some insights into this distribution by repeatedly sampling values for w0,w1, and visualizing the corresponding functions f(x), which are straight lines with slopes and different intercepts, as follows:
英語のヒント
要するに、f(x)はランダムな関数、つまり関数の上の分布である。w0,w1の値を繰り返し抜き出し、対応する関数f(x)を次のように可視化すると、この分布についていくらか見通しが得られる。これらの関数は、傾きのある、切片の異なる直線である。
def lin_func(x, n_sample):
    preds = np.zeros((n_sample, x.shape[0]))
    for ii in range(n_sample):
        w = np.random.normal(0, 1, 2)
        y = w[0] + w[1] * x
        preds[ii, :] = y
    return preds

x_points = np.linspace(-5, 5, 50)
outs = lin_func(x_points, 10)
lw_bd = -2 * np.sqrt((1 + x_points ** 2))
up_bd = 2 * np.sqrt((1 + x_points ** 2))

d2l.plt.fill_between(x_points, lw_bd, up_bd, alpha=0.25)
d2l.plt.plot(x_points, np.zeros(len(x_points)), linewidth=4, color='black')
d2l.plt.plot(x_points, outs.T)
d2l.plt.xlabel("x", fontsize=20)
d2l.plt.ylabel("f(x)", fontsize=20)
d2l.plt.show()
If w0 and w1 are instead drawn from 𝒩(0,α2), how do you imagine varying α affects the distribution over functions?
英語のヒント
w0とw1が代わりに𝒩(0,α2)から抜き出されるとしたら、αを変えると関数の上の分布にどう影響すると思うか。