목차
Autoregressive models 글에서 autoregressive generative model에 대해 다뤄보았다.
Autoregressive (Generative) Models (2)
목차 이전 글에 이어, autoregressive generative model에 어떤 모델이 있는지 좀 더 살펴보자. 다음은 다양한 deep generative model 의 비교 표이다. Autoencoder based ARM Autoregressive Models (ARM) vs Autoencoders (AE) Autoenco
jjuke-brain.tistory.com

Deep generative model들 중 이번에는 flow-based model(=normalizing flow model)을 알아보자.
Introduction

Autoregressive generative model의 경우, likelihood를 계산할 수 있고, long-range statistics를 학습할 수 있다는 장점을 갖지만, sampling이 느리고 feature를 학습할 방법은 없다 (lack a latent representation).
Flow-based model(=Normalizing flow model)은 likelihood 계산을 할 수 있으면서(
Flow-based model의 핵심은 simple한 prior distribution으로부터 복잡한 data distribution을 모델링하는 것이다.
본격적으로 flow-based model에 대해 알아보기 이전에 다음과 같이 알아두어야 할 사전지식이 있다.
- Change of variables (in porbability)
- Jacobian of invertible functions
Change of Variables Theorem in Probability Densify Function
Change of variables(변수 변환)를 영어로 표현해서 낯선데, 사실 고등학교 때 배운 내용이다. 다음 식을 보자.
위 식에서 x의 해를 구할 때,
그 이후 t의 해를 구하고, 그 해를 이용하여 x의 해를 구하는 방식으로 문제를 풀었다.
이를 확률 개념에 적용해보자.
Single random variable
따라서 함수
이를 multivariable로 확장, 즉 함수
식의 determinant term은 chage of variables를 통해 invertible transformation
이를 통해 알지 못하는 확률 분포
Jacobian of Invertible Functions
위와 같이
여기서
이를 Jacobian 각 항에 모두 적용하면, inverse function의 Jacobian은 다음을 만족한다.
이제 분포를 알고 있는
변수 변환과 Jacobian의 성질을 통해 다음 식을 얻을 수 있다.
다음은 uniform distribution에 대해 invertible function

위쪽은 Jacobian의 determinant가 1임에 따라 volume이 보존된 bijection (volume-preserving bijection)을 나타내고, 가운데와 아래 그림은 Jacobian 값이 1보다 작은 경우 volume은 작아지지만 density가 커지고, 1보다 큰 경우에는 volume이 커지지만 density가 작아지는 경우를 나타낸다.
Flow-based Models
본격적으로 flow-based model에 대해 알아보자.
Simple Prior to Complex Data Distributions
앞서 언급했듯, flow-based model의 핵심은 간단한 prior distribution
Normal distribution 하나(unimodal distribution, latent space)를 transform하여 multimodal distribution (data space)을 나타낸 예시는 다음과 같다.

Flow-based model이란?

Flow-based model에서 sampling은 forward transformation
또한, inference network를 따로 둘 필요 없이 inverse transformation을 통해 latent representation을 추론(infer)한다.
Flow는
즉, Gaussian 등의 간단한 distribution으로 시작하여
최종 distribution을
Prior distribution을 normal distribution으로 설정하고, Jacobian으로 나타내어 정리하면 다음과 같다.
흥미로운 점은, 첫 번째 term
Gaussian distribution의 probability density function
또한, 두 번째 term
Deep generative model 관점에서는 이러한 invertible transformation을 어떻게 모델링할지 고민해봐야 한다.
Neural network는 flexible하며 학습이 쉽지만, 아무 neural network나 쓸 수 있는 것은 아니다. 다음과 같은 조건을 충족해야 한다.
- Invertible transformation이어야 하므로, invertible neural network를 사용해야 한다.
- 위 식에서 두 번째 term, 즉 logarithm of Jacobian-determinant 계산이 가능하며, 쉬워야 한다.
위 두 가지 조건을 만족하는 model을 normalizing flow 혹은 flow-based model이라 한다.
Considerations when Designing Flow Models
Flow model을 설계할 때 고려할 점이 위에서 언급한 주요한 두 가지 이유와 관련하여 몇 가지 더 있다.
우선, prior distribution이 간단할수록 sampling과 likelihood evaluation 계산이 효율적이다. 따라서 보통 isotropic Gaussian distirbution을 선택하는 경우가 많다.
- Likelihood evaluation : Evaluation of
mapping - Sampling : Evaluation of
mapping
그리고, likelihood 계산 시에는
따라서 Jacobian matrix가 triangular matrix인 invertible transformation을 많이 사용한다. Triangular matrix의 determinant는 대각 성분의 곱으로 간단하게
예를 들어, transformation
다음 글에서는 Flow-based model의 예시를 살펴보자.
최근댓글