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

ガウス過程モデルとベイズ最適化

N/A
N/A
Protected

Academic year: 2021

シェア "ガウス過程モデルとベイズ最適化"

Copied!
68
0
0

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

全文

(1)

ガウス過程モデルとベイズ最適化

(2)

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

f= arg min

fˆ∈F

n i=1

(f(xi)−f(xˆ i))2

問題設定2:最適化

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

x∈{x1,...,xn} f(x)

(3)
(4)

Input

Output

Step 0

Objective

Prediction Observations

Next Sample Uncertainty

(5)

Input

Output

Step 1

Objective

Prediction Observations

Next Sample Uncertainty

(6)

Input

Output

Step 2

Objective

Prediction Observations

Next Sample Uncertainty

(7)

Input

Output

Step 3

Objective

Prediction Observations

Next Sample Uncertainty

(8)

Input

Output

Step 4

Objective

Prediction Observations

Next Sample Uncertainty

(9)

Input

Output

Step 5

Objective

Prediction Observations

Next Sample Uncertainty

(10)

Input

Output

Step 6

Objective

Prediction Observations

Next Sample Uncertainty

(11)

Input

Output

Step 7

Objective

Prediction Observations

Next Sample Uncertainty

(12)

Input

Output

Step 8

Objective

Prediction Observations

Next Sample Uncertainty

(13)

Input

Output

Step 9

Objective

Prediction Observations

Next Sample Uncertainty

(14)
(15)

Input

Output

Step 0

Objective

Prediction Observations

Next Sample Uncertainty

(16)

Input

Output

Step 1

Objective

Prediction Observations

Next Sample Uncertainty

(17)

Input

Output

Step 2

Objective

Prediction Observations

Next Sample Uncertainty

(18)

Input

Output

Step 3

Objective

Prediction Observations

Next Sample Uncertainty

(19)

Input

Output

Step 4

Objective

Prediction Observations

Next Sample Uncertainty

(20)

Input

Output

Step 5

Objective

Prediction Observations

Next Sample Uncertainty

(21)

Input

Output

Step 6

Objective

Prediction Observations

Next Sample Uncertainty

(22)

Input

Output

Step 7

Objective

Prediction Observations

Next Sample Uncertainty

(23)
(24)

Input

Output

Step 4

Objective

Prediction Observations

Next Sample Uncertainty

(25)

予測分布

(26)

線形モデル

y=Xw+ε, εN(0, σ2I)

ラベルありデータとラベルなしデータ

(XL,yL)← {(xi, yi)}i∈L, (XU, )← {(xi, )}i∈U

事前予測分布

wU N(0, σ02I) yˆU N(µU,ΣU)

事後予測分布

w|(XL,yL)N(wL, SL) yˆU |(XL,yL)N(µU|L,ΣU|L)

(前回の講義より)

w = (XX +σ2

I)1X y , S = ( 1

XX + 1 I

)1

(27)

ベイズ線形モデルの事前予測分布:yˆU N(µU,ΣU) µU =0,

ΣU =σ20XUXU+σ2I

ベイズ線形モデルの事後予測分布:

ˆ

yU |(XL,yL)N(µU|L,ΣU|L)

µU|L=σ02XUXL20XLXL+σ2I)1yL

ΣU|L=σ02XUXU+σ2I−σ20XUXL20XLXL+σ2I)1XLXU

(導出には条件付き正規分布の公式を利用)

(28)

多次元正規分布が [ za

zb

]

N ([ µa

µb

] ,

[ Σaa Σab

Σba Σbb

])

と表されているとき,条件付き分布 za|zbN(

µa|b,Σa|b)

の期待値µa|b と分散共分散行列Σa|b は以下のように書ける:

µa|b=µa+ ΣabΣbb1(zbµb), Σa|b= ΣaaΣabΣbb1Σba

(証明は,例えば,「パターン認識と機械学習」2.3.1節を参照)

(29)

ベイズ線形モデル

yU =XUw+ε, wN(0, σ02I), εN(0, σ2I), wε.

における予測値yU の期待ベクトルと分散共分散行列が,それ ぞれ,

E[yU] =0,

Cov[yU] =E[(yU E[yU])(yUE[yU])] =σ20XUXU+σ2I と表されることを示せ.

(30)
(31)

ガウス過程モデル

(32)

カーネル関数:2つの事例xxの類似度を表す関数 k(x,x)

内積カーネル

k(x,x) =xx

(q次)多項式カーネル

k(x,x) = (xx+ 1)q

ガウシアンカーネル

k(x,x) = exp (

−∥xx22

2s2 )

(33)

ラベルありデータとラベルなしデータ

XL RnL×d, XU RnU×d

カーネル行列

K(XL,XU) =





k(x1,x1) k(x1,x2) · · · k(x1,xnU) k(x2,x1) k(x2,x2) · · · k(x2,xnU)

... ... . .. ... k(xnL,x1) k(xnL,x2) · · · k(xnL,xnU)



RnL×nU

カーネルベクトル

k(XL,xi) =





k(x1,xi) k(x2,xi)

...



RnL

