brunch

You can make anything
by writing

C.S.Lewis

by 박재열 Aug 18. 2020

Gradient descent

DL-back propagation

 딥러닝을 공부하게 되면, 가장 기본이 되는 개념 중 하나가 back propagation이다. 이를 통하여 모델은 파라미터들을 업데이트하게 된다. 이 때 파이썬을 이용한 logistic regression 모델의 가중치를 업데이트 하는 간단한 식을 나타내면 다음과 같다. 


    w = w - learning_rate*dw


 이를 gradient descent 방법이라고 한다(엄밀히는 아니라고 할 수도 있지만). 이에 대한 영문 위키의 설명은 다음과 같다.


Gradient descent is a first-order iterative optimization algorithm for finding a local minimum of a differentiable function. To find a local minimum of a function using gradient descent, we take steps proportional to the negative of the gradient (or approximate gradient) of the function at the current point. But if we instead take steps proportional to the positive of the gradient, we approach a local maximum of that function; the procedure is then known as gradient ascent.
출처:https://en.wikipedia.org/wiki/Gradient_descent

 간단하게 얘기하면 극소점을 구하기 위해서, gradient에 learning rate을 곱한 값을 w값에서 빼주면서 계속해서 극소점을 향해 접근해 나가는 방식이다. 몇 가지 가정을 만족하면((ex)f is convex while gradient f is Lipshitz) 극소점으로 수렴함이 보장된다. 

 

 이 글은 단순히 직관적으로 gradient descent를 이해하기 위함이므로, gradient나 편미분, 함수의 형태나 수렴에 대해서는 언급하지 않겠다. 다만, 아래와 같은 간단한 그림을 통하여 직관적으로 이해 할 수 있을 것이다.


이미지 출처: http://rasbt.github.io/mlxtend/user_guide/general_concepts/gradient-optimization/


작가의 이전글 Tidy Data
작품 선택
키워드 선택 0 / 3 0
댓글여부
afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari