Open iammiori opened 5 years ago
sigmoid
: curved in two directions (like S) : logistic function := sigmoid function sigmoid 때문에 h(x) 는 [0,1] 로 bound 됨
= 1/ (1+ e^(-W^T * X))
- 기존 linear regression 에 cost function 적용하면 local minima 에 빠짐
- cost function : 우리의 예측값이 얼마나 정답에 가까운가를 측정하는 척도
- 말인즉슨, 정답에 가까워 질수록 cost function 값 작게
- 정답에서 멀어질 수록 cost function 값 크게
- Y=1 일때는 -log(H(x))
- Y=0 일때는 -log(1-H(x))
- cost = -1/m 시그마 {ylog(H(x)) + (1-y)log(1-H(x))}
code 로 나타내면
cost = tf.reduce_mean(-tf.reduce_mean(Y*tf.log(hypothesis) + (1-Y)*tf.log(1-yhopthesis))
minimize 시키면
a = tf.Variable(0.1) optimizer = tf.train.GradientDescentOptimizer(a) train = optimizer.minimize(cost)
모든 값이 [0,1] 전체합이 1 (확률정규화)
argmax 써서 확률을 1, 0으로 바꿔줘
D(S,L) = - 시그마 Li log(Si)