SlideShare a Scribd company logo
1 of 42
Download to read offline
強くなるロボティク・プレイヤーの作り方
~6章 政策を直接近似する~
@gen_goose_gen
発表スタンス
●
テキストの式について追っていきます
●
テキストが間違えていそうなところがあるのでそこ
は随時皆様と確認していきます
●
参考文献に投げている部分は認めるものとして発
表します
(全部探して読む時間なんてありませんでした…)
●
実装系は実行できてないです…
スライドで用いる表記
●
スカラー:ローマン体
●
ベクトル:小文字のボールド体
●
行列:大文字のボールド体
●
近似した量:ハットをつける
●
集合:カリグラフィー文字
(特に断らない場合列ベクトルとする)
導入
●
強化学習の目的:最適な政策関数を獲得すること
● 4・5章:価値関数を近似して政策関数を更新
– 高次元でかつ連続な状態・行動空間を持つ問題では価値関
数の形状が複雑になり近似が困難
– 行動空間が高次元で連続な場合,価値関数が最大となる行
動の探索が難しい
– 価値関数が少し変更されただけでも,政策が大きく変化するこ
とがある.
(近似誤差が存在する状況での政策反復の収束性に大きく影響
政策を直接近似する必要がある
政策直接近似での強化学習
●
これからの方針
1. パラメータを用いて連続した政策関数の近似モデルを
作る
2. 収益の期待値を定義し、パラメータに対する勾配を計
算する
3.収益の期待値が大きくなる方向に政策のパラメータを
更新する
4. 2-3を繰り返す
確率分布で作る
Cf:ガウス分布
Cf:連続空間での強化学習
1. パラメータを用いて連続した価値関数の近似モデ
ルを作る
2. 真の価値関数と近似モデルの差を取り、最小とな
るパラメータを探して近似モデルを決定する
3. 求められた価値関数の近似モデルが大きくなるよ
うに政策を更新する
4. 2-3を繰り返す
政策勾配法
収益の期待値:
:パラメータによって表される政策
:状態遷移確率
:初期状態確率
このモデルに従うあるエピソードdで得られる収益
政策勾配法
収益の期待値:
パラメータで勾配計算
エピソードデータdを分布に従って
変えた時の収益の期待値
||
あるモデルに従った時に
得られる収益の期待値
パラメータ依存
ではない定数
※パラメータに従うのは
エピソードデータdの出現率
政策勾配法
任意の定数bを追加できる:
:ベースライン
(勾配ベクトル  の推定量の分散を小さくするように設定)
政策勾配法
収益の期待値のパラメータ値対する勾配ベクトル:
政策モデルパラメータの更新式:
:学習率
収益の期待値におけるパラメータに
対する上昇方向を表す
→上昇方向に動かしているので政策勾配法は局所的最適
解を得ることが出来る
※パラメータ空間が極度に歪んでいる場合ではプラトーに陥り、局所的最適解を
得られない場合がある
政策勾配法
・無限ステップで定義されているものが含まれている
・エピソードデータの種類が膨大
→直接計算できない
エピソードデータを標本して、データ集合  を使って勾
配を推定(近似)
政策勾配法
・REINFORCE
(Reward Increment = Nonnegative Factor × Offset Reinforcement × Characteristic Eligibility)
モデルパラメータ 学習率
エピソードデータ
平均
tステップまでの割引報酬 Tステップまでのエピソードの
出現率の勾配
※ある政策に従うエピソードデータ
集合  を用いて標本してた沖の
データを使っていることに注意
(エピソード数:M, ステップ数:T)
最小分散ベースライン
勾配推定量の分散を最小にするようにベースラインを選ぶ
(=真の勾配に近い範囲で勾配サンプルが行われるようにする)
最小分散ベースライン
分散をbで微分して0と置くことによって
分散を最小にするベースラインb*を導出
政策勾配法の例
〜ガウスモデル政策モデル〜
政策関数のモデル(ガウスモデル)
パラメータ:
:ガウス分布の中心を決めるN次元ベクトル
:幅を決めるスカラー
※行動空間 は1次元、状態空間 はN次元と仮定してモデル化している
政策勾配法の例
〜ガウスモデル政策モデル〜
政策関数のモデル(ガウスモデル)
ガウスモデルを取ることで微分計算が簡単になる
,
勾配計算
政策勾配法の例
〜ガウスモデル政策モデル〜
,
政策モデルパラメータの更新式:
政策勾配法のアルゴリズム
自然政策勾配法
パラメータ空間が極度に歪んでいる場合、局所的最適解
を得られない場合がある(プラトーに陥る)
=学習で収益が大きくなる政策が見つけられない
※NNでは頻繁に観測される
Ex)鞍点
回避する方法:自然勾配法
J(θ)
(σ,μ)=(0,0)においてJ(θ)の勾配はゼロだが、
J(θ)の値は極大を取っていない
自然政策勾配法
〜概要〜
政策勾配法のパラメータの更新式:
自然政策勾配法のパラメータの更新式:
:フィッシャー情報行列
:政策     に従った時の状態sの定常分布
(要は状態sがどのように現れるかの分布)
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
これまでの収益の期待値の勾配:
政策勾配の定理:
:状態sにおけるベースライン
◯収益の期待値を書き換える
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
政策勾配の定理:
◯価値関数とベースラインを線形モデルを用いて近似
:B個の基底ベクトル
:B個のモデルパラメータ
(価値関数とベースラインをモデル化するパラメータなので政策近
似によって最適化するパラメータとは別)
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
政策勾配の定理:
◯近似モデルを勾配計算に代入して整理
フィッシャー情報量行列になっている
T
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯NACにおけるパラメータ更新式
:B個のモデルパラメータ
(価値関数とベースラインをモデル化するパラメータなので政策近
似によって最適化するパラメータとは別)
NACでは価値関数とベースラインのモデルパラメータだけ
を用いて政策関数のモデルパラメータを最適化(=収益の
期待値が大きくなるように動かす)していけばいい
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯ここまでのまとめ
✔
政策勾配法では局所的最適解が求まらない場合があ
る(プラトー)
→対策として自然勾配法を導入
✔
自然勾配法ではパラメータ更新式をフィッシャー情報
行列を用いて書き換える
✔自然政策勾配法のうちNACでは政策勾配の定理を用
いて、収益の勾配を価値関数とベースラインを用いて書
き換える
✔
価値関数とベースラインをある線形モデルで近似的に
表して整理すると自然勾配法のパラメータの更新式が
単純になる
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯ここまでのまとめ
✔
政策勾配法では局所的最適解が求まらない場合があ
る(プラトー)
→対策として自然勾配法を導入
✔
自然勾配法ではパラメータ更新式をフィッシャー情報
行列を用いて書き換える
✔自然政策勾配法のうちNACでは政策勾配の定理を用
いて、収益の勾配を価値関数とベースラインを用いて書
き換える
✔
価値関数とベースラインをある線形モデルで近似的に
表して整理すると自然勾配法のパラメータの更新式が
単純になる
近似モデルの評価をしないとだめ
∵モデルが当てはまっていないと収益の勾配計算
が正しくできているかわからないから
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯価値関数とベースラインの近似モデルを求める
→最小二乗法を用いてモデルパラメータωを求める
近似したい関数
性質:
アドバンテージ関数   の近似問題を解けば良い
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯価値関数とベースラインの近似モデルを求める
アドバンテージ関数の定義:
状態sにおいて各行動aの相対的な価値を出力する
関数として定義
アドバンテージ関数の性質:
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯価値関数とベースラインの近似モデルを求める
Cf:
:状態sにおけるベースライン
特にここまでで指定はない
 →ここで状態価値関数を用いて書き換えた
