• 検索結果がありません。

ベイズモデリング

N/A
N/A
Protected

Academic year: 2021

シェア "ベイズモデリング"

Copied!
46
0
0

読み込み中.... (全文を見る)

全文

(1)

機械学習論

ベイズモデリング

(2)

能動学習の問題設定 (pool-based sequential setting)

▶ 問題設定1:関数推定 関数 f を精度良く推定したい

f

= arg min

f ˆ

∈F

n

i=1

(f (x i ) f(x ˆ i )) 2

▶ 問題設定2:最適化

関数 f を最大化するパラメータ x を求めたい x

i = arg max

x∈{x1

,...,x

n}

f (x)

(3)

問題設定1:関数推定のための能動学習(不確実性)

(4)

問題設定1:関数推定のための能動学習(不確実性)

Input

Output

Step 0

Objective

Prediction Observations

Next Sample Uncertainty

(5)

問題設定1:関数推定のための能動学習(不確実性)

Input

Output

Step 1

Objective

Prediction Observations

Next Sample Uncertainty

(6)

問題設定1:関数推定のための能動学習(不確実性)

Input

Output

Step 2

Objective

Prediction Observations

Next Sample Uncertainty

(7)

問題設定1:関数推定のための能動学習(不確実性)

Input

Output

Step 3

Objective

Prediction Observations

Next Sample Uncertainty

(8)

問題設定1:関数推定のための能動学習(不確実性)

Input

Output

Step 4

Objective

Prediction Observations

Next Sample Uncertainty

(9)

問題設定1:関数推定のための能動学習(不確実性)

Input

Output

Step 5

Objective

Prediction Observations

Next Sample Uncertainty

(10)

問題設定1:関数推定のための能動学習(不確実性)

Input

Output

Step 6

Objective

Prediction Observations

Next Sample Uncertainty

(11)

問題設定1:関数推定のための能動学習(不確実性)

Input

Output

Step 7

Objective

Prediction Observations

Next Sample Uncertainty

(12)

問題設定1:関数推定のための能動学習(不確実性)

Input

Output

Step 8

Objective

Prediction Observations

Next Sample Uncertainty

(13)

問題設定1:関数推定のための能動学習(不確実性)

Input

Output

Step 9

Objective

Prediction Observations

Next Sample Uncertainty

(14)

問題設定2:最適化のための能動学習(不確実性)

(15)

問題設定2:最適化のための能動学習(不確実性)

Input

Output

Step 0

Objective

Prediction Observations

Next Sample Uncertainty

(16)

問題設定2:最適化のための能動学習(不確実性)

Input

Output

Step 1

Objective

Prediction Observations

Next Sample Uncertainty

(17)

問題設定2:最適化のための能動学習(不確実性)

Input

Output

Step 2

Objective

Prediction Observations

Next Sample Uncertainty

(18)

問題設定2:最適化のための能動学習(不確実性)

Input

Output

Step 3

Objective

Prediction Observations

Next Sample Uncertainty

(19)

問題設定2:最適化のための能動学習(不確実性)

Input

Output

Step 4

Objective

Prediction Observations

Next Sample Uncertainty

(20)

問題設定2:最適化のための能動学習(不確実性)

Input

Output

Step 5

Objective

Prediction Observations

Next Sample Uncertainty

(21)

問題設定2:最適化のための能動学習(不確実性)

Input

Output

Step 6

Objective

Prediction Observations

Next Sample Uncertainty

(22)

問題設定2:最適化のための能動学習(不確実性)

Input

Output

Step 7

Objective

Prediction Observations

Next Sample Uncertainty

(23)

Part1

ベイズの定理

(24)

能動学習のながれ

(25)

ベイズモデリング

ベイズモデリング:パラメータの更新プロセスのモデル化

▶ パラメータの事前分布: P ( ˆ w)

▶ データ: D := { (x i , y i ) } n i=1

▶ パラメータの事後分布: P ( ˆ w | D )

(26)

ベイズの定理

▶ ベイズの定理

P ( ˆ w | D ) = P ( D | w) ˆ P ( ˆ w) P ( D )

パラメータの事後確率: P ( ˆ w | D )

尤度: P ( D | w) ˆ

パラメータの事前確率: P ( ˆ w)

データの周辺分布

