Skip to main content

Sparse Autoencoder

Sparse Autoencoder は、latent representation の多くの unit が inactive になるように制約を加えた Autoencoder です。Latent dimension が大きい場合でも、sparsity constraint によって meaningful な representation を学習しやすくします。

Sparsity constraint

Sparse Autoencoder では、hidden unit の平均 activation が小さくなるように penalty を加えます。目標 activation を ρ\rho、実際の平均 activation を ρ^j\hat{\rho}_j とすると、各 hidden unit に対する penalty は KL Divergence で表せます。

jDKL(ρρ^j)\sum_j D_{KL}(\rho \,\|\, \hat{\rho}_j)

Sparse Autoencoder の KL penalty

画像出典: Lilian Weng, “From Autoencoder to Beta-VAE”。Target sparsity と実際の activation のずれを KL Divergence で penalize します。

k-sparse Autoencoder

k-sparse Autoencoder は、hidden layer の中で activation が大きい上位 kk 個の unit だけを残し、それ以外を 00 にする方法です。

k-sparse Autoencoder

画像出典: Lilian Weng, “From Autoencoder to Beta-VAE”。最も大きく activation した kk 個の hidden unit だけを残します。

直感

Sparse Autoencoder は、すべての unit を少しずつ使うのではなく、入力ごとに限られた unit だけを使うようにします。その結果、より disentangled で解釈しやすい representation が得られることがあります。

数式で見る sparsity penalty

Sparse Autoencoder は、latent activation z=Eϕ(x)\mathbf{z}=E_\phi(x) が少数の unit だけを使うように regularization を入れます。

L=xDθ(Eϕ(x))2+\nλz1\mathcal{L}=\|x-D_\theta(E_\phi(x))\|^2+\n\lambda\|\mathbf{z}\|_1

1\ell_1 penalty は、多くの latent dimension を 0 に近づけます。この式の気持ちは、「入力を復元するために必要な少数の特徴だけを使い、解釈しやすい dictionary 的な表現を作る」というものです。

Activation の平均値を目標 sparsity ρ\rho に近づける KL penalty も使われます。

jDKL(ρρ^j)\sum_j D_{KL}(\rho\|\hat{\rho}_j)

ここで、ρ^j\hat{\rho}_j は latent unit jj の平均 activation です。

関連ページ