(34)

ガウス過程モデル(Gaussian Process Model)

ベイズ線形モデルのカーネル化

ガウス過程モデルの事前予測分布:yˆU N(µU,ΣU)

µU=0,

ΣU=σ02K(XU,XU) +σ2I

ガウス過程モデルの事後予測分布:

ˆ

yU |(XL,yL)N(µU|L,ΣU|L)

µU|L=σ02K(XU,XL)(σ20K(XL,XL) +σ2I)−1yL

ΣU|L=σ02K(XU,XU) +σ2Iσ20K(XU,XL)(σ02K(XL,XL) +σ2I)1K(XL,XU)

(導出には条件付き正規分布の公式を利用)

(35)

Input

Output

Step 4

Objective

Prediction Observations

Next Sample Uncertainty

ガウス過程モデルの事後予測分布:ˆyi|(XL,yL)N(µi|L,Σi|L)

µi|L=σ20k(XL,xi)02K(XL,XL) +σ2I)1y

(36)

ベイズ最適化

(37)

ラベルありデータ集合L{(xi, yi)}i∈L

ラベルなしデータ集合U{(xi,yi)}i∈U

アルゴリズム

Input: {(xi, yi)}i∈L, {(xi,yi)}i∈U

1: while実験リソース(予算や時間)があるdo 2: for i∈ U do

3: 獲得関数a(xi)を計算 4: end for

5: iarg maxi∈Ua(xi)

6: (実験などにより)yiを求める 7: L ← L ∪ {i},U ← U \ {i} 8: end while

9: ibestarg maxi∈Lyi

Output: 最適な入出力(xibest, yibest)

(38)

Probability of Improvement (PI) a(xi) =Pi|L(yimax

h∈L yh), i∈ U

ただし,maxh∈Lyh はラベルあり事例の中で最大の出力値

(39)

Expected Improvement (EI)

a(xi) =E[f(xi)max

h∈Lyh] i∈ U

ただし,maxh∈Lyh はラベルあり事例の中で最大の出力値

(40)

Exploration(探索)とExploitation(搾取)のトレードオフ

(41)
(42)

Input

Output

Step 0

Objective

Prediction Observations

Next Sample Uncertainty

(43)

Input

Output

Step 1

Objective

Prediction Observations

Next Sample Uncertainty

(44)

Input

Output

Step 2

Objective

Prediction Observations

Next Sample Uncertainty

(45)

Input

Output

Step 3

Objective

Prediction Observations

Next Sample Uncertainty

(46)

Input

Output

Step 4

Objective

Prediction Observations

Next Sample Uncertainty

(47)

Input

Output

Step 5

Objective

Prediction Observations

Next Sample Uncertainty

(48)

Input

Output

Step 6

Objective

Prediction Observations

Next Sample Uncertainty

(49)

Input

Output

Step 7

Objective

Prediction Observations

Next Sample Uncertainty

(50)

ロジスティック回帰分析

ˆP(y= 1|x) =fsigmoid(w0+

d j=1

wjxj), fsigmoid(z) = 1 1 + exp(−z)

−5 0 5

0.00.20.40.60.81.0

Logistic Function

(51)

0.0 0.2 0.4 0.6 0.8 x

0.0 0.2 0.4 0.6 0.8 1.0

y,p(y=1)

Mean Truth Data Confidence

0.0 0.2 0.4 0.6 0.8

x

−1.5

−1.0

−0.5 0.0 0.5 1.0 1.5

f(x)

Mean Truth Confidence

(52)

−0.2 0.0 0.2 0.4 0.6 0.8 1.0 x

0.0 0.2 0.4 0.6 0.8 1.0

y,p(y=1)

Mean Truth Data Confidence

−0.2 0.0 0.2 0.4 0.6 0.8 1.0 x

−2 0 2 4

f(x)

Mean Truth Confidence

(53)

−0.2 0.0 0.2 0.4 0.6 0.8 1.0 x

0.0 0.2 0.4 0.6 0.8 1.0

y,p(y=1)

Mean Truth Data Confidence

−0.2 0.0 0.2 0.4 0.6 0.8 1.0 x

−4

−2 0 2 4

f(x)

Mean Truth Confidence

(54)

−0.2 0.0 0.2 0.4 0.6 0.8 1.0 x

0.0 0.2 0.4 0.6 0.8 1.0

y,p(y=1)

Mean Truth Data Confidence

−0.2 0.0 0.2 0.4 0.6 0.8 1.0 x

−4

−2 0 2 4

f(x)

Mean Truth Confidence

(55)

−0.2 0.0 0.2 0.4 0.6 0.8 1.0 x

0.0 0.2 0.4 0.6 0.8 1.0

y,p(y=1)

Mean Truth Data Confidence

−0.2 0.0 0.2 0.4 0.6 0.8 1.0 x

−4

−2 0 2 4

f(x)

Mean Truth Confidence

(56)

−0.2 0.0 0.2 0.4 0.6 0.8 1.0 x

0.0 0.2 0.4 0.6 0.8 1.0

y,p(y=1)

Mean Truth Data Confidence

