什么是GPflow
GPflow是一個(gè)高斯過(guò)程的工具包,接口部分由python實(shí)現(xiàn),內(nèi)部的部分計(jì)算則由TensorFlow實(shí)現(xiàn)。
主要特點(diǎn)有二個(gè):一是使用變分推理作為近似方法,二是使用自動(dòng)微分進(jìn)行求導(dǎo)。
安裝
首先到GPflow官方頁(yè)面將代碼包下載到本地,然后進(jìn)入代碼包根目錄,在終端輸入pip install . 即可安裝。
GPy 與 GPflow之間的區(qū)別
GPflow很多核心的類和方法都參考了GPy,不過(guò)GPflow使用TensorFlow使得代碼及其簡(jiǎn)潔!
- GPflow 利用 TensorFlow 使得計(jì)算更快,適合更復(fù)雜的運(yùn)算。
- GPflow 代碼量比 GPy 少的多,因?yàn)槭褂?TensorFlow。
- GPflow 的推理部分實(shí)現(xiàn)了變分推理(VI)和MCMC,沒(méi)有實(shí)現(xiàn)期望傳播(EP)和拉普拉斯近似(Laplace approximation)。
- GPflow 沒(méi)有支持畫圖模塊。
GPflow的模塊
GPflow.models模塊實(shí)現(xiàn)了主要的GP模型。
- Regression: GPflow支持高斯回歸。對(duì)于噪音為高斯過(guò)程的情況,即最普通的高斯回歸,在推理階段可以直接通過(guò)解析表達(dá)式求
,實(shí)現(xiàn)見(jiàn)
gpflow.models.GPR。GPflow也支持稀疏高斯回歸,實(shí)現(xiàn)見(jiàn)gpflow.models.SGPR。- Variational inference: 通過(guò)變分推理方法,我們可以用高斯分布來(lái)估計(jì)隱函數(shù)
的后驗(yàn)分布
,實(shí)現(xiàn)見(jiàn) [2]
gpflow.models.VGP,[3]gpflow.models.SVGP。- MCMC: 通過(guò)MCMC,我們可以對(duì)
采樣,然后求平均得到最終預(yù)測(cè)值
。實(shí)現(xiàn)見(jiàn)
gpflow.models.GPMC和gpflow.models.SGPMC。
GPflow.params模塊是GPflow的基石之一。
Parameter用來(lái)存儲(chǔ)GP模型的各種參數(shù),如協(xié)方差函數(shù)的length-scale參數(shù)。Parameterized中存儲(chǔ)了各種Parameter,也定義了在這些Parameter節(jié)點(diǎn)上的一系列運(yùn)算。各種先驗(yàn)分布,協(xié)方差函數(shù),GP模型都繼承 了Parameterized類。
GPflow.core模塊是關(guān)于tensorflow、自動(dòng)求導(dǎo)等內(nèi)容的。
最后,Matthews的博士論文[8]系統(tǒng)闡述了以上內(nèi)容,可以作為更詳細(xì)的參考。
參考文獻(xiàn)
[1] MCMC for Variationally Sparse Gaussian Processes J Hensman, A G de G Matthews, M Filippone, Z Ghahramani Advances in Neural Information Processing Systems, 1639-1647, 2015.
[2] The variational Gaussian approximation revisited M Opper, C Archambeau Neural computation 21 (3), 786-792, 2009.
[3] Scalable Variational Gaussian Process Classification J Hensman, A G de G Matthews, Z Ghahramani Proceedings of AISTATS 18, 2015.
[4] Variational Learning of Inducing Variables in Sparse Gaussian Processes. M Titsias Proceedings of AISTATS 12, 2009.
[5] On Sparse variational methods and the Kullback-Leibler divergence between stochastic processes A G de G Matthews, J Hensman, R E Turner, Z Ghahramani Proceedings of AISTATS 19, 2016.
[6] Gaussian process latent variable models for visualisation of high dimensional data. Lawrence, Neil D. Advances in Neural Information Processing Systems, 329-336, 2004.
[7] Bayesian Gaussian Process Latent Variable Model. Titsias, Michalis K., and Neil D. Lawrence. Proceedings of AISTATS, 2010.
[8] Scalable Gaussian process inference using variational methods. Alexander G. de G. Matthews. PhD Thesis. University of Cambridge, 2016.