SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler offline
DQN
박진우(Curt Park)
RL GOSU
2018.11.18
발표자 소개
•백수 (구직중)
•관심분야
- Generative Model
- Reinforcement Learning
- Convex Optimization
이 발표는?
•범위
- DQN의 네이쳐 논문 [1]
•목표
- DQN의 전반적 내용 파악





3
목차
1. Existing problem
2. Objective
3. Architecture
4. Challenges
5. Replay Memory
6. Fixed Q-targets
7. Data Preprocessing
8. Algorithm
9. Experiments
10. Demo
11. References
•Reinforcement learning agents가 실제 세계의 복잡도를 가
진 문제에서 잘 작동하기 위해서는:
- 상당한 고차원의 sensory inputs으로부터 representation
을 잘 얻어낼 수 있어야 한다.
- 얻어낸 representation으로 과거의 경험을 일반화하여 새로
운 상황에서도 잘 적용할 수 있어야한다.
➡ RL의 유용성은 아주 제한적인 도메인(e.g. 저차원의
state-space를 가진 도메인)에 머물러 있다.
Existing problem
5
•Deep Convolutional Neural Network가 non-linear
function approximator로써 이례적인 성능을 보이고 있다.
•CNN 구조를 이용하여 raw sensory data를 입력으로하는
action-value function의 근사함수를 만들어보면 어떨까?











Objective
6 이미지 출처: [6]
Architecture
7 이미지 출처: [4]
Architecture
8
•Input: 84x84x4 (by preprocessing map ϕ)
•32 convolutional filters of 8x8 with stride 4 followed by a rectifier non-linearity
•64 convolutional filters of 4x4 with stride 2 followed by a rectifier non-linearity
•64 convolutional filters of 3x3 with stride 1 followed by a rectifier non-linearity
•Fully connected layer with 512 nodes + a rectifier non-linearity
•Fully connected linear layer with a single output for each valid action




•강화학습에서 action-value(Q) function을 나타내기 위해
non-linear function approximator를 사용하였을 경우 수렴
이 보장되지 않는 것으로 알려져 있다.












Challenges
9 이미지 출처: [6]
•강화학습에서 action-value(Q) function을 나타내기 위해
non-linear function approximator를 사용하였을 경우 수렴
이 보장되지 않는 것으로 알려져 있다.


•다음과 같은 이유들 때문이다[7].
- Correlation between samples
- Non-stationary targets




Challenges
10
•강화학습에서 action-value(Q) function을 나타내기 위해
non-linear function approximator를 사용하였을 경우 수렴
이 보장되지 않는 것으로 알려져 있다.


•다음과 같은 이유들 때문이다[7].
- Correlation between samples
- Non-stationary targets




Challenges
11
•Correlation between samples




강화학습에서의 학습데이터는 시간의 흐름에 따라 순차적으로 수집되고,
이 순차적인 데이터는 근접한 것들끼리 높은 correlation을 띄게된다.












만약에 이 순차적인 데이터를 그대로 입력으로 활용하게 되면 입력이미지
들 간의 높은 correlation에 의해 학습이 불안정해질 것이다.


Challenges
12
•Correlation between samples (Neural Network perspective)




네트워크의 마지막 hidden layer를 통해 입력 s에 대한 representation
vector 를 얻을 수 있다고 할때, 여기에 어떤 action 에 대한 weight


를 내적하여 를 얻을 수 있다.






이때, objective function(loss function)은 parameter 에 대해 다음과
같은 quadratic form으로 표현된다.










Challenges
13
x(s) a
wa Q(s, a)
Q(s, a; θ) = x(s)T
wa
wa
L(wa) =
1
2
(Q*(s, a) − Q(s, a; θ))2
=
1
2
(Q*(s, a) − x(s)T
wa)2
•Correlation between samples (Neural Network perspective)











에 대한 stochastic gradient descent update는 다음과 같다.









만약 입력되는 state가 비슷하다면(highly correlated) 그에 대한
representation인 또한 비슷할 것이고, 에 대한 업데이트가 다소
편향될 것이다.


Challenges
14
L(wa) =
1
2
(Q*(s, a) − Q(s, a; θ))2
=
1
2
(Q*(s, a) − x(s)T
wa)2
wa
∇waQ(s, a; θ) = x(s) .
Δwa = α(Q*(s, a) − Q(s, a; θ))x(s) .
where α ∈ (0,1) is a step-size parameter.
x(s) wa
•강화학습에서 action-value(Q) function을 나타내기 위해
non-linear function approximator를 사용하였을 경우 수렴
이 보장되지 않는 것으로 알려져 있다.


•다음과 같은 이유들 때문이다[7].
- Correlation between samples
- Non-stationary targets




Challenges
15
•Non-stationary targets




MSE(Mean Squared Error)를 이용하여 optimal action-value function
을 근사하기 위한 loss function을 다음과 같이 표현할 수 있다.








이는 Q-learning target
 ​
를 근사하는
 ​
를 구하려
는 것과 같다. 문제는
 ​
가 Q함수에 대해 의존성을 갖고 있으므로
Q함수를 업데이트하게 되면 target
 ​
또한 움직이게 된다는 것이다. 이 현
상으로 인한 학습의 불안정해진다.





Challenges
16
Li(θi) =
𝔼
s,a,r,s′

[(r + γmaxa′

Q(s′

, a′

; θi) − Q(s, a; θi))
2
],
where θi are the parameters of the Q-network at iteration i .
yi = r + γmaxa′

Q(s′

, a′

; θi)
Q(s, a; θi)
yi
•강화학습에서 action-value(Q) function을 나타내기 위해
non-linear function approximator를 사용하였을 경우 수렴
이 보장되지 않는 것으로 알려져 있다.


•다음과 같은 이유들 때문이다[7].
- Correlation between samples
- Non-stationary targets




Challenges
17
experience replay


(replay memory)
fixed Q-targets
Solutions!
1.Agent의 경험(experience)
 ​
를 time-step 단위
로 data set
 ​
에 저장해 둔다.
2.저장된 data set으로부터 uniform random sampling을 통해
minibatch를 구성하여 학습을 진행한
다​
.
- Minibatch가 순차적인 데이터로 구성되지 않으므로 입력 데이터 사이의
correlation을 상당히 줄일 수 있다.
- 과거의 경험에 대해 반복적인 학습을 가능하게 한다[6].
- 논문의 실험에서는 replay memory size를 1,000,000으로 설정한다.





Replay Memory
18
et = (st, at, rt, st+1)
Dt = {e1, …, et}
((s, a, r, s′

) ∼ U(D))
•
 ​
와 같은 네트워크 구조이지만 다른 파라미터를 가진(독
립적인) target network
 ​
를 만들고 이를 Q-learning
target
 ​
에 이용한다.









- Target network parameters
 ​
는 매 C step마다 Q-network
parameters(
 ​
)로 업데이트된다. 즉, C번의 iteration동안에는 Q-learning
update시 target이 움직이는 현상을 방지할 수 있다.
- 논문의 실험에서는 C값을 10,000으로 설정한다.


Fixed Q-targets
Q(s, a; θ)
̂
Q(s, a; θ−
)
yi = r + γmaxa′

̂
Q(s′

, a′

; θ−
i ) .
Li(θi) =
𝔼
(s,a,r,s′

)∼U(D)[(r + γmaxa′

̂
Q(s′

, a′

; θ−
i ) − Q(s, a; θi))
2
],
yi
in which γ is the discount factor determining the agent's horizon,
θi are the parameters of the Q-network at iteration i and
θ−
i are the network parameters used to compute the target
at iteration i .
θ−
i
θi
•Loss function:




•위 loss function에 대한 gradient의 절대값이 1보다 클때는
절대값이 1이 되도록 clipping해준다[5].
•Huber loss[10]와 기능적으로 동일하기 때문에 구현시에는
loss function을 Huber loss로 정의하기도 한다[11].