−0.2 0.0 0.2 0.4 0.6 0.8 1.0 x

−3

−2

−1 0 1 2 3 4

f(x)

Mean Truth Confidence

(57)

通常のガウス過程モデルのフィッティングにはO(n3)の計算が必要

nが大きいときはRandom Feature Map法による近似を利用化

カーネル関数に対応する特徴ベクトルをランダムにサンプリング

0 1 2 3 4 5 6

X

1.5 1.0 0.5 0.0 0.5 1.0 1.5

Y

Bayesian Regression (D=1000)

true(sin) predict train

(58)

通常のガウス過程モデルのフィッティングにはO(n3)の計算が必要

nが大きいときはRandom Feature Map法による近似を利用化

カーネル関数に対応する特徴ベクトルをランダムにサンプリング

0 1 2 3 4 5 6

X

1.5 1.0 0.5 0.0 0.5 1.0 1.5

Y

Bayesian Regression (D=1000)

true(sin) predict train

(59)

通常のガウス過程モデルのフィッティングにはO(n3)の計算が必要

nが大きいときはRandom Feature Map法による近似を利用化

カーネル関数に対応する特徴ベクトルをランダムにサンプリング

0 1 2 3 4 5 6

X

1.5 1.0 0.5 0.0 0.5 1.0 1.5

Y

Bayesian Regression (D=1000)

true(sin) predict train

(60)

通常のガウス過程モデルのフィッティングにはO(n3)の計算が必要

nが大きいときはRandom Feature Map法による近似を利用化

カーネル関数に対応する特徴ベクトルをランダムにサンプリング

0 1 2 3 4 5 6

X

1.5 1.0 0.5 0.0 0.5 1.0 1.5

Y

Bayesian Regression (D=1000)

true(sin) predict train

(61)

通常のガウス過程モデルのフィッティングにはO(n3)の計算が必要

nが大きいときはRandom Feature Map法による近似を利用化

カーネル関数に対応する特徴ベクトルをランダムにサンプリング

0 1 2 3 4 5 6

X

1.5 1.0 0.5 0.0 0.5 1.0 1.5

Y

Bayesian Regression (D=1000)

true(sin) predict train

(62)

通常のガウス過程モデルのフィッティングにはO(n3)の計算が必要

nが大きいときはRandom Feature Map法による近似を利用化

カーネル関数に対応する特徴ベクトルをランダムにサンプリング

0 1 2 3 4 5 6

X

1.5 1.0 0.5 0.0 0.5 1.0 1.5

Y

Bayesian Regression (D=1000)

true(sin) predict train

(63)

通常のガウス過程モデルのフィッティングにはO(n3)の計算が必要

nが大きいときはRandom Feature Map法による近似を利用化

カーネル関数に対応する特徴ベクトルをランダムにサンプリング

0 1 2 3 4 5 6

X

1.5 1.0 0.5 0.0 0.5 1.0 1.5

Y

Bayesian Regression (D=1000)

true(sin) predict train

(64)

トンプソンサンプリングが手軽

確率モデル

(65)

プール型に比べ,さまざまな面で困難

獲得関数の最大化=複雑な非凸関数の最大化

PI EI

Random Feature Map +トンプソンサンプリングがよい

(66)

ハイパーパラメータの決定

周辺尤度が最大となるハイパーパラメータを選択(通常は,ガウ ス過程モデルのパッケージにそのような機能あり)

ウォームスタート

ブラックボックス関数の近似関数が得られるときは,両者の差を ガウス過程モデルでモデル化すると効率がよい

停止基準

ガウス過程モデルがブラックボックス関数をうまく表現できてい るならば,PIやEIの値が一定以下になれば終了

(67)
(68)

ベイズ線形モデルをカーネル化した非線形モデルはガウス過程モ デルと呼ばれており,様々な分野で利用されている

ガウス過程モデルは逐次的な能動学習における不確実性のモデル 化に有用であり,ベイズ最適化と呼ばれている

ベイズ最適化は材料情報学分野の実験計画で着目されており,さ まざまな拡張・発展がみられる

参照

関連したドキュメント

Max-flow min-cut theorem and faster algorithms in a circular disk failure model, INFOCOM 2014...

Optimal stochastic approximation algorithms for strongly convex stochastic composite optimization I: A generic algorithmic framework.. SIAM Journal on Optimization,

情報理工学研究科 情報・通信工学専攻. 2012/7/12

最大消滅部分空間問題 MVSP Maximum Vanishing Subspace Problem.. MVSP:

参考文献 Niv Buchbinder and Joseph (Seffi) Naor: The Design of Com- petitive Online Algorithms via a Primal-Dual Approach. Foundations and Trends® in Theoretical Computer

"A matroid generalization of the stable matching polytope." International Conference on Integer Programming and Combinatorial Optimization (IPCO 2001). "An extension of

I Samuel Fiorini, Serge Massar, Sebastian Pokutta, Hans Raj Tiwary, Ronald de Wolf: Exponential Lower Bounds for Polytopes in Combinatorial Optimization. Gerards: Compact systems for

送料 コスト