Gradient Descent
Contents
• Linear regression
- Cost function (MSE)
- Gradient descent algorithm
• Logistic (regression) classification
- Cost function (Cross Entropy)
- Gradient descent algorithm
Cost functionLinear regression
( m = data size, y = 실제값 )
cost 함수
W , b 의 함수
Cost값을 작게 가지는 W , b 를 학습
= linear regression 의 학습
거리를 측정
Cost functionLinear regression
Gradient descent algorithm
가 최소가 되는 점을
기계적으로 찾아내야 함
cost값이 최소가 되는 점을
찾는 것이 목표
optimization
(e.g. MSE)
무작위로 을 그어서
가 최소가 되는 점을 찾는다?
Gradient descent algorithmLinear regression
1. 시작점의 경사도를 따라서 조금 이동
2. 이동된 위치의 경사도를 따라서 조금 이동
3. 값이 최소인 지점까지 반복
step size, learning rate
= 수렴 속도 조절
: 가파른 정도(slope)와 방향
= 시작점
Gradient descent algorithmLinear regression
or takes forever
Gradient descent algorithmLinear regression
learning rate를 정하는데는 답이 없다
일반적으로 0.01 로 시작
(크게 중요하지 않음)
overshooting takes forever
learning rate 감소 learning rate 증가
Convex functionLinear regression
W
b
Cost(W, b)
Cost(W, b)
Non-Convex
Convex functionLinear regression
Gradient Descent Optimization Algorithms at Saddle Point
Cost functionLogistic classification
0보다 작을 수도 있고, 1보다 클 수도 있음
0 < < 1
(WX = linear hypothesis)
Cost functionLogistic classification
(e.g. logistic hypothesis = sigmoid function)
linear hypothesis
(WX = linear hypothesis)
Cost functionLogistic classification
어느 지점에서 시작하는지에 따라
최저점이 달라짐local minumum
global minumum
Cost function을 바꿔 줘야함
New Cost function for logisticLogistic classification
, y = 실제값
Cost(1,1) = 0H(x) = 1
Cost(0,1) =H(x) = 0
H(x)
New Cost function for logisticLogistic classification
, y = 실제값
Cost(1,0) =H(x) = 1
Cost(0,0) = 0H(x) = 0
H(x)
Gradient descent algorithmLogistic classification
Q & A

Gradient descent algorithm