看穿機(jī)器學(xué)習(xí)(W-GAN模型)的黑箱
2017-03-01 by:CAE仿真在線 來源:互聯(lián)網(wǎng)

圖a. Principle of GAN.
這學(xué)期,老顧在講授一門研究生水平的數(shù)字幾何課程,目前講到了2016年和丘成桐先生、羅鋒教授共同完成的一個幾何定理【3】,這個工作給出了經(jīng)典亞歷山大定理(Alexandrov Theorem)的構(gòu)造性證明,也給出了最優(yōu)傳輸理論(Optimal Mass Transportation)的一個幾何解釋。
這幾天,機(jī)器學(xué)習(xí)領(lǐng)域的Wasserstein GAN突然變得火熱,其中關(guān)鍵的概念可以完全用我們的理論來給出幾何解釋,這允許我們在一定程度上親眼“看穿”傳統(tǒng)機(jī)器學(xué)習(xí)中的“黑箱”。
下面是老顧下周一授課的講稿。
訓(xùn)練模型 生成對抗網(wǎng)絡(luò)GAN (Generative Adversarial Networks)是一個“自相矛盾”的系統(tǒng),就是以己之矛克以己之盾,在矛盾中發(fā)展,使得矛更加鋒利,盾更加強(qiáng)韌。這里的矛被稱為是判別器(Descriminator),這里的盾被稱為是生成器(Generator)。

圖b. Generative Model.
生成器G一般是將一個隨機(jī)變量(例如高斯分布,或者均勻分布),通過參數(shù)化的概率生成模型(通常是用一個深度神經(jīng)網(wǎng)來進(jìn)行參數(shù)化),進(jìn)行概率分布的逆變換采樣,從而得到一個生成的概率分布。判別器D也通常采用深度卷積神經(jīng)網(wǎng)。

圖1. GAN的算法流程圖。
矛盾的交鋒過程如下:給定真實(shí)的數(shù)據(jù),其內(nèi)部的統(tǒng)計(jì)規(guī)律表示為概率分布
,我們的目的就是能夠找出
,我們希望
盡量接近
。為了區(qū)分真實(shí)概率分布
和生成概率分布
。
第一項(xiàng)不依賴于生成器G, 此式也可以定義GAN中的生成器的損失函數(shù)。
在訓(xùn)練中,判別器D和生成器G交替學(xué)習(xí),最終達(dá)到納什均衡(零和游戲),判別器無法區(qū)分真實(shí)樣本和生成樣本。
優(yōu)點(diǎn) GAN具有非常重要的優(yōu)越性。當(dāng)真實(shí)數(shù)據(jù)的概率分布不可計(jì)算的時候,傳統(tǒng)依賴于數(shù)據(jù)內(nèi)在解釋的生成模型無法直接應(yīng)用。但是GAN依然可以使用,這是因?yàn)镚AN引入了內(nèi)部對抗的訓(xùn)練機(jī)制,能夠逼近一下難以計(jì)算的概率分布。更為重要的,Yann LeCun一直積極倡導(dǎo)GAN,因?yàn)镚AN為無監(jiān)督學(xué)習(xí)提供了一個強(qiáng)有力的算法框架,而無監(jiān)督學(xué)習(xí)被廣泛認(rèn)為是通往人工智能重要的一環(huán)。
缺點(diǎn) 原始GAN形式具有致命缺陷:判別器越好,生成器的梯度消失越嚴(yán)重。我們固定生成器G來優(yōu)化判別器D??疾烊我庖粋€樣本
兩邊對
代入生成器損失函數(shù),我們得到所謂的Jensen-Shannon散度(JS)

。
在這種情況下(判別器最優(yōu)),如果

改進(jìn) 本質(zhì)上,JS散度給出了概率分布



為此,我們引入最優(yōu)傳輸?shù)膸缀卫碚?Optimal Mass Transportation),這個理論可視化了W-GAN的關(guān)鍵概念,例如概率分布,概率生成模型(生成器),Wasserstein距離。更為重要的,這套理論中,所有的概念,原理都是透明的。例如,對于概率生成模型,理論上我們可以用最優(yōu)傳輸?shù)目蚣苋〈疃壬窠?jīng)網(wǎng)絡(luò)來構(gòu)造生成器,從而使得黑箱透明。
給定歐氏空間中的一個區(qū)域

,上面定義有兩個概率測度

和

,滿足

,
我們尋找一個區(qū)域到自身的同胚映射(diffeomorphism),

, 滿足兩個條件:保持測度和極小化傳輸代價(jià)。
保持測度 對于一切波萊爾集