(アドバンテージ関数の近似問題に置き換えた)
アドバンテージ関数の近似問題≒価値関数の近似問題
→ベルマン残差を用いて近似を行う
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯価値関数とベースラインの近似モデルを求める
ベルマン方程式:
変形
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯価値関数とベースラインの近似モデルを求める
変形
変形
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯価値関数とベースラインの近似モデルを求める
変形 期待値を外して、実測値にした時に生じる誤差
(総和を取るとほぼゼロになる)
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯価値関数とベースラインの近似モデルを求める
→
・両辺の差をとって二乗
・汎化誤差にするために
期待値を取る
^
^
エピソードデータによる近似
(サンプリングによる近似)
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯価値関数とベースラインの近似モデルを求める
^
^
近似モデルで表した
アドバンテージ関数の割り引き和
実際の
アドバンテージ関数の割り引き和
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯価値関数とベースラインの近似モデルを求める
^
^
ωで偏微分して0とおいて
パラメータの最小二乗推定量を得る
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯ここまでのまとめ(再掲)
✔
政策勾配法では局所的最適解が求まらない場合があ
る(プラトー)
→対策として自然勾配法を導入
✔
自然勾配法ではパラメータ更新式をフィッシャー情報
行列を用いて書き換える
✔自然政策勾配法のうちNACでは政策勾配の定理を用
いて、収益の勾配を価値関数とベースラインを用いて書
き換える
✔
価値関数とベースラインをある線形モデルで近似的に
表して整理すると自然勾配法のパラメータの更新式が
単純になる
自然政策勾配法
〜NAC(Natural Actor-Critic)〜
◯アルゴリズム
政策勾配のイメージ
〜政策勾配法と自然政策勾配法の比較〜
線形2次形式レギュレータ問題
・伝達関数が状態sと行動aに対して線形
・評価関数(報酬関数)が2次形式
※ここでは簡単化のために状態空間・行動空間がともに1次元とする
・伝達関数:
・報酬関数:
・政策:
パラメータ設定:A=1, b=1, Q=1, R=0.1
政策パラメータ
(これによって収益の期待値が最大となるように政策を決める)
政策勾配のイメージ
〜政策勾配法と自然政策勾配法の比較〜
線形2次形式レギュレータ問題
・収益の期待値の三次元グラフ ・収益の期待値の等高線
収益の期待値が最大となる領域がほぼ平らに見える
(実際はμ=1、σ=0.1付近で最大となっている)
政策勾配のイメージ
〜政策勾配法と自然政策勾配法の比較〜
線形2次形式レギュレータ問題
・収益の期待値の三次元グラフ ・収益の期待値の等高線
収益の期待値が最大となる領域がほぼ平らに見える
(実際はμ=1、σ=0.1付近で最大となっている)
勾配に大きな差がでない
→プラトーの問題が起こる可能性がある
政策勾配のイメージ
〜政策勾配法と自然政策勾配法の比較〜
線形2次形式レギュレータ問題
・政策勾配の例 ・自然政策勾配の例
政策勾配法ではできないが、自然勾配法を用いると正しく
勾配方向を求められる
ありがとうございました!!

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
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
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
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...
 

強くなるロボティック・プレイヤーの作り方 6章