基於高斯過程的貝葉斯優化(三)GP超參數的估計


前面的文章大致描述了基於高斯過程(GP)貝葉斯優化的原理框架,該框架中也存在了幾個參數,本篇文章簡單介紹如何對他們進行估計。

首先介紹一下貝葉斯優化框架的超參數有哪些:

回憶我們將高斯過程表述為以下形式:

\[f ( x ) \sim G P \left( m ( x ) , k \left( x , x ^ { \prime } \right) \right)\]

其中$m(x)$表示均值函數,一般都設為0,不需要更新,我們更關心的是核函數k,核函數的選取主要有兩種:squared exponential kernel以及Matern kernel

下面給出兩種核函數的具體形式:

squared exponential kernel:

\[k \left( \mathbf { x } _ { i } , \mathbf { x } _ { j } \right) = \exp \left( - \frac { 1 } { 2 } \left( \mathbf { x } _ { i } - \mathbf { x } _ { j } \right) ^ { T } \operatorname { diag } ( \boldsymbol { \theta } ) ^ { - 2 } \left( \mathbf { x } - \mathbf { x } ^ { \prime } \right) \right)\]

其中$\operatorname { diag }\boldsymbol( { \theta })$表示對角陣

Matern kernel:

\[k \left( \mathbf { x } _ { i } , \mathbf { x } _ { j } \right) = \frac { 1 } { 2 ^ { < - 1 } \Gamma ( \zeta ) } \left( 2 \sqrt { \zeta } \left\| \mathbf { x } _ { i } - \mathbf { x } _ { j } \right\| \right) ^ { \zeta } H _ { \zeta } \left( 2 \sqrt { \zeta } \left\| \mathbf { x } _ { i } - \mathbf { x } _ { j } \right\| \right)\]

實踐中,Jasper Snoek[1]推薦采用Matern kernel。

問題在於如何對核函數中存在的超參數進行估計呢?

實際中一般有兩種方法,極大似然與MCMC估計法,先介紹采用極大似然方法更新超參數。

 

極大似然方法

極大似然通過直接使得GP超參數$\theta$的后驗分布最大化進行計算。

\[L = \log p ( y | \theta ) = - \frac { 1 } { 2 } y ^ { T } \left( K + \sigma _ { n } ^ { 2 } I \right) ^ { - 1 } y - \frac { 1 } { 2 } \log \left| K + \sigma _ { n } ^ { 2 } I \right| - \frac { n } { 2 } \log 2 \pi\]

注意這里的形式是加了噪聲項的高斯模型。其中$y  = f \left( \mathbf { x }  \right) + \epsilon,$,並且$\epsilon \sim \mathcal { N } \left( 0 , \sigma _ { \text { noise } } ^ { 2 } \right)$,此時的協方差矩陣K為

\[\mathbf { K } = \left[ \begin{array} { c c c } { k \left( \mathbf { x } _ { 1 } , \mathbf { x } _ { 1 } \right) } & { \dots } & { k \left( \mathbf { x } _ { 1 } , \mathbf { x } _ { t } \right) } \\ { \vdots } & { \ddots } & { \vdots } \\ { k \left( \mathbf { x } _ { t } , \mathbf { x } _ { 1 } \right) } & { \dots } & { k \left( \mathbf { x } _ { t } , \mathbf { x } _ { t } \right) } \end{array} \right] + \sigma _ { \text { nois } } ^ { 2 } I\]

此時:

\[P \left( y _ { t + 1 } | \mathcal { D } _ { 1 : t } , \mathbf { x } _ { t + 1 } \right) = \mathcal { N } \left( \mu _ { t } \left( \mathbf { x } _ { t + 1 } \right) , \sigma _ { t } ^ { 2 } \left( \mathbf { x } _ { t + 1 } \right) + \sigma _ { \text { noise } } ^ { 2 } \right)\]

其中

\[\mu _ { t } \left( \mathbf { x } _ { t + 1 } \right) = \mathbf { k } ^ { T } \left[ \mathbf { K } + \sigma _ { \text { noise } } ^ { 2 } I \right] ^ { - 1 } \mathbf { y } _ { 1 : t }\]

\[\sigma _ { t } ^ { 2 } \left( \mathbf { x } _ { t + 1 } \right) = k \left( \mathbf { x } _ { t + 1 } , \mathbf { x } _ { t + 1 } \right) - \mathbf { k } ^ { T } \left[ \mathbf { K } + \sigma _ { \text { noise } } ^ { 2 } I \right] ^ { - 1 } \mathbf { k }\]

 

MCMC方法

MCMC方法是通過馬爾科夫鏈實現對一個復雜分布p(x)進行采樣的技術。這里直接略過對MCMC方法的基本介紹。

注意到我們的最終目的仍然是求模型M中某個特定超參數下acquisition function值,因此,可以通過條件概率方法進行展開

\[\hat { a } \left( \mathbf { x } ; \left\{ \mathbf { x } _ { n } , y _ { n } \right\} \right) = \int a \left( \mathbf { x } ; \left\{ \mathbf { x } _ { n } , y _ { n } \right\} , \theta \right) p ( \theta | \left\{ \mathbf { x } _ { n } , y _ { n } \right\} _ { n = 1 } ^ { N } ) \mathrm { d } \theta\]

這里的$\theta$表示GP中的超參數,而 $\left\{ \mathbf { x } _ { n } , y _ { n } \right\} _ { n = 1 } ^ { N }$表示的針對模型M選擇超參數(x)並進行評估的結果(y)。為了估計這個積分的值,我們需要實現對分布$ p ( \theta | \left\{ \mathbf { x } _ { n } , y _ { n } \right\} _ { n = 1 } ^ { N } )$的采樣。注意到這里

\[p ( \theta | \left\{ \mathbf { x } _ { n } , y _ { n } \right\} _ { n = 1 } ^ { N } ) \propto p(\theta) p(\left\{ \mathbf { x } _ { n } , y _ { n } \right\} _ { n = 1 } ^ { N } | \theta)\]

也就是說只要再給GP超參數$\theta$提供一個先驗讓上式右邊可以具體計算,分布$ p ( \theta | \left\{ \mathbf { x } _ { n } , y _ { n } \right\} _ { n = 1 } ^ { N } )$就能通過MCMC方法就行采樣。在這里還存在一個問題,當對$\theta$進行采樣時,如果采用Metropolis-Hastings采樣方法,由於接受率可能很低,而在計算接受概率時勢必需要根據新采樣的$\theta$重新計算其后驗概率,這可能造成很大的計算開銷,因此Iain Murray[2]等人改進了Elliptical Slice sampling方法進行采樣,並取得了較好的效果。

 

References

[1] Snoek J , Larochelle H , Adams R P . Practical Bayesian Optimization of Machine Learning Algorithms[J]. Advances in neural information processing systems, 2012.

[2] Murray I , Adams R P . Slice sampling covariance hyperparameters of latent Gaussian models[C]// International Conference on Neural Information Processing Systems. Curran Associates Inc. 2010.

[3] Brochu E , Cora V M , De Freitas N . A Tutorial on Bayesian Optimization of Expensive Cost Functions, with Application to Active User Modeling and Hierarchical Reinforcement Learning[J]. Computer Science, 2010.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM