Jekyll2023-03-27T11:23:41+00:00https://shryu8902.github.io/feed.xmlShryu8902’s Blog개인 블로그입니다.류승형shryu8902@naver.comhttps://scholar.google.co.kr/citations?user=eRyqoEcAAAAJ&hl=en[논문 겉핥기] MLP-mixer2021-06-07T00:00:00+00:002021-06-07T00:00:00+00:00https://shryu8902.github.io/paper/mlp_mixer<h1 id="mlp-mixer-an-all-mlp-architecture-for-vision">MLP-Mixer: An all-MLP Architecture for Vision</h1>
<p><strong>https://arxiv.org/abs/2105.01601</strong></p>
<p>MLP-Mixer (이하 믹서)는 컴퓨터 비전을 위한 MLP만으로 구성된 딥러닝 모델이다.</p>
<h2 id="1-introduction">1. Introduction</h2>
<p>컴퓨터 비전 분야에서는 convolution 연산에 기반한 CNN 모델이 주름잡고 있다. 한편 자연어 처리 분야에서 RNN 이후 널리 활용되는 attention 기반의 transformer 구조를 컴퓨터 비전 분야에 접목하여 탄생한 Vision Transformer (ViT)는 state-of-the-art performance를 달성했다.</p>
<p>본 논문에서는 가장 기본적인 인공신경망인 MLP (Multi-layer perceptron)을 활용한 믹서를 제안한다. 믹서는 convolution이나 self-attention을 사용하지 않지만, SOTA에 가까운 퍼포먼스를 얻을 수 있었다.</p>
<h2 id="2-how">2. How?</h2>
<ol>
<li>Image as a sequence of patch.</li>
<li>Mixing in a) channel, and b) token.</li>
</ol>
<h2 id="3-ideas">3. Ideas</h2>
<h3 id="31-image-as-a-sequence-of-patch">3.1 Image as a sequence of patch.</h3>
<p>기존 CNN 모델은 이미지를 W (가로) x H (세로) x C (채널)의 텐서로 보고 컨볼루션 연산을 통해서 W’ x H’ x C 의 지역적 특성들을 추출하여 활용함. 따라서 컨볼루션 레이어가 stacking 됨에 따라서 상위 레이어에서 필터가 커버하는 범위 (receptive field)가 증가함.
MLP-mixer는 이미지를 겹치지 않는 작은 패치들의 시퀀스로 봄. 즉 W x H x C의 텐서가 S x C’ 텐서로 바뀌는데, S는 이미지 패치의 수, C’은 패치로부터 추출된 feature임. 예를들어 전체 이미지를 16 x 16 pixel의 이미지 패치로 전부 자르고, 각 패치는 NLP에서의 워드 임베딩 처럼 C’ 차원의 벡터로 즉 토큰 (token)으로 변환됨. 여기서 토큰으로의 변환은 projection matrix를 통한 linear transformation임.</p>
<h3 id="32-channel-mixing-and-token-mixing-mlp">3.2 Channel mixing and token mixing MLP.</h3>
<p>Mixer 레이어는 MLP를 통해서 channel mixing operation과 token mixing operation을 수행함. 따라서 per-location operation과 cross-location operation을 explicit 하게 분리함.</p>
<p>token-mixing MLP는 채널을 고정시키고 (S x 1), MLP를 통한 nonlinear transform을 수행해서 다시 (S x 1) 벡터를 얻음. 각 패치는 특정 location에 대한 정보를 가지고 있고 채널이 고정된 상태이므로 token-mixing MLP는 특정 채널에서 패치들 사이의 관계를 학습하여 cross-location operation임.</p>
<p>channel-mixing MLP는 패치를 고정시키고 (1 X C’), nonlinear transform을 수행한 (1 x C’) 벡터를 얻음. 패치가 고정되어있기때문에 location의 특징을 고려하여 per-location operation임.</p>
<p>각각의 연산에서 skip connection과 layer normalization을 포함하고 있음.</p>
<p>전체적인 구조는 그림과 같음.</p>
<table>
<tbody>
<tr>
<td><img src="/assets/images/mixer.PNG" alt="mixer" /></td>
</tr>
<tr>
<td>* Mixer 구조 *</td>
</tr>
</tbody>
</table>류승형shryu8902@naver.comhttps://scholar.google.co.kr/citations?user=eRyqoEcAAAAJ&hl=enMLP-Mixer: An all-MLP Architecture for Vision[논문 겉핥기] Informer2021-06-02T00:00:00+00:002021-06-02T00:00:00+00:00https://shryu8902.github.io/paper/Informer<h1 id="informer-beyond-efficient-transformer-for-long-sequence-time-series-forecasting">Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting</h1>
<p><strong>https://arxiv.org/abs/2012.07436</strong></p>
<p>인포머는 트랜스포머 구조를 바탕으로 장기 시계열 예측 (Long sequence time-series forecasting, LSTF)을 효과적으로 수행하기 위한 딥러닝 모델이다.</p>
<h2 id="1-backgrounds">1. Backgrounds</h2>
<p>LSTF를 효과적으로 수행하기 위해서는 <strong>(a) extra ordinary long-range alignment ability</strong>와 <strong>(b) efficient operations on long sequence inputs and output</strong>이 필요하다. 트랜스포머는 (a)를 수행함에 있어서 탁월한 능력을 보이지만 (b) 측면에서 약점을 가지고 있다.
이러한 약점을 다시 요약하면 다음과 같다.</p>
<ol>
<li>The quadratic computation of self-attention. » 어텐션 스코어 연산에서 수행되는 dot product 텀에 의해 메모리와 시간이 $\mathcal{O}(L^2)$로 소요.</li>
<li>The memory bottlenect in stacking layers ofr long inputs. » 1번 항목의 quadratic term이 레이어 수에 따라 비례하여 증가.</li>
<li>The speed plunge in predicting long outputs. » 스텝바이스텝으로 incremental하게 forecasting을 수행하여 엄청나게 긴 시퀀스를 예측할 때 오래걸림.</li>
</ol>
<p>기존 논문들은 1번 문제를 해결하는데 중점을 두는데, 인포머는 1,2,3의 제약사항을 모두 포괄한다.</p>
<h2 id="2-how">2. How?</h2>
<ol>
<li>ProbSparse self-attention을 제안하여 $\mathcal{O}(L^2)$를 $\mathcal{O}(L\text{log}L)$로 줄임.</li>
<li>Self-attention distilling을 제안하여 J개의 레이어에 사용되는 메모리를 $\mathcal{O}((2-\epsilon)L \text{log} L)$로 줄임.</li>
<li>Generative style decoder를 제안하여 one-forward step으로 전체 시퀀스를 예측함.</li>
</ol>
<h2 id="3-ideas">3. Ideas</h2>
<h3 id="31-probsparse-self-attention">3.1 ProbSparse self-attention</h3>
<p>기존 dot product attention을 수행하는 경우 query, key, value matrix $(Q,K,V)$에 대해 row-wise로 dot product를 계산하기때문에 computation과 memory가 row의 수에 따라 $\mathcal{O}(L_Q L_K)$가 필요함.
그런데 특정 쿼리는 특정 키에 반응하는 것이 자연스럽기 때문에 이러한 attention mechanism 상에서 sparse한 성질을 고려하는 것이 효과적임.
그래서 sparsity를 갖는 쿼리들을 selective하게 사용할 것이고 query의 sparsity를 측정하기 위한 Query sparsity measurement $M(q_i,K)$을 제안함. 즉 M값이 높은 애들은 attention score가 sparse하게 분포되어있다는 것임.
Top $u=c\cdot \text{ln}L_Q$ 개의 query만을 사용함.
그러나 여전히 M 계산 과정에서 row-wise로 계산해야하기 때문에 $\mathcal{O}(L_Q L_K)$가 필요함.
이에 대한 empirical approximation으로 $\bar{M}$을 제안하며 $\bar{M}$은 U개의 키를 랜덤하게 샘플링 ($U=L_Q \text{ln} L_K$) 하여 sparsity measure를 연산하기때문에 마찬가지로 $\mathcal{O}(L\text{ln}L)$ complexity가 감소함.</p>
<h3 id="32-self-attention-distilling">3.2 Self-attention distilling</h3>
<p>트랜스포머에서는 입력 시퀀스의 길이가 어텐션 레이어를 통과하는 과정에서 유지됨. Self-attention distilling은 1-d conv를 통해 인접 타임스텝의 정보를 추출하고 이후 max-pooling을 사용해 레이어 통과시 시퀀스의 길이가 1/2로 감소함.</p>
<h3 id="33-generative-inference">3.3 Generative inference</h3>
<p>트랜스포머에서는 디코더에 시작 토큰을 입력하고 스텝바이스텝으로 다음 타임스텝의 값을 예측하고 붙여나감.
여기서는 디코더에 입력시퀀스를 예측 전 시퀀스의 정보 일부와 예측하고자 하는 타임스텝들의 시간적 정보를 인코딩한 값을 concatenation해서 하나의 입력 시퀀스 벡터를 만듬.
디코더는 이러한 입력 시퀀스 벡터로부터 한번에 전체 시퀀스에 대한 예측을 수행함.</p>류승형shryu8902@naver.comhttps://scholar.google.co.kr/citations?user=eRyqoEcAAAAJ&hl=enInformer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting[Machine Learning] Mean Squared Logarithmic Error2020-04-22T00:00:00+00:002020-04-22T00:00:00+00:00https://shryu8902.github.io/machine%20learning/MSLE<h1 id="mean-squared-logarithmic-error">Mean Squared Logarithmic Error</h1>
<h2 id="mean-squared-logarithmic-error-msle">Mean Squared Logarithmic Error (MSLE)</h2>
<p>MSLE의 정의는 다음과 같다.</p>
<ul>
<li>$t$ : time index, \(t\in \{ 0,....,T \}\) 또는 sample index</li>
<li>$y_t$ : 실측값</li>
<li>$f_t$ : 예측값</li>
</ul>
<table>
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><strong>MSLE</strong></td>
<td><strong>\(\frac{1}{T}\sum_{t=1}^T(log(y_t+1)-log(f_t+1))^2\)</strong></td>
<td><strong>실제와 예측의 로그값의 오차 제곱의 평균값.</strong></td>
</tr>
</tbody>
</table>
<p>MSLE의 성질.</p>
<ol>
<li>
<p>큰 $y_t$ 값에서 발생하는 오차의 영향을 줄여줌. <br />
ex. \(y_t+1=100, f_t+1=110\) 일 때와 \(y_t+1=1, f_t+1=11\) 일때 모두 squared error \((y_t-f_t)^2=100\)이지만 <br />
squared logarithmic error는 각각 0.0017, 1.08임. <br />
즉 $y_t$ 값이 클때 허용되는 절대적인 오차의 범위가 커짐. 이는 위 수식이 $y_t-f_t$인 residual 형태로 보이지만 실질적으로는 mape처럼 비율 기반의 오차이기때문.<br />
<br /> Absolute Percentage Error가 $|\frac{e}{y_t}|$ 형태라면 ($e=y_t-f_t$)
\(log(\frac{y_t+1}{f_t+1})=log(\frac{y_t^*}{f_t^*})=log(1+\frac{e}{f_t^*})\)</p>
</li>
<li>
<p>Underestimate (실측값보다 작게 예측) 보다 overforecast (실측값보다 크게 예측) 더 큰 오차를 갖는다.<br />
MAPE 가 underestimate 되는 것과 반대로 MSLE는 overestimate. <br />
Why? log 를 합치면 \(log(y_t+1/f_t+1)\)의 분수꼴이 나옴. \(a = \frac{y_t+1}{f_t+1}\) 일 때, Underestimate 케이스의 경우 \(a\geq1\), overestimate 케이스의 경우 \(a<1\). <br />
\((log(a))^2\) 그래프를 그려보면 \(a<1\) 구간의 값이 더 큰 것을 확인할 수 있음. <br />
따라서 overestimate가 더 큰 패널티를 갖음.</p>
</li>
</ol>
<table>
<tbody>
<tr>
<td><img src="/assets/images/MSLE.PNG" alt="MSLE" /></td>
</tr>
<tr>
<td>squared log(x) 그래프 개형</td>
</tr>
</tbody>
</table>류승형shryu8902@naver.comhttps://scholar.google.co.kr/citations?user=eRyqoEcAAAAJ&hl=enMean Squared Logarithmic Error[논문 정리] Wasserstein Auto-Encoders2019-01-10T00:00:00+00:002019-01-10T00:00:00+00:00https://shryu8902.github.io/paper/wae<h1 id="wasserstein-auto-encoders">Wasserstein Auto-Encoders</h1>
<p><strong>2018 / ICLR 2018 / Ilya Tolstikhin, Olivier Bousquet, Sylvain Gelly, Bernhard Schoelkopf</strong></p>
<p>본 논문은 ICLR 2018 top 100 논문 중 하나입니다.</p>
<ul>
<li>Section 3, Supplementary는 내용은 수정 중입니다.</li>
<li>잘못된 해석 + 번역이 있을 수 있습니다.</li>
</ul>
<h2 id="1-introduction">1. Introduction</h2>
<p>Generative model의 주요 모델로 VAE와 GAN이 있다.
VAE는 이론적인 접근방법이 잘 구성되어있으나, 이미지 생성시 blurry한 샘플을 생성하는 단점이있다. 반면에 GAN에서 생성하는 이미지들은 시각적으로 잘 구성된 이미지들을 생성하지만, encoder가 존재하지 않는다 (따라서 주어진 데이터로부터 latent variable $z$를 뽑아낼수 없다). 또한 상대적으로 학습이 어렵고, “Mode collapse” 문제가 발생한다. 따라서 GAN의 구성뿐만아니라 VAE와 GAN을 융합하려는 다양한 연구들이 있었다.</p>
<p>본 논문은 optimal transport (OT) 관점에서 generative model을 분석하여 ($\text{OT}\ \it{W}_c(P_X,P_G)$를 최소화하는 문제) Wasserstein Autoencoder (WAE)를 제안하였다.</p>
<ul>
<li>True data distribution : $P_X$</li>
<li>Latent variable model : $P_G$</li>
<li>Prior distribution : $P_Z$</li>
<li>Generative model of $X$ given $Z$ : $P_G(X\mid Z)$</li>
</ul>
<p>저자가 이야기하는 본 논문의 컨트리뷰션은 다음과 같다.</p>
<ul>
<li>어떠한 cost function $c$에 대한 Optimal transport $(W_c(P_X,P_G))$를 최소화하는 형태의 새로운 regularized autoencoder인 WAE 제안.<br />
VAE의 ELBO와 유사하게 objective function은 $c$-reconstruciton cost와 regularizer $\mathcal{D}_Z(P_Z,Q_Z)$로 구성되어있다.<br />
특히 $c$가 squared cost이고 $\mathcal{D_Z}$가 GAN objective일때 WAE는 Adversarial autoencoder (AAE)와 일치한다.</li>
<li>MNIST와 CelebA 데이터셋에 대해 squared cost WAE에 대한 empirical evaluation을 수행 (squared cost : ($c(x,y)=|x-y|^2_2$)).<br />
실험 결과를 통해 제안한 WAE가 VAE의 장점들을 수용하면서 (안정적인 학습, 인코더-디코더 구조, latent variable 학습) 생성된 샘플의 품질이 향상된것을 확인 할 수 있다.</li>
<li>두개의 다른 형태의 regularizer $\mathcal{D}_Z(P_Z,Q_Z)$에 대해 분석하였다. 첫번째는 GAN 기반, 두번째는 maximum mean discrepancy (MMD) 기반의 regularizer이다. 특히 두번째는 adversary없이 최적화가 가능하다는 장점이 있다.</li>
<li>WAE objective에 대한 이론적인 전개는 초기형태의 $W_c(P_X,P_G)$가 probabilistic encoder $Q(Z\mid X)$의 최적화 문제와 동일하다는 것을 보여준다.</li>
</ul>
<h2 id="2-proposed-method">2. Proposed method</h2>
<p>본 논문에서 autoencoder 구조를 통해 optimal transport $W_c(P_X,P_G)$를 최소화하는 방법을 제안한다.</p>
<blockquote>
<p>VAE와 같은 generative model의 목적은 결국 generator가 생성하는 데이터의 분포 $P_G$를 원래 데이터의 분포인 $P_X$로 만드는 것이다.
optimal transport는 $P_G$의 일부를 변형시켜 새로운 $P_{G’}$를 생성 할 때 cost가 발생하면 $P_{G’}$가 $P_X$로 될 때까지 필요한 평균 cost를 알 수 있다. 이 때 $P_G$에서 $P_X$로 변형시키는 방법은 다양하게 존재 할 수있는데, optimal transport는 그러한 평균 cost들의 하한으로 볼 수 있다.</p>
</blockquote>
<p>인코더는 상충되는 두가지 목표를 달성하도록 학습된다.</p>
<ol>
<li>Ture prior $P_Z$와 encoded distribution of training examples $Q_Z:= \mathbb{E}_{P_X}[Q(Z\mid X)]$의 matching, i.e., $\mathcal{D}_Z(Q_Z,P_Z)$의 최소화</li>
<li>Training exmaple을 복원하기에 충분히 informative한 latent code $Z$의 학습</li>
</ol>
<blockquote>
<p>위 두가지 목표는 이전에 살펴본 InfoVAE 포스트에서도 reconstruction error와 amortized inference 개념으로 언급되었다.</p>
</blockquote>
<p>논문에서는 WAE의 특징을 아래 그림과 함께 설명하고있다.</p>
<table>
<tbody>
<tr>
<td><img src="/assets/images/wae1.png" alt="WAE" /></td>
</tr>
<tr>
<td><em>VAE와 WAE의 동작 원리에 대한 비교</em></td>
</tr>
</tbody>
</table>
<blockquote>
<p>VAE는 $P_X$로부터 얻는 모든 샘플 $x$에 대해서 $Q(Z\mid X=x)$를 $P_Z$의 형태로 강제한다. 즉, 각각의 삼각형으로부터 생성되는 붉은 원이 $Q(Z\mid X=x)$를 의미하는데, 개별적으로 $P_Z$의 형태 (하얀 원)를 갖도록 만들어진다. (전체 $Q_Z$는 $Q(Z \mid X)$의 합으로 붉은 원이 중첩되는 부분의 확률이 증가하게되고 이로인해 적색 화살표로 연결되는 잘못된 reconstruciton이 발생 할 수 있다.)<br />
반면에 WAE는 개별이 아닌 $Q_Z$가 $P_Z$와 매칭되도록 만든다 ($Q_Z$의 녹색 원이 $P_Z$의 하얀 원의 형태로). 따라서 떨어져 있는 latent code $z$들은 그 reconstruction들도 떨어져있게 된다.</p>
</blockquote>
<h3 id="21-prelimniaries-and-notations">2.1. Prelimniaries and Notations</h3>
<ul>
<li>Caligraphic letter : 집합, (e.g., $\mathcal{X}$)</li>
<li>Capital letter : 확률변수, (e.g., $X$)</li>
<li>$P(X), p(x)$ : 확률 분포 / 밀도 함수</li>
<li>$f$-divergence : 두 확률 분포의 discrepancy 측정에 사용.<br />
$D_f(P_X| P_G) := \int f(\frac{p_X(x)}{p_G(x)})p_G(x)dx$
$f:(0,\infty)\to \mathcal{R}$는 $f(1)=0$을 만족하는 convex function으로, 대표적인 divergence로 Kullback-Leibler divergence, Jensen-Shannon divergence 등이 있다.</li>
</ul>
<h3 id="22-optimal-transport-and-its-dual-formulations">2.2 Optimal Transport and Its Dual Formulations</h3>
<p>두 확률 분포의 divergence는 Optimal transport 문제로부터 유도 될 수 있다.
OT problem의 Kantrobich’s formulation은 다음과 같다.</p>
\[W_c(P_X,P_G):= \underset{\Gamma \in \mathcal{P}(X\sim P_X,Y\sim P_G) }{\inf} \mathbb{E}_{(X,Y)\sim\Gamma}[c(X,Y)]\]
<p>여기서 \(c(x,y): \mathcal{X}\times\mathcal{X}\to \mathcal{R}_{+}\) 는 any measurable <em>cost function</em> 이고 $\mathcal{P}(X\sim P_X,Y\sim P_G)$는 marginal $P_X, P_G$를 갖는 $(X,Y)$의 모든 joint distribution의 집합이다.</p>
<p>특히, $(\mathcal{X},d)$가 metric space이고</p>
<blockquote>
<p>Metric space (거리 공간) : $\mathcal{X}$ 내의 두 점 사이의 거리가 distance function $d$로 정의된 공간.</p>
</blockquote>
<p>cost function $c$가 distance function에 따라 $c(x,y)=d^p(x,y)\space for\space p\geq 1$ 일 때, $W_c$의 $p$-th root인 $W_p$는 $p$-<strong><em>Wasserstein distance</em></strong> 라 한다.
그리고 $c(x,y)=d(x,y)$일때 Kantrobich-Rubinstein duality가 성립한다.</p>
<blockquote>
<p>예를들어 KL-divergence는 대칭성이 성립하지 않기때문에 distance가 아닌 divergence임.</p>
</blockquote>
<p>\(W_1(P_X,P_G)=\underset{f\in\mathcal{F}_L}{\sup}\mathbb{E}_{X\sim P_X}[f(X)]-\mathbb{E}_{Y\sim P_G}[f(Y)]\)
($\mathcal{F}_L$ is the class of all bounded 1-Lipschits functions on ($\mathcal{X},d$))</p>
<blockquote>
<p>두 거리 공간 $(X,d_X), (Y,d_Y)$ 사이의 함수 $f:= X\to Y$ 와 $K\geq 1$이 다음 조건을 만족 할 때 $f$가 K-Lipschits continuous function 이라고한다.</p>
<blockquote>
<p>임의의 $x,x’ \in X$에 대해 $d_Y(f(x),f(x’))\leq Kd_x(x,x’)$
따라서 1-Lipschits라면 $d_Y(f(x),f(x’))\leq d_X(x,x’)$를 만족한다.</p>
</blockquote>
</blockquote>
<blockquote>
<p>Duality formulation으로 GAN처럼 generator/discriminator 구조로 학습 할 수 있음.</p>
</blockquote>
<h3 id="23-application-to-generative-models--wasserstein-auto-encoders">2.3. Application to generative models : Wasserstein Auto-Encoders</h3>
<p>VAE나 GAN과 같은 최근의 generative model들은 data distribution $P_X$와 model distribution $P_G$ 사이의 descrepancy measure를 최소화하는 것으로 볼 수 있다.
그러나 기존 논문들에서 보이는 divergence들은 (특히 $P_X$가 Unknown이고 $P_G$가 Deep Neural Network에 의해 parametrized 된 경우) 계산이 어렵거나 불가능하고, 이러한 문제를 해결하기 위해 트릭이 사용된다.</p>
<p>예를들어 KL-divergence의 최소화 (혹은 marginal log-likelihood의 최대화)를 위해서 <em>variational lower bound</em> 가 VAE에서 사용되었다. 좀 더 broad한 $f$-divergence의 경우 dual formulation을 통해 $f$-GAN이나 adversarial training을 활용 할 수 있다. 세번째 옵션으로 본 논문과 같이 OT cost와 Kantrovich-Rubinstein duaility를 활용 할 수 있다.</p>
<p>본 논문에서는 2단계 프로시져로 정의된 latent variable model $P_G$를 다룬다. 2단계 프로시져란 fixed distribution $P_Z$로 code $Z$를 샘플링하는 1단계와, $Z$를 $X\in\mathcal{X}$로 매핑하는 2단계 구성을 말한다. 이는 확률 밀도 함수 $p_G(x)$를 다음과 같이 정의한다.</p>
\[p_G(x):= \int_\mathcal{Z}p_G(x\mid z)p_Z(z)dz, \forall x \in \mathcal{X}\]
<p>그리고 문제를 간단하게 하기위해 non-random decoder (i.e., deterministically map $Z$ to $X=G(Z)$)에 대해 진행한다.</p>
<p>이러한 모델에서 OT cost 문제는 복잡하게 $\Gamma$에서 찾을 필요없이 하나의 확률 변수를 통해 더 간단하게 표현 될 수 있다.</p>
<table>
<tbody>
<tr>
<td><img src="/assets/images/wae2.PNG" alt="WAE2" /></td>
</tr>
</tbody>
</table>
<p>Theorem 1은 모든 $X, Y$ 페어 대신 random encoder $Q(Z\mid X)$를 최적화하는 방법으로 OT cost 문제를 해결 할 수 있게 해준다. 추가적인 relaxation과 페널티를 포함한 최종적인 WAE objective는 다음과 같다.</p>
\[D_{\text{WAE}}(P_X,P_G):= \underset{Q(Z\mid X)\in\mathcal{Q}}{\inf} \mathbb{E}_{P_X}\mathbb{E}_{Q(Z\mid X)}[c(X,G(Z))] + \lambda\cdot\mathcal{D}_Z(Q_Z,P_Z)\]
<blockquote>
<p>$\mathcal{Q}$는 any nonparameteric set of probabilistic encoder, $\mathcal{D}_Z$는 $Q_Z,P_Z$ 사이의 arbitrary divergence, $\lambda$는 0 이상인 hyperparameter이다.
Theorem 1의 $Q_Z=P_Z$ 조건이 $D_Z$ 바탕의 penalty term으로 변환됨.
시뮬레이션에서 $c$가 squared distance를 사용했는데, 결국 reconstruction error와 regularization term으로 볼 수 있음.</p>
</blockquote>
<p>VAE와 달리, WAE formulation은 non-random encoder의 사용도 허용한다.
\(\mathcal{D}_Z\)가 arbitrary divergence이므로 KL-divergence 이외에 것도 사용가능한데, 본 논문에서는 Jensen-Shannon divergence $D_{JS}$와 Maximum mean discrepancy (MMD) 두 모델에 대해 비교하였다.</p>
<ul>
<li>GAN based \(\mathcal{D}_Z\) : $D_{JS}(Q_Z,P_Z)$와 adversarial training을 활용. 특히 discriminator가 \(\mathcal{Z}\) space 상에서 $P_Z$로부터의 true sample과 $Q_Z$로부터의 fake sample을 구분하도록 만듬.</li>
<li>MMD based \(\mathcal{D}_Z\) : Positive-definite reproducing kernel $k:\mathcal{Z}\times\mathcal{Z}\to\mathcal{R}$에 대해 maximum mean discrepancy (MMD)는
\(\text{MMD}_k(P_Z,Q_Z)=\| \int_{\mathcal{Z}}k(z,\cdot)dP_Z(z)-\int_{\mathcal{Z}}k(z,\cdot)dQ_Z(z){\|}_{\mathcal{H}_k}\)
<blockquote>
<p>$\mathcal{H}_k$ 는 RKHS (Reproducing Kernel Hilbert Space) of real-valued functions mapping $\mathcal{Z}$ to $\mathcal{R}$.
$k$가 characteristic function이면 $\text{MMD}_k$는 metric을 정의하고 divergence measure로 사용 될 수 있다.</p>
</blockquote>
</li>
</ul>
<p>각 모델에 대한 알고리즘은 다음과 같다.</p>
<p>|<img src="/assets/images/wae3.PNG" alt="WAE3" />|
|* GAN / MMD base model별 WAE 알고리즘*|</p>
<blockquote>
<p>이전에 논문에서 언급한대로, deterministic encoder $Q_\phi (Z\mid x)$를 사용 할 수 있기때문에 $\tilde{z}_i$를 샘플링 할 때 단순히 출력 값을 넣어주면 된다 (VAE에서는 reparametrization trick을 통해 randomness가 들어간다).</p>
</blockquote>
<h2 id="3-related-work">3. Related Work</h2>
<h2 id="4-experiments">4. Experiments</h2>
<p>실험을 통해 제안된 WAE 모델이 다음의 세가지 목적을 달성하는지에 대해 살펴보았다.</p>
<ol>
<li>data points들의 accurate reconstruciton</li>
<li>reasonable geometry of the latent manifold</li>
<li>random generated sample들의 good visual quality</li>
</ol>
<p>논문에서는 MNIST와 CelebA 데이터셋에 대해 실험을 진행했는데, 그 중 CelebA의 결과만 포스팅한다. 실험간에 isotropic Gaussian prior distribution (i.e., $P_Z(Z)=Z;\mathbf{0},\sigma^2_z\cdot \mathbf{I}_d)$), squared cost function $c(x,y)=|x-y{|}^2_2$, deterministic encoder-decoder, Adam optimizer, DC-GAN 논문의 구조와 유사한 신경망 구조, batch normalization 등을 활용했다.</p>
<table>
<tbody>
<tr>
<td><img src="/assets/images/wae4.PNG" alt="WAE4" /></td>
</tr>
<tr>
<td><em>CelebA 데이터에 대한 비교 결과</em></td>
</tr>
</tbody>
</table>
<h2 id="5-결론">5. 결론</h2>
<p>Optimal transport cost를 활용해 Wasserstein auto-encoder를 제안. 실험을 통해 VAE와 제안된 WAE-GAN, WAE-MMD 모델을 비교, 더 좋은 결과를 얻을 수 있었음.</p>
<h2 id="6-요약">6. 요약</h2>
<ol>
<li>Probability distrubtion의 divergence는 Optimal transport 문제로부터 유도 될 수 있고, $c(x,y)=d(x,y)$ 일 때 $W_1=W_c$이며 Kantrovich-Rubinstein duality가 성립함.</li>
<li>Generative model의 목적은 data distribution $P_X$와 model distribution $P_G$를 같아지도록 만드는 것 (차이를 줄이는 것).</li>
<li>물론 두 probability distribution의 차이로 Wasserstein distance 또한 사용 가능.</li>
<li>그런데 Optimal transport problem을 살펴보면 $X,Y$의 모든 joint distribution에 대해서 infimum을 살펴봐야하는 문제가 있음.</li>
<li>$P_G$를 latent variable $z$를 통한 2단계 모델 ($P_Z$에서 $z$ 샘플, 샘플된 $z$로부터 $x$로의 변환)로 구성하면 문제가 간단하게 변함 $\to$ Theorem 1.</li>
<li>Theorem 1에서 $Q_Z=P_Z$로 constrained되어있으므로 relaxation을 위해 $\mathcal{D}_Z(Q_Z,P_Z)$를 penalty term으로 추가.</li>
<li>penalty term으로 Jensen-Shannon divergence와 MMD를 사용해서 결과를 비교.</li>
</ol>류승형shryu8902@naver.comhttps://scholar.google.co.kr/citations?user=eRyqoEcAAAAJ&hl=enWasserstein Auto-Encoders[Machine Learning] 예측 모델의 오차 메트릭에 대해서2019-01-08T00:00:00+00:002019-01-08T00:00:00+00:00https://shryu8902.github.io/machine%20learning/error<h1 id="error-measurements-in-forecasting">Error measurements in forecasting</h1>
<h2 id="1-error-metric">1. Error Metric</h2>
<p>전력 예측 모델에 관한 다수의 논문을 살펴보면 보통 두 가지 error metric을 사용한다.</p>
<ol>
<li>Root Mean Squared Error (RMSE)</li>
<li>Mean Absolute Percentage Error (MAPE)</li>
</ol>
<p>RMSE와 MAPE는 정의는 다음과 같다.</p>
<ul>
<li>$t$ : time index, $t\in{0,….,T}$</li>
<li>$y_t$ : 실측값</li>
<li>$f_t$ : 예측값</li>
</ul>
<table>
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><strong>RMSE</strong></td>
<td><strong>\(\sqrt{\frac{1}{T}\sum_{t=1}^T(y_t-f_t)^2}\)</strong></td>
<td><strong>SE (squred error)들의 평균의 root 값.</strong></td>
</tr>
<tr>
<td><strong>MAPE (%)</strong></td>
<td>\(\frac{100}{T}\sum_{t=1}^T\frac{\mid y_t-f_t\mid}{y_t}\)</td>
<td><strong>실제값 대비 오차의 절대값들의 평균 * 100</strong></td>
</tr>
</tbody>
</table>
<p>특히 인공 신경망 (Artificial neural network) 기반의 예측 모델의 경우 대체로 SSE (Sum of Squared Error)를 loss function으로 활용하기때문에 RMSE와 연관성이 크고, 따라서 논문 에러 비교에 빠지지 않고 등장한다.</p>
<p>RMSE 외에 MAPE 또한 상당히 자주 등장한다. MAPE 수식을 살펴보면 실측 값 대비 오차의 퍼센티지이므로, 개인적으로는 RMSE에 비해 직관적이라고 생각한다. 하지만 MAPE가 오차 비교를 위해 자주 활용되더라도 MAPE가 갖는 단점들로 인해 loss function으로는 거의 사용되지않는다.</p>
<h2 id="2-mape">2. MAPE</h2>
<ol>
<li>
<p>실측값이 0인 경우 MAPE 계산이 불가능하다. 당연한 이야기지만 0으로 나누는 것이 불가능하기때문에 문제가 발생한다. 간혹 0인 경우만 빼고 MAPE를 계산 할 수도 있는데, 이는 곧 <strong>0인 경우는 오차가 어떻든 상관없다</strong> 라는 뜻이므로 주의가 필요하다.</p>
</li>
<li>
<p>양수로 이루어진 데이터 (e.g., 전력 사용량)에 대해 underforecast (실측값보다 작게 예측)와 overforecast (실측값보다 크게 예측)가 MAPE에 끼치는 영향이 다르다. underforecast의 경우 MAPE의 최대값은 $100\%$지만 overforecast의 경우 최대값의 한계가 없다. 따라서 MAPE를 minimize하는 방향으로 예측 모델을 학습하게 되면 모델이 underforecast하도록 bias된다.</p>
</li>
<li>
<p>실측값이 0에 가까운 경우 분모가 매우 작아짐에 따라서 절대 오차 (absolute error, $\mid y_t-f_t\mid$)값이 작더라도 APE (Absolute Percentage Error)가 크게 증가하는 경우가 발생한다. 이로인해 평균을 취하더라도 $100\%$이상의 값을 얻는 경우가 있는데, 어플리케이션에 따라서 이러한 결과가 성능 척도 비교에 부적절 할 수 있다. 예를들어 전력 사용량 예측 모델에서 실측값은 0.001 kWh이고, 예측값은 1 kWh라 하면 APE가 $1000\%$가 되는데, 어플리케이션에서 해당 예측값이 끼치는 영향이 미미한데 비해 MAPE에 미치는 영향은 매우 크다.</p>
</li>
</ol>
<p>MAPE의 단점들과 underforecasting에 대한 예시는 다음의 링크에 자세하게 설명되어있다.</p>
<p><a href="https://stats.stackexchange.com/questions/299712/what-are-the-shortcomings-of-the-mean-absolute-percentage-error-mape"><code class="language-plaintext highlighter-rouge">https://stats.stackexchange.com/questions/299712/what-are-the-shortcomings-of-the-mean-absolute-percentage-error-mape</code></a></p>류승형shryu8902@naver.comhttps://scholar.google.co.kr/citations?user=eRyqoEcAAAAJ&hl=enError measurements in forecasting[논문 정리] InfoVAE2018-12-03T00:00:00+00:002018-12-03T00:00:00+00:00https://shryu8902.github.io/paper/paper-infovae<h1 id="infovae--balancing-learning-and-inference-in-variational-autoencoder">InfoVAE : Balancing Learning and Inference in Variational Autoencoder</h1>
<p><strong>2018 / arXiv.org / Shengjia Zhao, Jiaming Song, Stefano Ermon</strong></p>
<p>지난 몇년간 ML 분야에서는 VAE(Variational Autoencoder)와 GAN(Generative Adversarial Network)를 필두로 generative model에 대한 연구가 활발하게 진행되었다.</p>
<p>이번에 살펴본 논문은<br />
<strong>InfoVAE : Balancing Learning and Inference in Variational Autoencoder; Shengjia Zhao <em>et al.</em></strong> 으로,
VAE의 목적 함수인 ELBO(Evidence Lower BOund)가 갖는 단점들을 분석하여 새로운 형태의 목적 함수를 제시하고 실험을 통해 결과를 살펴보았다.</p>
<h2 id="1-backgrounds">1. Backgrounds</h2>
<p>Generative model은 neural network (NN)를 통해 데이터의 확률 분포 자체를 학습하는 모델로, 그 예로 GAN, VAE 등이 있다.</p>
<p>주요 목표는 데이터 $x$의 분포와 $x$를 잘 설명하는 latent variable $z$의 분포를 학습하는 것이다.
하지만 VAE에서 사용되는 ELBO는 위의 두 목표가 상충될 때, $x$의 분포를 학습하는데 좀 더 중점을 두는 문제점이 있다.
(결국 $z$와 $x$가 연관성이 떨어지는 문제가 발생할 수 있다.)</p>
<h2 id="2-variational-autoencoder">2. Variational Autoencoder</h2>
<p>VAE와 목적함수 ELBO에 대해 간략하게 살펴보면 다음과 같다.</p>
<ul>
<li>Input variable : $x \in X$</li>
<li>Latent variable : $z \in Z$</li>
<li>Data distribution conditioned over $z$ : $p_{\theta}(x\mid z)$</li>
<li>Prior distribution : $p(z)$</li>
<li>True underlying distribution : $p_D (x)$</li>
</ul>
<p>Generative model의 기본적인 목적은 다음의 likelihood를 최대화 하는 것을 볼 수 있다.</p>
\[\mathbb{E}_{P_D(x)}[\log p_\theta(x)]=\mathbb{E}_{p_D(x)}[\log\mathbb{E}_{p(z)}[p_\theta(x\mid z )]] \tag{1}\]
<p>그러나 $p_\theta(x)=\int_z p_\theta(x\mid z)p(z)dz$가 intractable하므로 $q_\phi(z\mid x)$를 통해 위 식의 lower bound를 maximize하는 방법으로 돌려서 풀게된다.</p>
<p>결과적으로 VAE에서 사용되는 ELBO는 다음과 같다.</p>
\[\mathcal{L}_{ELBO}=\mathbb{E}_{p_D(x)}[-D_{KL}(q_\phi(z\mid x)\parallel p(z))+\mathbb{E}_{q_\phi(z\mid x)}[\log p_\theta(x\mid z )]]\leq\mathbb{E}_{p_D(x)}[\log p_\theta(x)]\]
<p>또한 $p_\theta(x,z) \equiv p(z)p_\theta(x\mid z), q_\phi(x,z)\equiv p_D(x)q_\phi(z\mid x)$로 정의하면 ELBO는 다음의 식으로 변형 될 수 있다.</p>
<p>\(\mathcal{L}_{ELBO}\equiv -D_{KL}(q_\phi(x,z)\parallel p_\theta(x,z))\tag{2}\) \(=-D_{KL}(p_D(x)\parallel p_\theta(x))-\mathbb{E}_{p_D(x)}[D_{KL}(q_\phi(z\mid x)\parallel p_\theta(z\mid x))]\tag{3}\) \(=-D_{KL}(q_\phi(z)\parallel p(z))-\mathbb{E}_{q_\phi(z)}[D_{KL}(q_\phi(x\mid z)\parallel p_\theta(x\mid z))]\tag{4}\)</p>
<h2 id="3-two-problems-of-vae">3. Two problems of VAE</h2>
<h3 id="31-amortized-inference-failures">3.1. Amortized inference failures</h3>
<p>이상적인 조건 하에서, ELBO 최적화는 위의 두가지 목표를 달성 할 수 있다 (with sufficiently flexible model families for $p_\theta(x\mid z)$ and $q_\phi(z\mid x)$ over $\theta , \phi$).</p>
<ol>
<li>Capturing $p_D(x)$</li>
<li>Performing correct amortized inference $q_\phi(z\mid x)$</li>
</ol>
<p>이는 Eq.(3)를 통해 확인 할 수 있는데, ELBO 최적화는 결국</p>
<ol>
<li>$p_D(x)$과 $p_\theta(x)$; data distribution과 model distribution</li>
<li>$q_\phi(z\mid x)$와 $p_\theta(z\mid x)$; varitational posterior과 true posterior</li>
</ol>
<p>의 KL Divergence를 최소화하는 것이기때문이다 (각각은 위의 1,2 목표와 동일).</p>
<p>하지만 finite model capacity로 인해 두가지 목표 사이에 trade-off가 발생하는 경우, $q_\phi(z\mid x)$의 학습이 희생되는 경향이 있는데, 논문에서는 그 이유를 두 가지로 설명하고있다.</p>
<ul>
<li><strong>Inherent properties of the ELBO objective :</strong><br />
ELBO가 매우 부정확한 $q_\phi(z\mid x)$를 갖더라도 최대화가 가능.</li>
<li><strong>Implicit modeling bias :</strong>
$x$의 차원이 $z$에 비해 높기때문에, 최적화 수행 시 data fitting에 바이어스 됨.</li>
</ul>
<h3 id="311-good-elbo-values-do-not-imply-accurate-inference">3.1.1 Good ELBO values do not imply accurate inference</h3>
<p>ELBO를 재구성하면 log likelihood (reconstruction) term인 \(\mathcal{L}_{\text{AE}}\)
와 regularization term \(\mathcal{L}_{\text{REG}}\)로 구성되어있는 것을 알 수 있다.</p>
<p><img src="/assets/images/infovae1.png" alt="ELBO1" /></p>
<p>먼저 reconstruction term인 \(\mathcal{L}_{AE}\)만 최적화하는 경우를 살펴보면, inferred latent variable $z\sim q_\phi(z\mid x)$로부터 observing data point $x$의 log likelihood를 최대화하게 된다. 유한한 데이터 셋 ${x_1,…,x_N}$으로부터, $q_\phi$가 $x_i \neq x_j$일때 $q_\phi(z\mid x_i)$와 $q_\phi(z\mid x_j)$가 disjoint support를 갖는 distribution이라하면, $p_\theta(x\mid z )$는 각각의 $q_\phi(z\mid x_i)$로부터 학습 할 때 $x_i$로 집중되어있는 형태의 분포를 배운다는 것이다. 이로인해 $p_\theta(x\mid z )$는 Dirac delta distribution를 따라가는 경향이 발생하기도하는데, 부적절한 $z$를 학습하는데도 불구하고 \(\mathcal{L}_{AE}\)는 $+\infty$로 간다.</p>
<p>논문에서는 간단한 예시로 $x\in {-1,1}$인 경우, true prior $p(z)$와 $q_\phi(z\mid x)$의 모델링에 대해 살펴보았다. $x=\pm1$로 conditioned되어있을 때 $q_phi$의 평균과 분산이 각각 $\pm\infty,+0$인 경우 \(\mathcal{L}_{ELBO}\)가 $+\infty$로 최대화되는 것을 증명하였다 (이때 $q_\phi(z\mid x)$와 $p_\theta(z\mid x)$의 KL divergence 또한 $+\infty$가 된다).</p>
<p>즉 ELBO를 최대화하는 쪽으로 잘 학습함에도 불구하고, 쓸모없는 inference $q_\phi(z)$를 (ture posterior와 상관없는)를 얻는다는 것이다.</p>
<h3 id="312-modeling-bias">3.1.2 Modeling bias</h3>
<p>두번째 문제는 modeling bias로 ELBO에 $x$와 $z$에 대한 요소가 모두 존재하지만 $x$에 대한 error term이 더 dominant하다는 것이다.</p>
<p>예를들어, 두 $n$-dimensional Gaussian distribution $\mathcal{N}(0,I), \mathcal{N}(\epsilon,I)$의 KL-divergence는 아래와 같다.</p>
\[D_{KL}(\mathcal{N}(0,I), \mathcal{N}(\epsilon,I))=n\epsilon^2/2\]
<p>보통 $x$가 $z$에 비해 고차원이기 때문에, $x$의 오차를 줄이는 것이 더 효과적이기때문에, $z$가 희생되는 경향이 생긴다. 나아가 이러한 문제는 아래 현상의 원인이 될 수 있다.</p>
<ul>
<li>Inference 성능의 약화</li>
<li>트레이닝 데이터에 대한 오버피팅</li>
</ul>
<h3 id="32-the-information-preference-propoerty">3.2. The information preference propoerty</h3>
<p>PixelRNN/PixelCNN과 같은 복잡한 $p_\theta(x\mid z )$ 복원 방법들은 natural image dataset의 샘플 퀄리티를 크게 향상시켰으나, latent variable $z$를 무시하는 새로운 문제($x$와 $z$의 mutual information이 굉장히 작아지게되는) 문제가 발생하게 되었다.
직관적인 원인은 $z$에 상관없이 학습된 $p_\theta(x\mid z )$가 동일하다는 것인데, 의미있는 latent variable을 찾는 목적 달성이 전혀 이뤄지지 않게 되는 것이다.</p>
<p>논문에서는 이러한 현상을 information preference problem이라 하며, 이와 연관해서 ELBO에 대한 다음과 같은 해석을 내놓았다. 요약하면 latent variable $z$을 활용하지 않더라도도 0으로 최적화가 가능하다는 것이다.</p>
<p>ELBO의 재구성 식인 (3)을 보면 $-D_{KL}(p_D(x)\parallel p_\theta(x))$과 \(-\mathbb{E}_{p_D(x)}[D_{KL}(q_\phi(z\mid x)\parallel p_\theta(z\mid x))]\) 두 가지 term으로 구성되어있는데 다음을 통해 $x$와 $z$ 사이의 연관성이 없어도 global optimum을 얻는 것을 보였다.</p>
<p><img src="/assets/images/infovae2.png" alt="infovae2" /></p>
<h2 id="4-the-infovae-model-family">4. The InfoVAE model family</h2>
<p>위의 두 문제 (3.1,3.2)를 해결하기위해 새로운 학습 목적함수를 제안했다. 즉 원래 ELBO 수식으로부터</p>
<p>1) Scaling parameter $\lambda$를 통한 $x$에 편중되는 문제 해결 (3.1)<br />
2) Mutual information maximization term을 추가하여 $x,z$ 사이의 연관성 문제를 해결 (3.2)</p>
<p>따라서 새로운 목적함수는</p>
<p><img src="/assets/images/infovae3.png" alt="infovae3" /><br />
<img src="/assets/images/infovae4.png" alt="infovae4" /></p>
<p>(5)와 (6)은 동일한 수식인데, (6)의 경우 효율적인 최적화가 가능하다고 한다.
(6)의 마지막 $D_{KL}(q_\phi(z)\parallel p(z))$ term 계산에서 어려움이 있을 수 있는데 ($\log q_\phi(z)$ 파트), unbiased sampling이 가능하여 lieklihood free optimization technique을 활용 할 수 있다.
나아가 다음의 조건에서 KL-divergence 외에 다른 strict divergence $D(q_\phi(z)\parallel p(z))$를 사용한 목적함수 $\hat{\mathcal{L}}_{\text{infoVAE}}$로 교체하더라도 최적화에 전혀 문제가 되지 않음을 보였다.</p>
<p><img src="/assets/images/infovae5.png" alt="infovae5" /></p>
<p>${\mathcal{L}}_{\text{infoVAE}}$은 이전에 발표된 여러 모델의 일반화된 버전으로 볼 수 있다. 예를들어</p>
<ul>
<li>$\alpha=0, \lambda=1$ : 기존 ELBO 모델</li>
<li>$\lambda>0, \alpha+\lambda-1=0$, KL-divergence : $\beta$-VAE.</li>
<li>$\alpha=1,\lambda=1$, Jensen Shannon divergence : Adversarial Autoencoder</li>
</ul>
<h2 id="41-divergence-families">4.1 Divergence families</h2>
<p>Proposition 2를 통해 KL-divergence외에 다른 divergence의 사용이 가능하므로, 논문에서 3가지 divergence에 대해 고려했다.</p>
<ul>
<li>Adversarial training : Adversarial Autoencoder (AAE)에서 Adversarial discriminator를 통해 $q_\phi(z)$와 $p(z)$사이의 Jensen-Shannon divergence를 approximately 최소화.</li>
<li>Stein Variational Gradient : KL-divergence의 Gradient를 계산해서 $D_{KL}$에 대한 gradient discent minimization 수행.</li>
<li>Maximum-Mean discrepancy : 두 분포의 moment를 통해 거리 수치화.</li>
</ul>
<p><img src="/assets/images/infovae6.png" alt="infovae6" /></p>
<h2 id="5-experiments">5. Experiments</h2>
<p>시뮬레이션을 통해서 논문에서 전개한 이론적인 측면을 확인한다.</p>
<p><img src="/assets/images/infovae7.png" alt="infovae7" /></p>
<p>$x$가 -1 혹은 1 값을 갖는 경우에 대한 간단한 시뮬레이션인데,
기존 ELBO objective에서 $p(z)$와 $q_\phi(z\mid x)$ 사이의 $D_{KL}$ term이 존재하지만 그래프를 살펴보면 $p(z)$와 $q_\phi(z\mid x)$의 형태가 다른 것을 확인 할 수 있다.
반면에 InfoVAE의 경우 이러한 문제를 극복한 것을 확인 할 수 있다.</p>
<p><img src="/assets/images/infovae8.png" alt="infovae8" /></p>
<p>이 그래프는 ELBO의 over/under estimation에 관한 그래프로서, $\log \text{det(Cov}[q_\phi(z)])$를 training, test set에 대해 도시하였다.
standard Gaussian prior $p(z)$의 $\text{Cov}[p(z)]=I$이므로 $\log \text{det(Cov}[p(z)])=0$이다.
ELBO의 경우 ideal case와 큰 차이가 나타나는 것을 확인 할 수 있다. 특히 training set이 작을때 이러한 현상이 두드러진다. 반면에 MMD를 사용한 InfoVAE의 경우 이러한 문제가 나타나지 않는 것을 볼 수 있다.</p>
<p><img src="/assets/images/infovae9.png" alt="infovae9" /></p>
<p>위 그림은 500개로 트레이닝 했을때 $p(z), q_\phi(z)$의 contour이다. InfoVAE의 경우 prior와 유사한 분포를 갖는 반면에, ELBO는 동떨어진 결과를 나타내고, 결국 이는 Fig. 2에서 ELBO의 overestimation을 의미한다.</p>
<p><img src="/assets/images/infovae10.png" alt="infovae10" /></p>
<p>MNIST 데이터셋에 대한 VAE와 InfoVAE의 reconstruciton, generation 이미지이다.
상단은 ELBO 그래프인데, sharp한 reconstruction들을 생성하지만 generation 성능이 상당히 나쁜 것을 볼 수 있다. 따라서 복원 오차를 줄이는데에 generalization 성능 (learning good prior $z$)이 희생 된 것으로 보인다. 반면에 하단의 InfoVAE결과는 reconstruciton과 generation 결과 모두 숫자에 근접한 이미지들이 생성되는 것을 확인 할 수 있다.</p>
<hr />
<h2 id="요약">요약</h2>
<ul>
<li>Generative model에서는 sample generation도 중요하지만 잘 설명이 되는 latent variable $z$의 학습도 매우 중요하다.</li>
<li>하지만 기존 ELBO objective는 크게 두가지 한계를 내포하고 있는데, 첫번째로 $z$의 학습보다 $x$의 reconstruciton에 더 영향을 받는다는 것이고 두번째는 $x$와 $z$의 의미적인 연결에 문제가 있다는 것이다.</li>
<li>따라서 ELBO 내에서 $z$에 대한 웨이트를 주고 $x,z$ 사이의 mutual information에 보상을 줘서 두가지 문제를 해결한다.</li>
<li>결과적으로 InfoVAE를 통해서 기존 VAE보다 발전된 샘플을 얻으면서 latent variable $z$의 학습도 잘 이루어졌다.</li>
</ul>류승형shryu8902@naver.comhttps://scholar.google.co.kr/citations?user=eRyqoEcAAAAJ&hl=enInfoVAE : Balancing Learning and Inference in Variational Autoencoder