,

換句話說映射T將概率分布

映射成了概率分布

,記成

。直觀上,自映射

,帶來體積元的變化,因此改變了概率分布。我們用

和

來表示概率密度函數(shù),用


,

,
這被稱為是雅克比方程(Jacobian Equation)。
最優(yōu)傳輸映射 自映射

的傳輸代價(jià)(Transportation Cost)定義為
在所有保持測度的自映射中,傳輸代價(jià)最小者被稱為是最優(yōu)傳輸映射(Optimal Mass Transportation Map),亦即:

,
最優(yōu)傳輸映射的傳輸代價(jià)被稱為是概率測度

和概率測度

之間的Wasserstein距離,記為

。
在這種情形下,Brenier證明存在一個凸函數(shù)

,其梯度映射

就是唯一的最優(yōu)傳輸映射。這個凸函數(shù)被稱為是Brenier勢能函數(shù)(Brenier potential)。
由Jacobian方程,我們得到Brenier勢滿足蒙日-安培方程,梯度映射的雅克比矩陣是Brenier勢能函數(shù)的海森矩陣(Hessian Matrix),

。
蒙日-安培方程解的存在性、唯一性等價(jià)于經(jīng)典的凸幾何中的亞歷山大定理(Alexandrov Theorem)。

圖2. 亞歷山大定理。
亞歷山大定理 如圖2所示,給定平面凸區(qū)域

,考察一個開放的凸多面體

,選定一個面

,

的法向量記為

,

的投影和


凸多面體可以被
后面,我們可以看到,這個凸多面體就是Brenier勢能函數(shù),其梯度映射將一個概率分布

映到另外一個概率分布

Wasserstein-GAN模型中,關(guān)鍵的概念包括概率分布(概率測度),概率測度間的最優(yōu)傳輸映射(生成器),概率測度間的Wasserstein距離。下面,我們詳細(xì)解釋每個概念所對應(yīng)的構(gòu)造方法,和相應(yīng)的幾何意義。
概率分布 GAN模型中有兩個至關(guān)重要的概率分布(probability measure),一個是真實(shí)數(shù)據(jù)的概率分布
,一個是生成數(shù)據(jù)的概率分布

圖3. 由保角變換(conformal mapping)誘導(dǎo)的圓盤上概率測度。
概率測度可以看成是一種推廣的面積(或者體積)。我們可以用幾何變換隨意構(gòu)造一個概率測度。如圖3所示,我們用三維掃描儀獲取一張人臉曲面,那么人臉曲面上的面積就是一個概率測度。我們縮放變換人臉曲面,使得總曲面等于
我們可以將以上的描述嚴(yán)格化。人臉曲面記為
,其上具有黎曼度量
。平面圓盤記為
,平面坐標(biāo)為
,平面的歐氏度量為
。保角映射記為
則
,這里面積變換率函數(shù)
給出了概率密度函數(shù)。
誘導(dǎo)了圓盤
上的一個概率測度
。

圖4. 兩個概率測度之間的最優(yōu)傳輸映射。
最優(yōu)傳輸映射 圓盤上本來有均勻分布


,則存在唯一的最優(yōu)傳輸映射

。圖4顯示了這個映射


圖5. 離散最優(yōu)傳輸。
離散最優(yōu)傳輸映射 最優(yōu)傳輸映射的數(shù)值計(jì)算非常幾何化,因此可以直接被可視化。我們將目標(biāo)概率測度離散化,表示成一族離散點(diǎn),
;每點(diǎn)被賦予一個狄拉克測度,
,滿足
。然后,我們求得單位圓盤的一個胞腔分解,
,每個胞腔
映到相應(yīng)的目標(biāo)點(diǎn)
,
。映射保持概率測度,胞腔的面積等于目標(biāo)測度,
同時極小化傳輸代價(jià),

圖6. 離散Brenier勢能函數(shù),離散最優(yōu)傳輸映射。
離散Brenier勢能 離散最優(yōu)傳輸映射是離散Brenier勢能函數(shù)的梯度映射。對于每一個目標(biāo)離散點(diǎn)
,我們構(gòu)造一個平面
,這里平面的截距
的圖(Graph),
。
圖6左側(cè)顯示了離散Briener勢能函數(shù)。凸多面體在平面上的投影構(gòu)成了平面的胞腔分解,凸多面體的每個面
被映成了一個胞腔
;每個面
的梯度都是
,因此Brenier勢能函數(shù)的梯度映射就是
。
根據(jù)保測度性質(zhì),每個胞腔
的面積應(yīng)該等于指定面積
。由此,我們調(diào)節(jié)平面的截距
離散Wasserstein距離 我們和丘成桐先生建立了變分法來求取平面的截距
。給定截距向量
,平面族為
,其上包絡(luò)構(gòu)成的Briener勢能函數(shù)為
, 上包絡(luò)的投影生成了平面的胞腔分解
, 胞腔的面積記為
。我們定義的能量為,
這個能量在子空間
圖7給出了柱體體積的可視化,柱體體積

