Model training 단계에서 할 일은 결국 최적의(optimal)한 모델의 파라미터를 찾는 것. 현재 모델의 파라미터가 우리의 target과 얼마나 거리가 있는지 나타내는 지표인 Loss를 이용해서 모델 파라미터를 업데이트 하는 과정에서 Gradient를 계산하는 단계를 backpropagation이라 한다.
How to get a optimal parameters?
그렇다면 어떻게 optimal한 parameter를 얻을 수 있을까?
optimal 하다 → target 과 model의 prediction distribution이 비슷하다.
→ Loss 가 작다.
→ Loss landscape에서 global minima point가 우리가 찾고자 하는 optimal point!
Strategy 1 : Random Walk
bestloss = float("inf") # python assigns the highest possible float value.for num in xrange(1000): W = np.random.randn(10, 3073) * 0.0001 # generate random parameter loss = L(X_train, Y_train, W) # get the loss over the entire training set. if loss < bestloss: # keep track the best solution bestloss = loss bestW = W print 'in attempt %d the loss was %f, best %f' % (num, loss, bestloss)
scores = Wbest.dot(Xte_cols)Yte_predict = np.argmax(scores, axis=0) # find the index with max score in each colsnp.mean(Yte_predict == Yte)
해보니, 대략 15%라고 하는데, 이 테스트에 사용 된 것은 CIFAR10
따라서 random하게 찍은 경우는 target class가 10개이니, 10%
→ random 보다는 나은 수준이나, SOTA는 99.7%
말 그대로 미분 값. 함수의 특정 point에서 독립 변수(x)의 미소 변화에 따라 종속 변수(f(x))의 변화량.
“For any y=f(x), expressed as a multiplier α to a tiny incrementΔx to obtain the increments Δy to the output” Δy=αΔx
Derivative가 일계도 미분 값이라면, Hessian은 이계도 미분.
“For any y=f(x), expressed as a multiplier α to a tiny incrementΔx to obtain the increments Δy to the output”