Gradient Clipping
20
(r + γmaxa′

Q(s′

, a′

; θ−
i − Q(s, a; θi))
2
•Atari 2600은 210x160 pixel의 colour image를 초당 60프
레임 정도로 화면에 출력한다. 출력된 화면에 대해 전처리 과정
을 거쳐 84x84xm의 입력데이터를 얻는다[9].


(논문에서는 m을 4로 설정)













<입력이미지>




Data Preprocessing
21 이미지 출처: [9]
1. 이미지의 크기를 (210, 160)에서 (84, 84)로 변환
2. RGB 이미지를 grayscale로 변환
















Data Preprocessing
22 이미지 출처: [9]
3. 연속된 이미지들 중 매 k번째에 위치한 이미지들만 선택된다
(Skipped frame)*.












*모든 frame을 전부 입력으로 활용하는 것은 입력 데이터 간의 correlation
을 높이게 된다.






Data Preprocessing
23 이미지 출처: [9]
4. 3에서 선택된 이미지와 그 앞에 연속한 이미지에 대해 pixel-
wise(component-wise) maximum을 취해준다*.












*Atari 2600은 화면에 한 번에 표시할 수 있는 sprites가 단 5개 뿐이어서
짝수 프레임, 홀수 프레임에 번갈아서 표시하는 것으로 여러개의 sprites를
화면에 보여줄 수 있었다. 연속된 두 이미지에 대해 component-wise
maximum을 취해줌으로써 이를 한 이미지에 모두 표시할 수 있다.




Data Preprocessing
24 이미지 출처: [9]
5.1~4의 과정을 거친 이미지들을 m개 만큼 쌓으면 네트워크의
입력으로 사용될 수 있는 하나의 상태(state)가 된다*.





* 1~4의 과정들을 거쳐서 얻은 이미지가 라고 할때,


네트워크에 입력되는 상태는 다음과 같다.




,




즉, 연속으로 입력되는 상태들간에는 overlapping이 존재한다.









Data Preprocessing
25
x1, x2, …, x7
s1 = (x1, x2, x3, x4) s2 = (x2, x3, x4, x5), …, s4 = (x4, x5, x6, x7)
Algorithm
26 이미지 출처: [4]
Algorithm
27 이미지 출처: [4]
Initialization
Algorithm
28 이미지 출처: [4]
Initialization


for the episode
Algorithm
29 이미지 출처: [4]
Epsilon-greedy action selection
Algorithm
30 이미지 출처: [4]
Action execution
Algorithm
31 이미지 출처: [4]
Replay memory
Algorithm
32 이미지 출처: [4]
Gradient


descent
Algorithm
33 이미지 출처: [4]
Update fixed Q-targets every C steps
• Replay memory와 target Q-network의 사용 유무에 따른 퍼
포먼스 비교
















Experiments
34 이미지 출처: [4]
• 아래 그래프는 average action value가 점차 수렴함을 보여준
다.
















Experiments
35 이미지 출처: [4]
• Professional human games tester와 random play 그리고 DQN의 성능비교 표.
49개의 게임중 75%에 해당하는 29개의 게임에서 인간의 퍼포먼스를 상회한다.















Experiments
36 이미지 출처: [4]
• 아래 그림은 expected reward가 엇비슷한 서로 다른 states에 대해, 네트워크가 상
당히 유사한 representation을 나타냄을 보인다.















Experiments
37 이미지 출처: [4]
Demo: DQN


https://github.com/Curt-Park/rainbow-is-all-you-need
References
1.Mnih, V., Kavukcuoglu, K., Silver, D. et al. (2015). Human-level control through deep reinforcement
learning. Nature, 518 (7540), pp. 529-533.
2.Mnih, V., Kavukcuoglu, K., Silver, D. et al. (2015). Human-level control through deep reinforcement
learning. [Code]. Available at: https://sites.google.com/a/deepmind.com/dqn[Accessed 18 May. 2018]
3.Silver, D. (2015). Lecture 6: Value Function Approximation. [Video]. Available at: https://youtu.be/
UoPei5o4fps [Accessed 17 May. 2018].
4.Kim, S. (2017). Lecture 7: DQN. [Video]. Available at: https://youtu.be/S1Y9eys2bdg [Accessed 17 May.
2018].
5.Kim, S. (2017). PR-005: Playing Atari with Deep Reinforcement Learning (NIPS 2013 Deep Learning
Workshop). [Video]. Available at: https://youtu.be/V7_cNTfm2i8 [Accessed 17 May. 2018].
6.Seita, D. (2016). Frame Skipping and Pre-Processing for Deep Q-Networks on Atari 2600 Games. [Online].
Available at: https://danieltakeshi.github.io/2016/11/25/frame-skipping-and-preprocessing-for-deep-q-
networks-on-atari-2600-games [Accessed 18 May. 2018].
7.Boyd, S. and Vandenberghe, L. (2004). Convex Optimization. Cambridge University Press, p. 299.
8.Karpathy, A. et al. (2016). A bug in the implementation. [Online] Available at: https://github.com/
devsisters/DQN-tensorflow/issues/16 [Accessed 18 May. 2018].
39
감사합니다.

Mais conteúdo relacionado

Mais procurados

파이썬으로 나만의 강화학습 환경 만들기
파이썬으로 나만의 강화학습 환경 만들기파이썬으로 나만의 강화학습 환경 만들기
파이썬으로 나만의 강화학습 환경 만들기정주 김
 
Deview deep learning-김정희
Deview deep learning-김정희Deview deep learning-김정희
Deview deep learning-김정희NAVER D2
 
2018 06-11-active-question-answering
2018 06-11-active-question-answering2018 06-11-active-question-answering
2018 06-11-active-question-answeringWoong won Lee
 
개발자를 위한 공감세미나 tensor-flow
개발자를 위한 공감세미나 tensor-flow개발자를 위한 공감세미나 tensor-flow
개발자를 위한 공감세미나 tensor-flow양 한빛
 
RLCode와 A3C 쉽고 깊게 이해하기
RLCode와 A3C 쉽고 깊게 이해하기RLCode와 A3C 쉽고 깊게 이해하기
RLCode와 A3C 쉽고 깊게 이해하기Woong won Lee
 
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016Taehoon Kim
 
Guided policy search
Guided policy searchGuided policy search
Guided policy searchJaehyeon Park
 
딥러닝 기본 원리의 이해
딥러닝 기본 원리의 이해딥러닝 기본 원리의 이해
딥러닝 기본 원리의 이해Hee Won Park
 
Siamese neural networks for one shot image recognition paper explained
Siamese neural networks for one shot image recognition paper explainedSiamese neural networks for one shot image recognition paper explained
Siamese neural networks for one shot image recognition paper explainedtaeseon ryu
 
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기NAVER D2
 
Coursera Machine Learning (by Andrew Ng)_강의정리
Coursera Machine Learning (by Andrew Ng)_강의정리Coursera Machine Learning (by Andrew Ng)_강의정리
Coursera Machine Learning (by Andrew Ng)_강의정리SANG WON PARK
 
강화학습 알고리즘의 흐름도 Part 2
강화학습 알고리즘의 흐름도 Part 2강화학습 알고리즘의 흐름도 Part 2
강화학습 알고리즘의 흐름도 Part 2Dongmin Lee
 