▶ ベイズの定理の解釈 P ( ˆ w | D )

| {z }

パラメータの事後確率

P ( D | w) ˆ

| {z }

尤度

× P ( ˆ w)

| {z }

パラメータの事前確率

(27)

ベイズ推論:結果から原因をさぐる

▶ 結果:E

▶ 原因: A 1 , A 2 , . . . , A m

▶ 条件付確率

P (A i , E) = P (A i | E) P (E) = P (E | A i ) P (A i )

▶ 結果 E が起こったときに原因が A i である確率 P (A

i

| E)= P (E | A

i

) P (A

i

)

P (E)

= P (E | A

i

) P (A

i

)

P (E | A

1

) P (A

1

) + P (E | A

2

) P (A

2

) + . . . + P (E | A

m

) P (A

m

)

(28)

演習問題1

▶ ベイズの定理を証明せよ(ヒント:同時確率と条件付確率の関係

を利用)

(29)

演習問題1の解答

(30)

以降の構成

▶ 正規分布におけるベイズ推論

▶ ベイズ線形モデル

▶ ベイズ線形モデルの予測分布(次回)

▶ ベイズ線形モデルのカーネル化 = ガウス過程モデル(次回)

▶ ガウス過程モデルの予測分布(次回)

Input

Output

Step 4

Objective Observations Uncertainty

(31)

Part2

正規分布におけるベイズ推論

(32)

正規分布(の復習)

▶ 確率密度関数(平均 µ,分散 σ 2

z N (µ, σ 2 ) P (z) = 1 (2πσ 2 )

12

exp

(

1

2 (z µ) 2 )

▶ 2 つの正規確率変数(周辺分布)

z N (µ z , σ z 2 ), w N (µ w , σ 2 w )

▶ 同時分布

(z, w) N ([ µ z

µ w

] ,

[ σ 2 z Cov(z, w) Cov(z, w) σ w 2

])

▶ 条件付分布

z | w N (µ

|

, σ 2

|

), w | z N (µ

|

, σ 2

|

)

(33)

正規分布におけるベイズ推論

▶ 事前分布:µ N (µ 0 , σ 2 0 ) P (µ) = 1

(2πσ

20

)

12

exp (

1

02

µ

0

)

2

)

▶ データ:z = [z 1 , . . . , z n ]

,z i i.i.d. N (µ, σ 2 ) P (z i | µ) = 1

(2πσ

2

)

12

exp (

1

2

(z

i

µ)

2

)

, i = 1, . . . , n

▶ 事後分布:µ | z N (µ

n

, σ

2n

) P (w | z) = 1

(2πσ

n2

)

12

exp (

1

n2

(w µ

n

) 2

)

(34)

正規分布におけるベイズ推論

▶ 事前分布

µ N (µ 0 , σ 0 2 )

▶ 事後分布(演習問題2)

µ | z N (

σ 2

2 0 + σ 2 µ 0 + 0 2 0 2 + σ 2 z, ¯

( 1 σ 2 0 + n

σ 2

)

1 )

(35)

ベイズ推論の性質

▶ 事後分布 µ | z N

( σ 2

2 0 + σ 2 µ 0 + 0 2 0 2 + σ 2 z, ¯

( 1 σ 2 0 + n

σ 2 )

1 )

n 0 のとき(事前知識重視)

µ N

0

, σ

20

)

n → ∞ のとき(データ重視)

µ N(¯ z, σ

2

n )

(36)

演習問題2

▶ 正規分布の平均パラメータ µ のベイズ推論において,事後分布 P (µ | z) の平均 µ

n

と分散 σ

n2

µ

n

= σ 2

2 0 + σ 2 µ 0 + 0 2 0 2 + σ 2 z, ¯ 1

σ

2n

= 1 σ 2 0 + n

σ 2

と表されることを示せ.ただし,¯ z = 1 nn

i=1 z i である.

▶ (ヒント)ベイズの定理より,

P (µ | z) P (z | µ) P (µ) (1) である.条件付分布も正規分布となるので,µ に関する平方完成 を行い,式 (1) の指数関数の部分が

exp (

1

2n

µ

n

) 2

)

(37)

演習問題2の解答

(38)

Part3

ベイズ線形モデル

(39)

ベイズ線形モデル

