Python利用Gausian Process對Hyper-parameter進(jìn)行調(diào)參

導(dǎo)語

在做模型的時(shí)候發(fā)現(xiàn)調(diào)參尤其是調(diào)Hyper-parameter真是惆悵T T……像Logistic Regression、SVM這類參數(shù)少的還能憑感覺手動(dòng)調(diào)調(diào),遇上Random Forest、AdaBoost這些參數(shù)多的咬著牙也能調(diào)出好結(jié)果,說到神經(jīng)網(wǎng)絡(luò),那就真是無語淚先流了……是時(shí)候考慮如何才能高效調(diào)參了(握拳)!

1. Grid Search

顧名思義,Grid Search將所有參數(shù)劃分成網(wǎng)格,網(wǎng)格中任意一個(gè)點(diǎn)所代表的參數(shù)組合都有可能最優(yōu)參數(shù)搭配。
Grid Search一個(gè)明顯的優(yōu)勢在于它能完全遍歷(brute-force search method)所有用戶所指定的參數(shù)搭配,但也因此引發(fā)了它最大的缺點(diǎn):效率低,因此也無法普適地有效解決Hyper-parameter調(diào)參問題。

The number of grid points increases exponentially with the number of decision variables, which makes it computationally very costly.
Source: Parameter Tuning Using Gaussian Processes (Jinjin Ma, The university of Waikato, 2012)

Flowchart of general search algorithm for two parameters Source: Parameter Tuning Using Gaussian Processes (Jinjin Ma, The university of Waikato, 2012)

2. Randomized Search

Randomized Search為模型隨機(jī)選取參數(shù)(Stochastic Search Process),選取用戶指定次數(shù)后,從中選擇效果最好的參數(shù)搭配。其中選取的參數(shù)點(diǎn)來源于通過網(wǎng)格劃分所得到的參數(shù)點(diǎn)(劃分過程與Grid Search同)。事實(shí)上,對于很多數(shù)據(jù)集和一些常用的算法,Random Search都表現(xiàn)不俗。


Grid Search vs. Randomized Search Source: Random Search for Hyper-Parameter Optimization (James Bergstra & Yoshua Bengio, 2012)

3. Gaussian Process Optimization

關(guān)于利用高斯過程調(diào)參,一個(gè)不得不提到的概念就是Expected Improvement。

The basic idea underlying EI is to estimate the improvement of possible candidate points over the current best value and to sample at the particular point next where the expected improvement is maximum.

而利用高斯過程進(jìn)行優(yōu)化的目標(biāo)就是在盡可能少的嘗試中挑選出最佳的參數(shù)組合。
不知死活的筆者發(fā)現(xiàn)了一個(gè)大牛運(yùn)用Gaussian Process實(shí)現(xiàn)的Bayesian Optimization。但是不知道為什么,當(dāng)筆者用這個(gè)包對幾個(gè)以前已經(jīng)調(diào)好參的模型進(jìn)行調(diào)參時(shí),結(jié)果并不如之前的結(jié)果好,所以在這一方面還有待于更深入的研究。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容