안.전.제.일. 강화학습!
안.전.제.일. 강화학습!안.전.제.일. 강화학습!
안.전.제.일. 강화학습!Dongmin Lee
 
Intriguing properties of contrastive losses
Intriguing properties of contrastive lossesIntriguing properties of contrastive losses
Intriguing properties of contrastive lossestaeseon ryu
 
[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement Learning[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement LearningKiho Suh
 
인공신경망
인공신경망인공신경망
인공신경망종열 현
 
Image Deep Learning 실무적용
Image Deep Learning 실무적용Image Deep Learning 실무적용
Image Deep Learning 실무적용Youngjae Kim
 
Io17ex automl & autodraw
Io17ex automl & autodrawIo17ex automl & autodraw
Io17ex automl & autodrawTae Young Lee
 
Chapter 8 - optimization for training deep models
Chapter 8 - optimization for training deep modelsChapter 8 - optimization for training deep models
Chapter 8 - optimization for training deep modelsKyeongUkJang
 
"How does batch normalization help optimization" Paper Review
"How does batch normalization help optimization" Paper Review"How does batch normalization help optimization" Paper Review
"How does batch normalization help optimization" Paper ReviewLEE HOSEONG
 

Mais procurados (20)

파이썬으로 나만의 강화학습 환경 만들기
파이썬으로 나만의 강화학습 환경 만들기파이썬으로 나만의 강화학습 환경 만들기
파이썬으로 나만의 강화학습 환경 만들기
 
Deview deep learning-김정희
Deview deep learning-김정희Deview deep learning-김정희
Deview deep learning-김정희
 
2018 06-11-active-question-answering
2018 06-11-active-question-answering2018 06-11-active-question-answering
2018 06-11-active-question-answering
 
개발자를 위한 공감세미나 tensor-flow
개발자를 위한 공감세미나 tensor-flow개발자를 위한 공감세미나 tensor-flow
개발자를 위한 공감세미나 tensor-flow
 
RLCode와 A3C 쉽고 깊게 이해하기
RLCode와 A3C 쉽고 깊게 이해하기RLCode와 A3C 쉽고 깊게 이해하기
RLCode와 A3C 쉽고 깊게 이해하기
 
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기 DEVIEW 2016
 
Guided policy search
Guided policy searchGuided policy search
Guided policy search
 
딥러닝 기본 원리의 이해
딥러닝 기본 원리의 이해딥러닝 기본 원리의 이해
딥러닝 기본 원리의 이해
 
Siamese neural networks for one shot image recognition paper explained
Siamese neural networks for one shot image recognition paper explainedSiamese neural networks for one shot image recognition paper explained
Siamese neural networks for one shot image recognition paper explained
 
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기
딥러닝과 강화 학습으로 나보다 잘하는 쿠키런 AI 구현하기
 
Coursera Machine Learning (by Andrew Ng)_강의정리
Coursera Machine Learning (by Andrew Ng)_강의정리Coursera Machine Learning (by Andrew Ng)_강의정리
Coursera Machine Learning (by Andrew Ng)_강의정리
 
강화학습 알고리즘의 흐름도 Part 2
강화학습 알고리즘의 흐름도 Part 2강화학습 알고리즘의 흐름도 Part 2
강화학습 알고리즘의 흐름도 Part 2
 
안.전.제.일. 강화학습!
안.전.제.일. 강화학습!안.전.제.일. 강화학습!
안.전.제.일. 강화학습!
 
Intriguing properties of contrastive losses
Intriguing properties of contrastive lossesIntriguing properties of contrastive losses
Intriguing properties of contrastive losses
 
[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement Learning[한국어] Neural Architecture Search with Reinforcement Learning
[한국어] Neural Architecture Search with Reinforcement Learning
 
인공신경망
인공신경망인공신경망
인공신경망
 
Image Deep Learning 실무적용
Image Deep Learning 실무적용Image Deep Learning 실무적용
Image Deep Learning 실무적용
 
Io17ex automl & autodraw
Io17ex automl & autodrawIo17ex automl & autodraw
Io17ex automl & autodraw
 
Chapter 8 - optimization for training deep models
Chapter 8 - optimization for training deep modelsChapter 8 - optimization for training deep models
Chapter 8 - optimization for training deep models
 
"How does batch normalization help optimization" Paper Review
"How does batch normalization help optimization" Paper Review"How does batch normalization help optimization" Paper Review
"How does batch normalization help optimization" Paper Review
 

Semelhante a Introduction toDQN

[paper review] 손규빈 - Eye in the sky & 3D human pose estimation in video with ...
[paper review] 손규빈 - Eye in the sky & 3D human pose estimation in video with ...[paper review] 손규빈 - Eye in the sky & 3D human pose estimation in video with ...
[paper review] 손규빈 - Eye in the sky & 3D human pose estimation in video with ...Gyubin Son
 
[Paper Review] Visualizing and understanding convolutional networks
[Paper Review] Visualizing and understanding convolutional networks[Paper Review] Visualizing and understanding convolutional networks
[Paper Review] Visualizing and understanding convolutional networksKorea, Sejong University.
 
Imagination-Augmented Agents for Deep Reinforcement Learning
Imagination-Augmented Agents for Deep Reinforcement LearningImagination-Augmented Agents for Deep Reinforcement Learning
Imagination-Augmented Agents for Deep Reinforcement Learning성재 최
 
Lecture 4: Neural Networks I
Lecture 4: Neural Networks ILecture 4: Neural Networks I
Lecture 4: Neural Networks ISang Jun Lee
 
PR-203: Class-Balanced Loss Based on Effective Number of Samples
PR-203: Class-Balanced Loss Based on Effective Number of SamplesPR-203: Class-Balanced Loss Based on Effective Number of Samples
PR-203: Class-Balanced Loss Based on Effective Number of SamplesSunghoon Joo
 
K means 알고리즘을 이용한 영화배우 클러스터링
K means 알고리즘을 이용한 영화배우 클러스터링K means 알고리즘을 이용한 영화배우 클러스터링
K means 알고리즘을 이용한 영화배우 클러스터링Edward Yoon
 
Reinforcement learning v0.5
Reinforcement learning v0.5Reinforcement learning v0.5
Reinforcement learning v0.5SANG WON PARK
 
[기초개념] Graph Convolutional Network (GCN)
[기초개념] Graph Convolutional Network (GCN)[기초개념] Graph Convolutional Network (GCN)
[기초개념] Graph Convolutional Network (GCN)Donghyeon Kim
 
Image net classification with deep convolutional neural networks
Image net classification with deep convolutional neural networks Image net classification with deep convolutional neural networks
Image net classification with deep convolutional neural networks Korea, Sejong University.
 
2.linear regression and logistic regression
2.linear regression and logistic regression2.linear regression and logistic regression
2.linear regression and logistic regressionHaesun Park
 
Progressive Growing of GANs for Improved Quality, Stability, and Variation Re...
Progressive Growing of GANs for Improved Quality, Stability, and Variation Re...Progressive Growing of GANs for Improved Quality, Stability, and Variation Re...
Progressive Growing of GANs for Improved Quality, Stability, and Variation Re...태엽 김
 
네트워크 경량화 이모저모 @ 2020 DLD
네트워크 경량화 이모저모 @ 2020 DLD네트워크 경량화 이모저모 @ 2020 DLD
네트워크 경량화 이모저모 @ 2020 DLDKim Junghoon
 
Deep Learning & Convolutional Neural Network
Deep Learning & Convolutional Neural NetworkDeep Learning & Convolutional Neural Network
Deep Learning & Convolutional Neural Networkagdatalab
 
3.neural networks
3.neural networks3.neural networks
3.neural networksHaesun Park
 
Ch.5 machine learning basics
Ch.5  machine learning basicsCh.5  machine learning basics
Ch.5 machine learning basicsJinho Lee
 

Semelhante a Introduction toDQN (20)

[paper review] 손규빈 - Eye in the sky & 3D human pose estimation in video with ...
[paper review] 손규빈 - Eye in the sky & 3D human pose estimation in video with ...[paper review] 손규빈 - Eye in the sky & 3D human pose estimation in video with ...
[paper review] 손규빈 - Eye in the sky & 3D human pose estimation in video with ...
 
[Paper Review] Visualizing and understanding convolutional networks
[Paper Review] Visualizing and understanding convolutional networks[Paper Review] Visualizing and understanding convolutional networks
[Paper Review] Visualizing and understanding convolutional networks
 
Imagination-Augmented Agents for Deep Reinforcement Learning
Imagination-Augmented Agents for Deep Reinforcement LearningImagination-Augmented Agents for Deep Reinforcement Learning
Imagination-Augmented Agents for Deep Reinforcement Learning
 
Lecture 4: Neural Networks I
Lecture 4: Neural Networks ILecture 4: Neural Networks I
Lecture 4: Neural Networks I
 
PR-203: Class-Balanced Loss Based on Effective Number of Samples
PR-203: Class-Balanced Loss Based on Effective Number of SamplesPR-203: Class-Balanced Loss Based on Effective Number of Samples
PR-203: Class-Balanced Loss Based on Effective Number of Samples
 
R_datamining
R_dataminingR_datamining
R_datamining
 
K means 알고리즘을 이용한 영화배우 클러스터링
K means 알고리즘을 이용한 영화배우 클러스터링K means 알고리즘을 이용한 영화배우 클러스터링
K means 알고리즘을 이용한 영화배우 클러스터링
 
Lab1
Lab1Lab1
Lab1
 
Reinforcement learning v0.5
Reinforcement learning v0.5Reinforcement learning v0.5
Reinforcement learning v0.5
 
[기초개념] Graph Convolutional Network (GCN)
[기초개념] Graph Convolutional Network (GCN)[기초개념] Graph Convolutional Network (GCN)
[기초개념] Graph Convolutional Network (GCN)
 
Image net classification with deep convolutional neural networks
Image net classification with deep convolutional neural networks Image net classification with deep convolutional neural networks
Image net classification with deep convolutional neural networks
 
Naive ML Overview
Naive ML OverviewNaive ML Overview
Naive ML Overview
 
2.linear regression and logistic regression
2.linear regression and logistic regression2.linear regression and logistic regression
2.linear regression and logistic regression
 
Progressive Growing of GANs for Improved Quality, Stability, and Variation Re...
Progressive Growing of GANs for Improved Quality, Stability, and Variation Re...Progressive Growing of GANs for Improved Quality, Stability, and Variation Re...
Progressive Growing of GANs for Improved Quality, Stability, and Variation Re...
 
네트워크 경량화 이모저모 @ 2020 DLD
네트워크 경량화 이모저모 @ 2020 DLD네트워크 경량화 이모저모 @ 2020 DLD
네트워크 경량화 이모저모 @ 2020 DLD
 
Rdatamining
Rdatamining Rdatamining
Rdatamining
 
Deep Learning & Convolutional Neural Network
Deep Learning & Convolutional Neural NetworkDeep Learning & Convolutional Neural Network
Deep Learning & Convolutional Neural Network
 
S.M.Lee, Invited Talk on "Machine Learning-based Anomaly Detection"
S.M.Lee, Invited Talk on "Machine Learning-based Anomaly Detection"S.M.Lee, Invited Talk on "Machine Learning-based Anomaly Detection"
S.M.Lee, Invited Talk on "Machine Learning-based Anomaly Detection"
 
3.neural networks
3.neural networks3.neural networks
3.neural networks
 
Ch.5 machine learning basics
Ch.5  machine learning basicsCh.5  machine learning basics
Ch.5 machine learning basics
 

Introduction toDQN

  • 2. 발표자 소개 •백수 (구직중) •관심분야 - Generative Model - Reinforcement Learning - Convex Optimization
  • 3. 이 발표는? •범위 - DQN의 네이쳐 논문 [1] •목표 - DQN의 전반적 내용 파악 
 

 3
  • 4. 목차 1. Existing problem 2. Objective 3. Architecture 4. Challenges 5. Replay Memory 6. Fixed Q-targets 7. Data Preprocessing 8. Algorithm 9. Experiments 10. Demo 11. References
  • 5. •Reinforcement learning agents가 실제 세계의 복잡도를 가 진 문제에서 잘 작동하기 위해서는: - 상당한 고차원의 sensory inputs으로부터 representation 을 잘 얻어낼 수 있어야 한다. - 얻어낸 representation으로 과거의 경험을 일반화하여 새로 운 상황에서도 잘 적용할 수 있어야한다. ➡ RL의 유용성은 아주 제한적인 도메인(e.g. 저차원의 state-space를 가진 도메인)에 머물러 있다. Existing problem 5
  • 6. •Deep Convolutional Neural Network가 non-linear function approximator로써 이례적인 성능을 보이고 있다. •CNN 구조를 이용하여 raw sensory data를 입력으로하는 action-value function의 근사함수를 만들어보면 어떨까? 
 







 Objective 6 이미지 출처: [6]
  • 8. Architecture 8 •Input: 84x84x4 (by preprocessing map ϕ) •32 convolutional filters of 8x8 with stride 4 followed by a rectifier non-linearity •64 convolutional filters of 4x4 with stride 2 followed by a rectifier non-linearity •64 convolutional filters of 3x3 with stride 1 followed by a rectifier non-linearity •Fully connected layer with 512 nodes + a rectifier non-linearity •Fully connected linear layer with a single output for each valid action 
 

  • 9. •강화학습에서 action-value(Q) function을 나타내기 위해 non-linear function approximator를 사용하였을 경우 수렴 이 보장되지 않는 것으로 알려져 있다. 
 








 Challenges 9 이미지 출처: [6]
  • 10. •강화학습에서 action-value(Q) function을 나타내기 위해 non-linear function approximator를 사용하였을 경우 수렴 이 보장되지 않는 것으로 알려져 있다. 
 •다음과 같은 이유들 때문이다[7]. - Correlation between samples - Non-stationary targets 
 
 Challenges 10
  • 11. •강화학습에서 action-value(Q) function을 나타내기 위해 non-linear function approximator를 사용하였을 경우 수렴 이 보장되지 않는 것으로 알려져 있다. 
 •다음과 같은 이유들 때문이다[7]. - Correlation between samples - Non-stationary targets 
 
 Challenges 11
  • 12. •Correlation between samples 
 
 강화학습에서의 학습데이터는 시간의 흐름에 따라 순차적으로 수집되고, 이 순차적인 데이터는 근접한 것들끼리 높은 correlation을 띄게된다. 
 








 만약에 이 순차적인 데이터를 그대로 입력으로 활용하게 되면 입력이미지 들 간의 높은 correlation에 의해 학습이 불안정해질 것이다. 
 Challenges 12
  • 13. •Correlation between samples (Neural Network perspective) 
 
 네트워크의 마지막 hidden layer를 통해 입력 s에 대한 representation vector 를 얻을 수 있다고 할때, 여기에 어떤 action 에 대한 weight 
 를 내적하여 를 얻을 수 있다. 
 


 이때, objective function(loss function)은 parameter 에 대해 다음과 같은 quadratic form으로 표현된다. 
 






 Challenges 13 x(s) a wa Q(s, a) Q(s, a; θ) = x(s)T wa wa L(wa) = 1 2 (Q*(s, a) − Q(s, a; θ))2 = 1 2 (Q*(s, a) − x(s)T wa)2
  • 14. •Correlation between samples (Neural Network perspective) 
 
 
 



 에 대한 stochastic gradient descent update는 다음과 같다. 
 





 만약 입력되는 state가 비슷하다면(highly correlated) 그에 대한 representation인 또한 비슷할 것이고, 에 대한 업데이트가 다소 편향될 것이다. 
 Challenges 14 L(wa) = 1 2 (Q*(s, a) − Q(s, a; θ))2 = 1 2 (Q*(s, a) − x(s)T wa)2 wa ∇waQ(s, a; θ) = x(s) . Δwa = α(Q*(s, a) − Q(s, a; θ))x(s) . where α ∈ (0,1) is a step-size parameter. x(s) wa
  • 15. •강화학습에서 action-value(Q) function을 나타내기 위해 non-linear function approximator를 사용하였을 경우 수렴 이 보장되지 않는 것으로 알려져 있다. 
 •다음과 같은 이유들 때문이다[7]. - Correlation between samples - Non-stationary targets 
 
 Challenges 15
  • 16. •Non-stationary targets 
 
 MSE(Mean Squared Error)를 이용하여 optimal action-value function 을 근사하기 위한 loss function을 다음과 같이 표현할 수 있다. 
 




 이는 Q-learning target ​ 를 근사하는 ​ 를 구하려 는 것과 같다. 문제는 ​ 가 Q함수에 대해 의존성을 갖고 있으므로 Q함수를 업데이트하게 되면 target ​ 또한 움직이게 된다는 것이다. 이 현 상으로 인한 학습의 불안정해진다. 
 

 Challenges 16 Li(θi) = 𝔼 s,a,r,s′  [(r + γmaxa′  Q(s′  , a′  ; θi) − Q(s, a; θi)) 2 ], where θi are the parameters of the Q-network at iteration i . yi = r + γmaxa′  Q(s′  , a′  ; θi) Q(s, a; θi) yi
  • 17. •강화학습에서 action-value(Q) function을 나타내기 위해 non-linear function approximator를 사용하였을 경우 수렴 이 보장되지 않는 것으로 알려져 있다. 
 •다음과 같은 이유들 때문이다[7]. - Correlation between samples - Non-stationary targets 
 
 Challenges 17 experience replay 
 (replay memory) fixed Q-targets Solutions!
  • 18. 1.Agent의 경험(experience) ​ 를 time-step 단위 로 data set ​ 에 저장해 둔다. 2.저장된 data set으로부터 uniform random sampling을 통해 minibatch를 구성하여 학습을 진행한 다​ . - Minibatch가 순차적인 데이터로 구성되지 않으므로 입력 데이터 사이의 correlation을 상당히 줄일 수 있다. - 과거의 경험에 대해 반복적인 학습을 가능하게 한다[6]. - 논문의 실험에서는 replay memory size를 1,000,000으로 설정한다. 
 

 Replay Memory 18 et = (st, at, rt, st+1) Dt = {e1, …, et} ((s, a, r, s′  ) ∼ U(D))
  • 19. • ​ 와 같은 네트워크 구조이지만 다른 파라미터를 가진(독 립적인) target network ​ 를 만들고 이를 Q-learning target ​ 에 이용한다. 
 





 - Target network parameters ​ 는 매 C step마다 Q-network parameters( ​ )로 업데이트된다. 즉, C번의 iteration동안에는 Q-learning update시 target이 움직이는 현상을 방지할 수 있다. - 논문의 실험에서는 C값을 10,000으로 설정한다. 
 Fixed Q-targets Q(s, a; θ) ̂ Q(s, a; θ− ) yi = r + γmaxa′  ̂ Q(s′  , a′  ; θ− i ) . Li(θi) = 𝔼 (s,a,r,s′  )∼U(D)[(r + γmaxa′  ̂ Q(s′  , a′  ; θ− i ) − Q(s, a; θi)) 2 ], yi in which γ is the discount factor determining the agent's horizon, θi are the parameters of the Q-network at iteration i and θ− i are the network parameters used to compute the target at iteration i . θ− i θi
  • 20. •Loss function: 
 
 •위 loss function에 대한 gradient의 절대값이 1보다 클때는 절대값이 1이 되도록 clipping해준다[5]. •Huber loss[10]와 기능적으로 동일하기 때문에 구현시에는 loss function을 Huber loss로 정의하기도 한다[11]. 
 





 Gradient Clipping 20 (r + γmaxa′  Q(s′  , a′  ; θ− i − Q(s, a; θi)) 2
  • 21. •Atari 2600은 210x160 pixel의 colour image를 초당 60프 레임 정도로 화면에 출력한다. 출력된 화면에 대해 전처리 과정 을 거쳐 84x84xm의 입력데이터를 얻는다[9]. 
 (논문에서는 m을 4로 설정) 
 









 <입력이미지> 
 
 Data Preprocessing 21 이미지 출처: [9]
  • 22. 1. 이미지의 크기를 (210, 160)에서 (84, 84)로 변환 2. RGB 이미지를 grayscale로 변환 
 












 Data Preprocessing 22 이미지 출처: [9]
  • 23. 3. 연속된 이미지들 중 매 k번째에 위치한 이미지들만 선택된다 (Skipped frame)*. 
 








 *모든 frame을 전부 입력으로 활용하는 것은 입력 데이터 간의 correlation 을 높이게 된다. 
 


 Data Preprocessing 23 이미지 출처: [9]
  • 24. 4. 3에서 선택된 이미지와 그 앞에 연속한 이미지에 대해 pixel- wise(component-wise) maximum을 취해준다*. 
 








 *Atari 2600은 화면에 한 번에 표시할 수 있는 sprites가 단 5개 뿐이어서 짝수 프레임, 홀수 프레임에 번갈아서 표시하는 것으로 여러개의 sprites를 화면에 보여줄 수 있었다. 연속된 두 이미지에 대해 component-wise maximum을 취해줌으로써 이를 한 이미지에 모두 표시할 수 있다. 
 
 Data Preprocessing 24 이미지 출처: [9]
  • 25. 5.1~4의 과정을 거친 이미지들을 m개 만큼 쌓으면 네트워크의 입력으로 사용될 수 있는 하나의 상태(state)가 된다*. 
 

 * 1~4의 과정들을 거쳐서 얻은 이미지가 라고 할때, 
 네트워크에 입력되는 상태는 다음과 같다. 
 
 , 
 
 즉, 연속으로 입력되는 상태들간에는 overlapping이 존재한다. 
 





 Data Preprocessing 25 x1, x2, …, x7 s1 = (x1, x2, x3, x4) s2 = (x2, x3, x4, x5), …, s4 = (x4, x5, x6, x7)
  • 27. Algorithm 27 이미지 출처: [4] Initialization
  • 28. Algorithm 28 이미지 출처: [4] Initialization 
 for the episode
  • 29. Algorithm 29 이미지 출처: [4] Epsilon-greedy action selection
  • 30. Algorithm 30 이미지 출처: [4] Action execution
  • 31. Algorithm 31 이미지 출처: [4] Replay memory
  • 32. Algorithm 32 이미지 출처: [4] Gradient 
 descent
  • 33. Algorithm 33 이미지 출처: [4] Update fixed Q-targets every C steps
  • 34. • Replay memory와 target Q-network의 사용 유무에 따른 퍼 포먼스 비교 
 












 Experiments 34 이미지 출처: [4]
  • 35. • 아래 그래프는 average action value가 점차 수렴함을 보여준 다. 
 












 Experiments 35 이미지 출처: [4]
  • 36. • Professional human games tester와 random play 그리고 DQN의 성능비교 표. 49개의 게임중 75%에 해당하는 29개의 게임에서 인간의 퍼포먼스를 상회한다. 
 











 Experiments 36 이미지 출처: [4]
  • 37. • 아래 그림은 expected reward가 엇비슷한 서로 다른 states에 대해, 네트워크가 상 당히 유사한 representation을 나타냄을 보인다. 
 











 Experiments 37 이미지 출처: [4]
  • 39. References 1.Mnih, V., Kavukcuoglu, K., Silver, D. et al. (2015). Human-level control through deep reinforcement learning. Nature, 518 (7540), pp. 529-533. 2.Mnih, V., Kavukcuoglu, K., Silver, D. et al. (2015). Human-level control through deep reinforcement learning. [Code]. Available at: https://sites.google.com/a/deepmind.com/dqn[Accessed 18 May. 2018] 3.Silver, D. (2015). Lecture 6: Value Function Approximation. [Video]. Available at: https://youtu.be/ UoPei5o4fps [Accessed 17 May. 2018]. 4.Kim, S. (2017). Lecture 7: DQN. [Video]. Available at: https://youtu.be/S1Y9eys2bdg [Accessed 17 May. 2018]. 5.Kim, S. (2017). PR-005: Playing Atari with Deep Reinforcement Learning (NIPS 2013 Deep Learning Workshop). [Video]. Available at: https://youtu.be/V7_cNTfm2i8 [Accessed 17 May. 2018]. 6.Seita, D. (2016). Frame Skipping and Pre-Processing for Deep Q-Networks on Atari 2600 Games. [Online]. Available at: https://danieltakeshi.github.io/2016/11/25/frame-skipping-and-preprocessing-for-deep-q- networks-on-atari-2600-games [Accessed 18 May. 2018]. 7.Boyd, S. and Vandenberghe, L. (2004). Convex Optimization. Cambridge University Press, p. 299. 8.Karpathy, A. et al. (2016). A bug in the implementation. [Online] Available at: https://github.com/ devsisters/DQN-tensorflow/issues/16 [Accessed 18 May. 2018]. 39