SlideShare a Scribd company logo
1 of 34
Download to read offline
Optimizer
유쉘
산업시스템 공학과를 졸업하고
딥러닝에 대해 공부하고 있습니다
yushell0417@gmail.com
3
Optimizer 전 까지의 내용 정리를 해보면..
점수 = 이미지 * 가중치
Loss = 점수의 틀린 정도를 정량화한 값
즉! Loss 는 가중치 에 영향을 받음!!
Loss 를 최소로 하는 가중치 값을
찾기 위한 방법(optimizer)은 무엇일까요?
우리의 목표!!
4
loss를 최소로 하는 과정(optimizer)에서
가중치를 찍어서 찾는 방법을
그림으로 확인해 보도록 하겠습니다.
5
Random Search
optimization 을 해 나가는 과정은 이렇게 산 속에서 눈을 가리고 서있는 상황
이 산속에서 하산하기 위해
여기저기를 텔레포트 하듯이 최적의 경로를 찾아 헤매는 것 입니다.
시간도 오래 걸릴 뿐더러 절대 불가능!!
도착지
현 위치!!
: 텔레포트 위치
6
그렇다면 최적의 가중치를 찾기 위해
어떤 방법을 사용해야 할까요??
7
기존 신경망이 가중치 parameter 들을
최적화(optimize) 하는 방법
Gradient Decent
경사 하강법
loss function의 현 가중치에서의 기울기(gradient)를 구해서
loss를 줄이는 방향으로 업데이트해 나갑니다.
8
1. 여기서 미분을 하면 loss의 값을 줄이는
방향을 알 수 있습니다.
2. 그 방향으로 얼마나 내려갈지에 대한 크기
(learning rate)를 구할 수 있습니다.
기울기!!
보폭!!
loss를 최소화 하는 가중치를 업데이트 하는 방법은
기울기와 보폭의 크기를 알면 됩니다!
가중치 업데이트 = 보폭 * 기울기 * 방향
(learning rate) (gradient) (descent)
9
하지만 GD에 데이터 전체를
한 번에 입력할 경우,
발생하는 문제점이 있습니다.
10
가중치가 작은 신경망에서는
문제 없이 잘 진행되네?
얕은 신경망
11
가중치가 작은 신경망에서는
문제 없이 잘 진행되네?
얕은 신경망
12
가중치가 많은 깊은 신경망에서
몇 만개의 데이터를 넣어
한 번의 가중치 업데이트??
깊은 신경망
13
깊은 신경망
기다리기 싫어하는 한국인의 특성 상
CNN을 포기하는 것이 빠를 수 도 있습니다.
14
찍어서 찾는 방법과 기울기를 통해
찾는 방법에 대해
그림으로 확인해볼까요?
15
도착지
현 위치!!
: 한 걸음 당 4시간
SGD가 도착점까지 걸린 시간을 확인해 보면
6 걸음 * 4시간 = 24시간
Random Search VS Gradient Descent
: 텔레포트 위치
GD
RS
16
도착지
현 위치!!
: 한 걸음 당 4시간
Random Search VS Gradient Descent
: 텔레포트 위치
GD
RS
랜덤으로 선택할 때는 도착지에 도달이 거의 불가능 했지만
GD는 시간이 걸려도 어느정도 도착지에 도달이 가능하다
17
전체 데이터의 기울기 만큼 한번 보폭을 움직이는
Gradient Descent 보다 빠른 optimizer는 없을까?
18
Gradient Descent
N
N
Stocastic Gradient Descent 의 아이디어
데이터 중 일정한 갯수를 랜덤 선택(mini-batch) 후
기울기를 구해 가중치를 업데이트
mini-batch
epoch
mini-batch
mini-batch
mini-batch
전체 데이터에 대해 한 걸음
Stocastic Gradient Descent
mini-batch에 대해 한 걸음
19
전체 데이터의 기울기
GD
부분 데이터의 기울기
SGD
그림으로 확인해볼까요?
20
: 보폭 당 4시간
SGD가 도착점까지 걸린 시간을 확인해 보면
13 걸음 * 40분 = 약 8시간
Gradient Descent VS Stocastic Gradient
Descent
: 보폭 당 40분
SGD
GD
도착지
현 위치!!
21
보폭의 수는 많지만 작은 크기의 데이터를 랜덤으로 뽑아
가중치를 갱신하기 때문에 Gradient Descent 보다 빠르다
Gradient Descent VS Stocastic Gradient
Descent
SGD
GD
: 보폭 당 4시간
: 보폭 당 40분
도착지
현 위치!!
22
하지만 mini-batch를 사용한 SGD도
전체 데이터를 사용한 GD 보다
깊은 신경망에서 훨씬 빠르지만
23
SGD는 랜덤으로 기울기를 하강하기 때문에
최적의 값까지 도달하는 속도가 매우 느립니다.
24
Gradient Descent VS Stocastic Gradient
Descent
기울기를 잘 내려오기 위해서는 중요한 두가지가 있습니다.
25
Gradient Descent VS Stocastic Gradient
Descent
기울기를 잘 내려오기 위해서는 중요한 두가지가 있습니다.
앞에서 소개한 가중치 업데이트 식을 보면
26
Gradient Descent VS Stocastic Gradient
Descent
가중치 업데이트 = 보폭 * 기울기 * 방향
(learning rate) (gradient) (descent)
27
Gradient Descent VS Stocastic Gradient
Descent
learning rate: 보폭을 얼마나 할지
28
Gradient Descent VS Stocastic Gradient
Descent
gradient * descent: 어느 방향의 경사로 내려갈지
29
learning rate: 보폭
gradient * descent: 어느 방향의 기울기
30
기울기와 방향에 변화를 주어
SGD를 개선한 모델
31
learning rate에 변화를 주어
SGD를 개선한 모델
32
모델들이 어떠한 방법으로 변화를 주었는지 확인했으니
조금 더 자세히 살펴볼까요?
33
optimizer map
Random
GD
SGD
Adagrad
Momentum
RMSProp
Adam
위 슬라이드는 이해를 돕고자.
하용호님의 ppt를 참고 하였습니다.
감사합니다

More Related Content

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

[유쉘] 3.오차를 줄이기 위한 Optimizer