본문 바로가기

데이터 과학/데이터 과학 기초

직관적인 Universal Approximation Theorem 증명

 Bias-variance trade-off 포스트에서 언급된 bias loss 를 줄이기 위해서는 feed-forward neural network 를 사용해볼 수 있다.

 

 이런 feed-forward neural network 의 학습능력의 바탕에는 universal approximation theorem 이 있다. Universal approximation theorem 의 내용은 아래와 같다.

 

 임의의 개수의 neuron 을 포함하고, activation function 이 sigmoid 이면서, 1 hidden layer 를 가진 feed-forward neural network 는 적절한 weights 만 주어진다면 어떤 함수든 근사화 할 수 있다.

 

 컴퓨터공학도에게 위의 내용을 엄밀하게 증명하는 건 어려우니, illustrative proof 를 보여주는 좋은 자료로 intuitively 이해하고 넘어가련다. 아래에는 링크로 연결된 자료를 요약해두었다.

 

 

Illustrative proof.

 아래 그림과 같이 approximation 하고 싶은 random function 이 있다.

Niranjan Kumar, True relationship between x and y, https://medium.com/hackernoon/illustrative-proof-of-universal-approximation-theorem-5845c02822f6

 특정 범위의 $x$ 에 대해서는 $y$ 가 같은 값을 가지고 나머지 범위의 $x$ 에서는 $y$ 값이 0인 사각형 모양의 simple function 생각해보자.

 

 simple function 들을 combination 하면 아래와 같이 random function 을 approximation 할 수 있다.

Niranjan Kumar, Combination of simpler functions, https://medium.com/hackernoon/illustrative-proof-of-universal-approximation-theorem-5845c02822f6

 

 이제 simple function 을 어떻게 만들어 낼지 생각해보아야 한다.

 

 Simple function 아래 그림과 같이 왼쪽 sigmoid function 에서 오른쪽 sigmoid function 을 빼서 만들어낼 수 있다.

Niranjan Kumar, Simple funciton based on sigmoid functions, https://medium.com/hackernoon/illustrative-proof-of-universal-approximation-theorem-5845c02822f6

 아래 수식에서 $b$ 를 적절하게 셋팅하여 sigmoid function 의 중심 ($y$ 값이 0이 되는 부분) 을 이동시키고 $w$ 를 크게 셋팅하면 위와 같이 가파른 sigmoid function 을 만들 수 있다. 

$$\sigma(x) = { 1 \over 1 + exp(-(wx - b)) }$$

 

 이제 남은 것은 neural network 를 이용하여 sigmoid function 의 뺄셈 연산을 어떻게 만들어낼지 보이는 것이다.

Niranjan Kumar, Neural network for subtraction , https://medium.com/hackernoon/illustrative-proof-of-universal-approximation-theorem-5845c02822f6

 위에서 $w$ 와 $b$ 가 적절히 셋팅되면 가파른 모양의 sigmoid function 이 나오는 것을 확인하였다.

마지막 layer 에, 위와 같은 sigmoid function 값을 이용하여 뺄셈을 할 수 있는 weight를 설정해 준다면 사각형 모양의 simple function 을 만들 수 있다.

 

 Target function 의 복잡도를 고려하여 neuron 개수를 늘리고 weight 를 적절하게 셋팅한다면 target function 을 approximation 할 수 있을 것이다.

 

 Neuron 개수를 늘리면 target function 을 더 정확하게 approximation 할 수 있다. 그래서 parameter 를 늘릴 수록 성능이 좋아지나보다.

Niranjan Kumar, The more functions the better approximation, https://medium.com/hackernoon/illustrative-proof-of-universal-approximation-theorem-5845c02822f6

 

 

 위의 illustrative proof 는 neural network 가 어떤 함수든 approximation 할 수 있다는 것을 보장한다. 하지만 weight 를 어떻게 학습할지는 알려주지 않는다.

'데이터 과학 > 데이터 과학 기초' 카테고리의 다른 글

Batch Normalization  (0) 2020.12.29
L1, L2 Regularization  (0) 2020.12.08
Bias-Variance Trade-off  (0) 2020.12.06
Overfitting과 Underfitting  (0) 2020.12.03
본 블로그는 쿠팡 파트너스 활동을 포함하고 있으며, 이에 따른 일정액의 수수료를 제공받습니다.