728x90
이 글은 이활석님의 'AutoEncoder의 모든 것'에 대한 강의 자료를 바탕으로 학습을 하며 정리한 문서입니다. https://youtu.be/o_peo6U7IRM
[Steve-Lee's Deep Insight:티스토리] https://deepinsight.tistory.com/126 내용을 참고하였습니다.
AutoEncoder란
Keywords
- Unsupervised learning
- Representation learning
- Dimensionality reduction
- Generative learning
Revisit Deep Neural Networks
- Deep Neural Network의 학습방법
- Deep Neural Network가 학습할 때 Loss function을 해석하는 두 가지 관점의 차이
- 두 가지 관점 = MLE, Backpropagation
Machine Learning의 학습 방법
일반적인 Machine Learning 분류 학습 절차
- 입력, 출력 데이터
- 모델 정의
- 모델의 파라미터 학습: 모델을 결정짓는 θ를 결정
- 출력값과 target과의 차이를 정의
- 최적의 파라미터 서치
- 최적 함수의 출력 계산
좋은 모델? = 주어진 데이터를 가장 잘 설명하는 모델
Deep Neural Network의 학습방법
Training data가 준비되고 Model이 준비되면 Loss function을 정의해야 한다. 이때 일반적으로 사용하는 Loss function은 한정적이기 때문에 2가지 가정을 해야함.
- Training data 전체 Loss function은 각 Loss의 합이다.
- Network 출력 값과 타겟 값에 대한 Loss를 구한다.
Backpropagation Algorithm을 적용하기 위해서는 두 가지 가정을 해야 함.
- 모델을 정해준 다음에 Loss function을 정해줘야 함.
- 이때 우리가 일반적으로 사용하는 Loss function은 한정적(Cross-Entropy or MSE)
- 중요! 2개의 가정을 기억해야 한다.
- Training data 전체의 Loss function은 각각의 Loss에 대한 합
- Network 출력값과 타겟값에 대해서 Loss를 구함.
Gradient Descent(경사하강법)
현재의 높이가 이동 전의 높이보다 낮다면 더 낮은 지점으로 이동하는 알고리즘
- Gradient Descent Method
- 현재 θ에서 loss가 줄기만 한다면 loss를 바꾼다.
- 현재 θ와 다음 θ의 loss가 같다면 학습을 멈춘다.
- 경사를 타고 내려가면서 최적해를 탐색
- Gradient Descent Update
- Taylor Expansion -> 여기서 1차 미분값만 쓸거야
- Approximation -> 근사할거야
- Approximation 관점
- 전체 데이터에 대한 Loss function 값은 각각의 데이터에 대한 Loss 값의 합
- Loss function의 기울기는 각각의 Loss function에 대한 기울기의 합
- 데이터가 커질수록 연산량이 많아지기 때문에 전체 데이터에 대해 업데이트를 하는 방식이 아닌 batch를 사용하여 한 step에 한 번 학습을 하는 방법을 사용
Deep Neural Network의 두 가지 학습방법
1. Backpropagation 알고리즘
Backpropagation 알고리즘에서 미분이 어떻게 활용되는지 이해해보자.
- Error at the output layer: 맨 마지막 단(모델의 맨 끝지점) Error Signal
- 각 레이어별 Error signal
- 레이어의 종단에서 흐르는 Gradient값에 local gradient를 곱하는 식으로 gradient가 뒤에서부터 전달되는 것을 알 수 있다.
- Backprop 관점에서 Mean square? Cross entropy?
1-1. Backpropagation type1 - MSE 관점
- 학습 속도가 빠른 것과 느린 것의 차이?
- 오른쪽 loss값보다 왼쪽 loss값이 훨씬 더 빠르게 수렴 -> _초기값이 다르기 때문_
- 어떤 Activation function을 쓰는지, 해당 Activation Function이 Backpropagation에서 어떻게 작동하는지 알아야…
- gradient vanishing problem이 발생할 수 있다.
1-2. Backpropagation type2 - Cross Entropy 관점
Cross Entropy Loss function을 backpropagation하게 되면 수학적으로 activation function의 미분값이 곱해지지않는다.
- MSE와 달리 CE(Cross-Entropy)에서는 출력 레이어에서의 Error값에 대한 activation function의 미분 값이 곱해지지않아 gradient vanishing problem에서 자유롭다.
2. Maximum Likelihood 알고리즘 유도 방법
- 확률분포에 대한 likelihood 값이 Maximize 됐으면 좋겠다!! (확률적 관점 해석)
- 확률분포에 대한 가정을 하고 학습을 시작
- Gaussian으로 진행..
- 평균값이 given일때 확률 P(y|f(x))
- 평균하고 y값이 같아질 때 학습을 멈춤
- 확률적 관점으로 해석 or 정답과 출력 간 차이로 해석할 것인가
MLE를 통해 최적의 파라미터 θ를 찾았다.
학습을 해서 찾은 값은 Gaussian 확률 분포에 대한 평균을 찾은 것이다.(확률 분포 모델을 찾은 것)
이렇게 학습을 하게 되면 ’확률 분포’를 찾은 것이기 때문에 Sampling 할 수 있다. (가장 큰 장점)
- 수식을 정리하면 다음과 같은 사실을 알 수 있다.
- Gaussian Loss를 minimize 하는 것은 Mean Square Error와 같다.
- Bernoulli distribution을 minimize 하는 것은 Cross-Entropy와 같다.
- Continuous 한 value에 대해서는 Gaussian distribution을 사용
- Classification과 같은 value에 대해서는 Cross Entropy 사용
Summary
728x90
반응형
'Study' 카테고리의 다른 글
[Study] 선형대수 용어 정리 (0) | 2024.04.20 |
---|---|
AutoEncoder의 모든 것 #3 (0) | 2023.06.06 |
[Study] AutoEncoder의 모든 것 #1 (1) | 2023.06.06 |
[Study] AutoEncoder의 모든 것 #0 (0) | 2023.06.06 |