학교 공부/컴퓨터비전
18. Learning Techniques for Neural Networks
경북대학교컴퓨터학부
2022. 12. 13. 21:23
📌 Model Set up
- Number of Hidden Nodes
- hidden node가 많아질수록 더 높은 표현 능력을 가진다
- 계산 능력과 일반화 능력을 고려하여 hidden node를 최적화해야 한다
- Initialization condition
- 가중치 초기화 : small random value
- 학습률(learning rate) : 1보다 작은 값 설정. 학습하면서 조절
- Activation function
- hidden node : sigmoid, hyper-tangent, ReLU
- output node : regression(real value출력) : linear, classification(binary 출력) : sigmoid, softmax
📌 Learning Mode
- online mode
- 각각의 data에 대해서 weight를 수정한다
- N개의 sample이 있으면 weight를 N번 수정한다
- error가 빠르게 줄어들지만 unstable하다
- Batch mode
- 전체 데이터 셋 error에 대해서 weight를 수정한다
- N개의 sample이 있으면 wieght는 한 번 수정한다
- stable하지만 error가 천천히 감소한다
- Mini-batch mode
- batch라는 subset을 만들고 weight를 수정한다
- 데이터 셋이 큰 경우에 유리하다
- mini-batch에서 training data 사이즈가 전체 dataset 크기라면 batch mode, mini-batch 사이즈가 1이면 online mode이다
📌 Error function
- Squared Error function
- target value가 연속적인 실수이다
- regression에 적합하다
- Cross Entropy Error
- target value가 binary하다
- classification에 유리하다
- softmax function (output node)
- output의 가중치의 합을 1로 만든다(0.3, 0.8, 0.1 이런식으로 재조정하여 값이 가장 높은 노드를 선택한다)
📌 application : DIGIT recognition
- preprocessing : normalization(input 값이 너무 크면 vanishing gradient problem이 발생하여 가중치를 갱신할 수 없다. 그래서 값이 0~1 사이의 값으로 만들어 준다 = to avoid cell saturation)
- input : 784 node(28x28)
- output : 10 node(activation : sigmoid, softmax)
- hidden node : 20, 50, 100
📌 MSE vs Cross Entrophy(CEE)
- classification : cross entrophy
- regression : Mean square Error
- MSE
- 정답값과 예측값이 차이를 제곱하고 평균을 내주는 것
- Cross Entrophy
- $H(p, q) = \sum_i{p_i log_2\frac{1}{q_i} }$
- one-hot encoding[1, 0, 0, 0]을 거친이후 softmax를 사용하면 [0.8, 0.2, 0, 0]이라는 예측결과가 나온다
- cross entropy는 one-hot encoding 결과에 활성화함수 값을 로그의 분모로 넣는다
- 그렇기에 정답 label의 확률이 올라가게 되면 cross entropy는 감소(분모로 들어가므로)하고, loss 값은 줄어든다
📌 Learning difficulties : Local minima
- gradient descent learning의 기초적인 문제
- local minimum에 학습이 수렴하는 것이다
- solution
- Simulated annealing : step을 임의로 이동시켜 다시 minimum을 찾는 과정
- stochastic gradient descent : 모든 데이터에 대해서 가중치를 조절하는 것이 아니라, 랜덤으로 일부를 추출해서 그에 대한 가중치를 조절하는 방법이다
📌 Learning difficulties : Slow Learning
- Plateau problem : learning curve에서 기울기가 평평한 구간 -> slow learning의 대표적인 원인이다
- 기울기가 작다 = 학습이 느리다
- solution
- changing activation function
- 기울기가 작은 activation function을 사용하는 것이 아닌 ReLU, Softplus, Leaky ReLU, PReLU를 사용한다
- weight initialization
- cell saturation 현상을 피하기 위해 random하게 값을 설정한다
- Input의 sum을 large derivative한 곳에서 하도록 한다
- update rule with momentum
- Nesterov accelerated gradient(NAG)
- momentum 방법의 한 종류이다
- adaptive learning rate
- 학습하는 동안 learning rate를 조정한다
- learning rate가 크다 : 발산, learning rate가 작다 : 수렴이 늦어진다
- 가중치의 변화를 누적하여 파라미터로 사용한다, 가중치 변화의 누적값이 크다면 학습률을 감소시킨다
- RMSProp
- 기울기 값의 누적을 하는 큰 기본 원리는 변하지 않지만, 최근 time step에서 기울기는 많이 반영하고, 먼 과거의 time step은 조금만 반영하는 것이다
- Adam : RMSProp + Momentum
- changing activation function
📌 Learning Difficulties : Overfitting
- batch normalization : hidden activation function의 input을 정규화한다 (cell saturation을 피할 수 있다)
- solution
- early stopping
- regularization
- error function에 regularization term을 넣어 overfitting을 피한다
- dropout
- data augmentation
- original input data에 noise를 추가하여 data set을 증가시킨다