SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
株式会社RUTILEA 2019
強化学習
粂川 薫樹
株式会社RUTILEA 2019
強化学習
2
目的
最適な方策の獲得
エージェント 環境
状態
行動 a
s
方策 π
株式会社RUTILEA 2019
強化学習
3
目的
最適な方策の獲得
エージェント
環境
状態 s0
方策 π
株式会社RUTILEA 2019
強化学習
4
目的
最適な方策の獲得
エージェント
環境
行動 a0
方策 π
s0状態
R1
報酬
株式会社RUTILEA 2019
強化学習
5
目的
最適な方策の獲得
エージェント
環境
状態 s1
方策 π
株式会社RUTILEA 2019
強化学習
6
目的
最適な方策の獲得
エージェント
環境
行動 a1
方策 π
s1状態
πopt
(a|s) = arg max
π ∑
i
Ri
株式会社RUTILEA 2019
強化学習の位置付け
7
教師あり学習
教師なし学習
強 化 学 習
入出力の関係を学習する.
入出力の組が学習データとして与えられる.
データの背後の構造を学習する.
入力のみが与えられる.
入出力の関係を学習する.
入力と,出力に対する評価値が与えられる.
株式会社RUTILEA 2019
強化学習の手法
8
目的
最適な方策の獲得
価値反復法
価値に基づいた確率で行動を選択する
方策勾配法
行動aや状態sに対して「価値」を定義し
方策を何らかのパラメータ を用いて連続的な関数としてθ
θ表現し, に関して最適化することでπopt
を得る.
πopt
(a|s) = arg max
π ∑
i
Ri
株式会社RUTILEA 2019
初期の強化学習
9
http://chalkdustmagazine.com/features/menace-machine-educable-noughts-crosses-engine/
http://people.csail.mit.edu/brooks/idocs/matchbox.pdf
株式会社RUTILEA 2019
価値反復法
10
価値反復法 行動aや状態sに対して「価値」を定義し 価値に基づいた確率で行動を選択する
状態価値 Vπ
(s):状態がsであることの価値 = 状態sにおける期待報酬和
Vπ
(s) = E[
∑
行動価値 Qπ
(a, s):
i
sにおける行動aの価値= sでaを行った時の期待報酬和
Ri |s]
Qπ
(s, a) = E[
∑
状態
i
Ri |s, a]
Qπ
(st, at) = Est+1
[Rt+1 + Eat+1
[Q(st+1, at+1)]]
=
∑
π(a|s)Qπ
(s, a)
株式会社RUTILEA 2019
やってみよう
11
エージェント:上下左右に移動でき,
城への到達を目指す
このマスに到達したらゲームオーバー.
報酬-1.
敵:
このマスに到達したらゲームクリ
ア.報酬1
城:
株式会社RUTILEA 2019
やってみよう
12
エージェント:上下左右に移動でき,
城への到達を目指す
このマスに到達したらゲームオーバー.
報酬-1.
敵:
Vπ
(s)
このマスに到達したらゲームクリ
ア.報酬1
城:
株式会社RUTILEA 2019
やってみよう
13
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
00 0
0 0
0
0
0
0
0
0 0
0
0
0
0
0
0
0
0 0.90.9
0.9
0.6
0.4 0.2 0.8 0.2 0.2 0.8 0.2 0.4
0.4 0.2 0.2 0.1 0.1 0.2 0.2 0.2
0.8 0.1 0.1 0.8
0.3
0.7
0.2
0.4
0.2
0.8
0.2 0.2
0.6
0.1
0.9
0.1
0.7
0.1
0.6
0.3
0.7
0.2
0.4
0.2
0.8
Qπ
(s)
Q − Learning
Q学習
Qπ
(st, at) = Est+1
[Rt+1 + Eat+1
[Q(st+1, at+1)]]
Qπ
(st, at) ≃ Est+1
[Rt+1 + max
at+1
[Q(st+1, at+1)]]
1. Q値を初期化する.
2. に基づいて,確率的に行動を選択
→
3. に基づいて を更新*
4. 2~3を繰り返す
Q(st, a)
状態s へ遷移t+1
Q(st+1, a) Q(st, a)
株式会社RUTILEA 2019
やってみよう
14
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
00 0
0 0
0
0
0
0
0
0 0
0
0
0
0
0
0
0
0 0.90.9
0.9
0.6
0.4 0.2 0.8 0.2 0.2 0.8 0.2 0.4
0.4 0.2 0.2 0.1 0.1 0.2 0.2 0.2
0.8 0.1 0.1 0.8
0.3
0.7
0.2
0.4
0.2
0.8
0.2 0.2
0.6
0.1
0.9
0.1
0.7
0.1
0.6
0.3
0.7
0.2
0.4
0.2
0.8
Qπ
(s)
Q − Learning
Q学習
Qπ
(st, at) ≃ Est+1
[Rt+1 + max
at+1
[Q(st+1, at+1)]]
1. Q値を初期化する.
2. に基づいて,確率的に行動を選択
→
3. に基づいて を更新*
4. 2~3を繰り返す
Q(st, a)
状態s へ遷移t+1
Q(st+1, a) Q(st, a)
Qπ
(st, at) ← (1 − α)Qπ
(st, at)
+α[Rt+1 + max
at+1
[Q(st+1, at+1)]]
株式会社RUTILEA 2019
Qπ
(st, at) ← (1 − α)Qπ
(st, at)
+α[Rt+1 + max
at+1
[Q(st+1, at+1)]]
やってみよう
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
00 0
0 0
0
0
0
0
0
0 0
0
0
0
0
0
0
0
Qπ
(s)
Q − Learning
1. Q値を初期化する.
2. に基づいて,確率的に行動を選択
3. に基づいて を更新*
Q(st, a)
→状態st+1へ遷移
Q(st+1, a) Q(st, a)
Q学習
00 000 0 00
00 000 0 00
00 000 00
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
株式会社RUTILEA 2019
Qπ
(st, at) ← (1 − α)Qπ
(st, at)
+α[Rt+1 + max
at+1
[Q(st+1, at+1)]]
やってみよう
16
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
00 0
0 0
0
0
0
0
0
0 0
0
0
0
0
0
0
0
Qπ
(s)
Q − Learning
1. Q値を初期化する.
2. に基づいて,確率的に行動を選択
3. に基づいて を更新*
Q(st, a)
→状態st+1へ遷移
Q(st+1, a) Q(st, a)
Q学習
00 000 0 00
00 000 0 00
00 000 00
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
株式会社RUTILEA 2019
やってみよう
17
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
00 0
0 0
0
0
0
0
0
0 0
0
0
0
0
0
0
0
Qπ
(s)
Q − Learning
1. Q値を初期化する.
2. に基づいて,確率的に行動を選択
3. に基づいて を更新*
Q(st, a)
→状態st+1へ遷移
Q(st+1, a) Q(st, a)
Q学習
Qπ
(st, at) ← (1 − α)Qπ
(st, at)
+α[Rt+1 + max
at+1
[Q(st+1, at+1)]]
00 000 0 00
00 000 0 00
00 000 00
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
株式会社RUTILEA 2019
Qπ
(st, at) ← (1 − α)Qπ
(st, at)
+α[Rt+1 + max
at+1
[Q(st+1, at+1)]]
やってみよう
18
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
00 0
0 0
0
0
0
0
0
0 0
0
0
0
0
0
0
0
Qπ
(s)
Q − Learning
1. Q値を初期化する.
2. に基づいて,確率的に行動を選択
3. に基づいて を更新*
Q(st, a)
→状態st+1へ遷移
Q(st+1, a) Q(st, a)
Q学習
00 000 0 00
00 000 0 00
00 000 00
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
株式会社RUTILEA 2019
やってみよう
19
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
00 0
0 0
0
0
0
0
0
0 0
0
0
0
0
0
0
0
Qπ
(s)
Q − Learning
1. Q値を初期化する.
2. に基づいて,確率的に行動を選択
→
3. に基づいて を更新*
Q(st, a)
状態s へ遷移t+1
Q(st+1, a) Q(st, a)
Q学習
Qπ
(st, at) ← (1 − α)Qπ
(st, at)
+α[Rt+1 + max
at+1
[Q(st+1, at+1)]]
00 000 0 00
00 000 0 00
00 000 00
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0-0.1
株式会社RUTILEA 2019
やってみよう
20
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
00 0
0 0
0
0
0
0
0
0 0
0
0
0
0
0
0
0
0 0.90.9
0.9
0.6
0.4 0.2 0.8 0.2 0.2 0.8 0.2 0.4
0.4 0.2 0.2 0.1 0.1 0.2 0.2 0.2
0.8 0.1 0.1 0.8
0.3
0.7
0.2
0.4
0.2
0.8
0.2 0.2
0.6
0.1
0.9
0.1
0.7
0.1
0.6
0.3
0.7
0.2
0.4
0.2
0.8
Qπ
(s)
Q − Learning
1. Q値を初期化する.
2. に基づいて,確率的に行動を選択
3. に基づいて を更新*
Q(st, a)
→状態st+1へ遷移
Q(st+1, a) Q(st, a)
Q学習
Qπ
(st, at) ← (1 − α)Qπ
(st, at)
+α[Rt+1 + max
at+1
[Q(st+1, at+1)]]
株式会社RUTILEA 2019
まとめ
21
価値反復法
→ 行動価値関数 をモデル化Q(s, a)
・Q-Table:試行を繰り返して値を更新する
・
となるように学習
DQN:入力s,出力 (Q(s, a1), Q(s, a2), …, Q(s, an))
株式会社RUTILEA 2019
Experience Replay
逐次的に学習するのではなく、アクションをまとめて実行し、得られた複数の(s, a, sʼ, r)のペアを
Replay Bufferに保存
学習の際には、Replay Bufferからランダムに抽出したサンプルを用いることで、データ同士の相関を防
ぎ、過去のサンプルを繰り返し学習し直すことができる
22
株式会社RUTILEA 2019
活用例
23
https://prtimes.jp/main/html/rd/p/000000009.000027192.html
株式会社RUTILEA 2019 24
価値反復法
→ 行動価値関数 をモデル化Q(s, a)
→ 方策 を直接モデル化π(a|s) (パラメータθを設定)
方策勾配法
株式会社RUTILEA 2019
実際に見てみよう
25
https://www.youtube.com/watch?v=eVccQ82BekI
株式会社RUTILEA 2019
方策勾配法
26
→ 方策 を直接モデル化π(a|s) (パラメータθを設定)
方策勾配法
最終的に得られる報酬 に依存するから,
の関数とみて とおける
V(s0)は方策π(a|s; θ)
θ J(θ)
θ ← θ + α
dJ
dθ
cf. 勾配降下法
θ ← θ + α∇θJ(θ)
株式会社RUTILEA 2019
方策勾配定理
27
∇θJ(θ) = Eπ[
∇π
π
Q(s0, a)]
= Eπ[∇θlog πQ(s0), a]
は多くの場合未知であり,従って も未知
を解析的に求めることができないため,以下の定理を用いる
V(s) J(θ)
∇θJ(θ)
更新式 θ← θ + α∇θ J(θ)
・方策勾配定理
https://qiita.com/itok_msi/items/3c278e06cf2b0bb32f4e
株式会社RUTILEA 2019
強化学習
28
価値反復法
→ 行動価値関数 をモデル化Q(s, a)
→ 方策π(a|s)を直接モデル化 (パラメータθを設定)
方策勾配法
株式会社RUTILEA 2019
AlphaGo
29
AlphaGo
基本方針:モンテカルロ木探索(次頁参照)
学習済みネットワーク:
• ポリシー ネットワーク
• ファスト ネットワーク
• バリュー ネットワーク
株式会社RUTILEA 2019
モンテカルロ木探索
30
1.選択:既存の探索木からパスを選択。
2.サンプリング:決着までシミュレーション。
3.逆伝播:各ノードの勝率を更新
問題点:膨大な計算量
株式会社RUTILEA 2019
モンテカルロ木探索
31
1.選択:既存の探索木からパスを選択。
2.サンプリング:決着までシミュレーショ
ン。
3.逆伝播:各ノードの勝率を更新
高速でシュミレーションをする
ファスト ネットワーク:
π(a|s)を学習したCNN.
訓練データはプロ同士の対戦譜など.
株式会社RUTILEA 2019
モンテカルロ木探索
32
1.選択:既存の探索木からパスを選択。
2.サンプリング:決着までシミュレーショ
ン。
3.逆伝播:各ノードの勝率を更新
勝率計算の精度を上げる
ポリシー ネットワーク
π(a|s)を学習したCNN.
訓練データはプロ同士の対戦譜など.
バリューネットワークの訓練用
バリュー ネットワーク
V(s) を学習したCNN.
訓練データはプロ同士の対戦譜など.

Weitere ähnliche Inhalte

Empfohlen

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 ChatGPTExpeed Software
 
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 EngineeringsPixeldarts
 
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 HealthThinkNow
 
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.pdfmarketingartwork
 
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 2024Neil Kimberley
 
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)contently
 
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 2024Albert Qian
 
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 InsightsKurio // The Social Media Age(ncy)
 
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 2024Search Engine Journal
 
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 summarySpeakerHub
 
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 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 Tessa Mero
 
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 IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
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 managementMindGenius
 
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...RachelPearson36
 
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...Applitools
 

Empfohlen (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...
 

RUTILEA社内勉強会第5回 「強化学習」