Skip to main content

Autoencoder

Autoencoder は、input を一度 low-dimensional な representation に圧縮し、そこから元の input を復元する neural network です。通常は、encoder と decoder という二つの部分から構成されます。

Autoencoder architecture

画像出典: Lilian Weng, “From Autoencoder to Beta-VAE”。Encoder が input を latent representation に変換し、decoder が reconstruction を生成します。

構造

Autoencoder は、次の二つの関数として表せます。

z=fϕ(x)z = f_\phi(x) x^=gθ(z)\hat{x} = g_\theta(z)

ここで、fϕf_\phi は encoder、gθg_\theta は decoder です。zz は latent representation であり、x^\hat{x} は reconstruction です。

目的

Autoencoder の目的は、input xx と reconstruction x^\hat{x} の差を小さくすることです。代表的には、次のような reconstruction loss を最小化します。

L(x,x^)=xx^2\mathcal{L}(x, \hat{x}) = \|x - \hat{x}\|^2

Autoencoder は、単に input をコピーするだけではなく、bottleneck を通じて data の重要な構造を latent representation に押し込めることを狙います。

Bottleneck の意味

Latent dimension が input dimension よりも小さい場合、network は input の情報をすべてそのまま通すことができません。そのため、reconstruction に必要な重要な factor を学習する必要があります。

この考え方は、Denoising AutoencoderSparse AutoencoderContractive AutoencoderVariational Autoencoder へと発展していきます。

数式で見る autoencoder の圧縮と復元

Autoencoder は encoder EϕE_\phi と decoder DθD_\theta からなります。入力 xx を latent zz に圧縮し、そこから復元 x^\hat{x} を作ります。

z=Eϕ(x),x^=Dθ(z)z=E_\phi(x), \qquad \hat{x}=D_\theta(z)

最も基本的な training objective は reconstruction loss です。

Lrec=xDθ(Eϕ(x))22\mathcal{L}_{\mathrm{rec}}=\|x-D_\theta(E_\phi(x))\|_2^2

この式の気持ちは、「入力をそのまま覚えるのではなく、狭い latent bottleneck を通して必要な情報だけを残し、そこから元の入力を復元する」というものです。Latent dimension を小さくすると圧縮は強くなりますが、細部の復元は難しくなります。

関連ページ