▶ 線形モデル(X R n

×

d , y R n

y = X w + ε, ε N (0, σ 2 I n )

▶ パラメータの事前分布 P (w):w N (0, σ 0 2 I d )

P (w) = 1 (2πσ

02

)

12

exp

1 2σ

02

d j=1

w

2j

exp (

1 2σ

02

w

w

)

▶ 尤度 P (y | w)

P (y | w) = 1 (2πσ

2

)

12

exp (

1 2σ

2

n i=1

(y

i

x

i

w)

2

)

exp (

1

2

(y Xw)

(y Xw) )

▶ パラメータの事後分布 P (w | y)w | y N ( w ˆ

n

, S

n

)

P (w | y) = 1

1

exp (

1

(w w ˆ

n

)

S

n1

(w w ˆ

n

)

)

(40)

ベイズ線形モデルパラメータの事後分布

▶ 事前分布

w N (0, σ 0 2 I)

▶ 事後分布(演習問題3)

w | y N (

(X

X + σ 2

σ 0 2 I)

1 X

y, σ 2 (X

X + σ 2 σ 2 0 I)

1

)

(41)

ベイズ線形モデルの例

Bishop (2006) Fig3.7より転載

(42)

ベイズ線形モデルとリッジ回帰分析

ベイズ線形回帰 = リッジ回帰分析

▶ 最小二乗法 ˆ

w LS = (X

X )

1 X

y, Cov[ ˆ w LS ] = σ 2 (X

X)

1

▶ リッジ回帰分析

w ˆ Ridge = (X

X + λI)

1 X

y, Cov[ ˆ w Ridge ] = σ 2 (X

X + λI )

1

▶ ベイズ線形回帰の事後分布 w | y N

(

(X

X + σ 2

σ 0 2 I)

1 X

y, σ 2 (X

X + σ 2 σ 2 0 I)

1

)

(43)

演習問題3

▶ 前ページにおける正規線形モデルパラメータ w のベイズ推論にお いて,事後分布 P (w | y) の平均 w ˆ

n

と分散共分散行列 S

n

w ˆ

n

= 1

σ 2 S

n

X

y = (X

X + σ 2

σ 2 0 I)

1 X

y S

n1

= 1

σ 2 X

X + 1 σ 2 0 I

(

S n = σ 2 (X

X + σ 2 σ 0 2 I)

1

)

と表されることを示せ.

▶ (ヒント)多変数二次関数の平方完成は

1 2

(

w

Aw 2b

w )

+ const. = 1 2 (

(w A

1

b)

A(w A

1

b) )

+ const. (2)

と表されるので, P (w | y) の指数関数の引数部分で式 (2) の行列 A とベクトル b に対応するものを求めれば,

ˆ

w n = A

1 b, S n

1 = A

(44)

演習問題3の解答

(45)

まとめ

(46)

まとめ

▶ パラメータの不確実性を逐次更新する際はベイズモデリングの考 え方が有用

▶ ベイズモデリングではデータが少ないときは事前知識を活用し,

多いときはデータを活用

▶ ベイズ線形モデルはリッジ回帰モデルと等価(次回:カーネル法

による非線形化が利用可能)

参照

関連したドキュメント

Figure 1(b) shows a diagram of sample loading onto the analytical column. methanol or acetonitrile) delivered by the isocratic pump at a flow rate of 0.05 mL/min elutes the whole

Shape factors of flared skirts obtained for two examples such as sample D (Toile) and sample F (Faille) are shown in Fig.6 and 7, respectively versus the height from waist line to

By regulating the laser power and regulating the cantilever deflection, the tip-sample distance is controlled; this enables much faster imaging than that in the

By adapting tools from information theory, I construct optimal, nonlinear local statistical predictors for random fields on networks; these take the form of minimal

In the previous section we have established a sample-path large deviation principle on a finite time grid; this LDP provides us with logarithmic asymptotics of the probability that

Professionals at Railway Technical Research Institute in Japan have, respectively, developed degradation models which utilize standard deviations of track geometry measurements

These power functions will allow us to compare the use- fulness of the ANOVA and Kruskal-Wallis tests under various kinds and degrees of non-normality (combinations of the g and

In order to predict the interior noise of the automobile in the low and middle frequency band in the design and development stage, the hybrid FE-SEA model of an automobile was