圖7. 離散Brenier勢能函數(shù)的圖截出的柱體體積
。
體積函數(shù)
,其圖



,函數(shù)的切線的斜率為y,則此切線的截距滿足

,
這被稱為是函數(shù)

的勒讓德變換。

以切線的斜率為參數(shù),以切線的截距為函數(shù)值。

圖8.凸函數(shù)的圖像由其切線包絡(luò)而成,切線集合被表示成原函數(shù)的勒讓德對偶。
因?yàn)?/span>
的凸性,映射
是微分同胚,記為
。那么,原函數(shù)和勒讓德變換后的函數(shù)滿足關(guān)系:

,
這里c,d是常數(shù)。原函數(shù)和其勒讓德變換的直觀圖解由圖9給出。我們在xy-平面上畫出曲線

,曲線下面的面積是

,曲線上面的面積是勒讓德變換

。

圖9. 圖解勒讓德變換。
勒讓德變換的幾何圖景對任意維都對。我們下面來考察體積函數(shù)

的勒讓德變換

。根據(jù)定義,

,
假如我們變動截距

,或者等價(jià)地變動胞腔面積

,考察兩個胞腔交界處

,

,
p本來屬于

,變化后屬于

,所有這種點(diǎn)的總面積為

。則為Wasserstein距離帶來的變化是:

因此,總的Wasserstein距離的變化是

。
由此我們看到Wasserstein距離等于

,
其非線性部分是柱體積的勒讓德變換。
通過以上討論,我們看到給定兩個概率分布

,則存在唯一的一個凸函數(shù)(Brenier 勢函數(shù))

,其梯度映射

把一個概率分布

在Wasserstein-GAN模型中,通常生成器和判別器是用深度神經(jīng)網(wǎng)絡(luò)來實(shí)現(xiàn)的。根據(jù)最優(yōu)傳輸理論,我們可以用Briener勢函數(shù)來代替深度神經(jīng)網(wǎng)絡(luò)這個黑箱,從而使得整個系統(tǒng)變得透明。在另一層面上,深度神經(jīng)網(wǎng)絡(luò)本質(zhì)上是在訓(xùn)練概率分布間的傳輸映射,因此有可能隱含地在學(xué)習(xí)最優(yōu)傳輸映射,或者等價(jià)地Brenier勢能函數(shù)。對這些問題的深入了解,將有助于我們看穿黑箱。

圖10. 基于二維最優(yōu)傳輸映射計(jì)算的曲面保面積參數(shù)化(area preserving parameterization),蘇政宇作。


圖11. 基于三維最優(yōu)傳輸映射計(jì)算的保體積參數(shù)化 (volume preserving parameterization),蘇科華作。
(在2016年,老顧撰寫了多篇有關(guān)最優(yōu)傳輸映射的博文,非常欣慰地看到這些文章啟發(fā)了一些有心的學(xué)者,發(fā)表了SIGGRAPH論文,申請了NSF基金。感謝大家關(guān)注老顧談幾何,希望繼續(xù)給大家靈感。)
[1]Arjovsky, M. & Bottou, L.eon (2017) Towards Principled Methods for Training Generative Adversarial Networks
[2] Arjovsky, M., Soumith, C. & Bottou, L.eon (2017) Wasserstein GAN.
[3] Xianfeng Gu, Feng Luo, Jian Sun and Shing-Tung Yau, Variational Principles forMinkowski Type Problems, Discrete Optimal Transport, and Discrete Monge-Ampere
Equations, Vol. 20, No. 2, pp. 383-398, Asian Journal of Mathematics (AJM), April 2016.
相關(guān)標(biāo)簽搜索:看穿機(jī)器學(xué)習(xí)(W-GAN模型)的黑箱 有限元技術(shù)培訓(xùn) 有限元仿真理論研究 有限元基礎(chǔ)理論公式 能量守恒質(zhì)量守恒動量守恒一致性方程 有限體積法 什么是有限元 有限元基礎(chǔ)知識 有限元軟件下載 有限元代做 Fluent、CFX流體分析 HFSS電磁分析 Ansys培訓(xùn)