Share
Embed
Transcript
71 slides
-
強化学習で話題になったこと(1) AlphaGo 囲碁チャンピオンを倒したAI https://www.youtube.com/watch?v=f_r9smp4-0U Silver, David and Huang, Aja and
Maddison, Chris J. and Guez, Arthur and Sifre, Laurent and van den Driessche, George and Schrittwieser, Julian and Antonoglou, Ioannis and Panneershelvam, Veda and Lanctot, Marc and Dieleman, Sander and Grewe, Dominik and Nham, John and Kalchbrenner, Nal and Sutskever, Ilya and Lillicrap, Timothy and Leach, Madeleine and Kavukcuoglu, Koray and Graepel, Thore and Hassabis, Demis, Mastering the Game of Go with Deep Neural Networks and Tree Search, 2016 6 -
強化学習で話題になったこと(2) Deep Q-Network (DQN) Atariで人間と同じかそれ以上の点数を取れるようになった https://www.youtube.com/watch?v=TmPfTpjtdgg 7 Volodymyr Mnih and
Koray Kavukcuoglu and David Silver and Alex Graves and Ioannis Antonoglou and Daan Wierstra and Martin Riedmiller,Playing Atari With Deep Reinforcement Learning, 2013 Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis, Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, Demis Hassabis, Human-level control through deep reinforcement learning, 2015 -
強化学習とは(2) • 教師あり学習 ◦ 教師データを元に学習を行う • 教師なし学習 ◦ 入力データ群に対して隠れたデータ構造を発見する •
強化学習 ◦ 環境とインタラクションしつつ報酬を最大化する行動を獲得する 12 -
無人島の例に戻ると エージェント: 人間 環境: 無人島 報酬: 行動が生存につながった度合い 行動: 無人島で人間がする行動 目標:
より長く生存すること 報酬の総和を最大化すること 15 -
無人島の例での戦略 • 戦略1: 綺麗な水や食べ物を探しに歩きまわる リスクはあるが、もし発見できれば今後そこを利用して長く生存できる可能性 探索と知識の利用をうまくすれば収益を最大化できそう その代わり、知識の利用をせずに探索すると収益が低くなるかも • 戦略2: 歩いたら疲れるし、悪い水を飲んだら危ないので浜辺でじっとする
リスクはないのでアクシデントで死ぬことはないが、このままだと死ぬ 探索が足りておらず、局所解に陥ってしまった 16 -
用語を覚えよう 収益 報酬の和。割引率γを導入してどのくらいのスパンでの収益かを調整する R t = r t + γr
t+1 + γ2r t+2 + γ3r t+3 + …. 23 -
マルコフ性 次の状態が今の状態と行動にしか依らない Pr {s t+1 = s’, r t+1 =
r | s t , a t } 強化学習では環境がマルコフ性をもつとする 24 -
簡単な方策の例 状態価値関数をすでに持ってるなら 常に一番大きな価値を持つ状態に移動するように行動 s s 1 s 2 s 3
V(s 1 ) = 0.1 V(s 2 ) = 0.2 V(s 3 ) = 0.1 囲碁とかチェスはこれで行動選択できる 26 -
TD学習(2) V(s t+3 )=0, V(s t+2 )=0, V(s t+1 )=0,
V(s t )=0, a = 1, γ=0.9 s t+2 s t+1 s t r t+3 =1 r t+2 =0 r t+1 =0 V(s t+2 ) = 0 + {1 + 0 - 0} V(s t+1 ) = 0+ {0 + 0 - 0} V(s t ) = 0 + {0 + 0 - 0} iteration1 例としていつも同じ状態遷移をするとする 31 -
TD学習(3) V(s t+3 )=0, V(s t+2 )=1, V(s t+1 )=0,
V(s t )=0, a = 1, γ=0.9 s t+2 s t+1 s t r t+3 =1 r t+2 =0 r t+1 =0 V(s t+2 ) = 1 + {1 + 0 - 1} V(s t+1 ) = 0 + {0 + 0.9 - 0} V(s t ) = 0 + {0 + 0 - 0} iteration2 32 -
TD学習(4) V(s t+3 )=0, V(s t+2 )=1, V(s t+1 )=0.9,
V(s t )=0, a = 1, γ=0.9 s t+2 s t+1 s t r t+3 =1 r t+2 =0 r t+1 =0 V(s t+2 ) = 1 + {1 + 0 - 1} V(s t+1 ) = 0.9 + {0 + 0.9 - 0.9} V(s t ) = 0 + {0 + 0.81 - 0} iteration3 33 -
行動価値関数の簡単な方策の例 行動価値関数をすでに持ってるなら 常に一番大きな行動価値を持つ行動を選択 s Q(s, a 1 ) = 0.1
Q(s, a 2 ) = 0.2 Q(s, a 3 ) = 0.1 これなら次の状態を考えなくて良い(マルコフ性のおかげ) 36 -
DQN (Deep Q-Network)とは Deep Mind より発表された深層強化学習の手法 Atariのゲームで高得点が取れるようになった 43 Volodymyr Mnih
and Koray Kavukcuoglu and David Silver and Alex Graves and Ioannis Antonoglou and Daan Wierstra and Martin Riedmiller,Playing Atari With Deep Reinforcement Learning, 2013 Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis, Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, Demis Hassabis, Human-level control through deep reinforcement learning, 2015 -
DQNの成果 from Nature Atari 2600[1] のゲームで人間よりも高いスコアが取れるようになった [1] The Arcade Learning
Environment: An Evaluation Platform for General Agents, 2013, Bellemare, Naddaf, Veness, Bowling 45 -
Atari 2600 での設定 環境: ゲーム エージェント: 自機 状態: ゲーム画像 行動:
ゲームの操作 報酬: ゲームのスコア 46 -
CNNによる画像の扱い CNNを用いたImageNetがILSVRC2012(画像認識コンテスト)で優勝 Alex Krizhevsky, Ilya Sutskever, Geoffrey E. Hinton, ImageNet
Classification with Deep Convolutional Neural Networks, 2012 48 -
ニューラルネットワークの構成 CNN FC FC 各 行 動 の Q 値
84x84の白黒ゲーム画像 CNN CNN 51 -
DQNの工夫 実はDQNはQ関数をディープにしただけではない • Experience Replay • Freezing the target network
• Clipping rewards • Skipping frames 色々工夫してようやくスコアが上がった! 53 -
Experience Replay オンラインでそのまま学習すると DNNは現在の経験に対して過学習してしまう 昔経験したことをランダムに選んで学習に使う 繰り返し学習することで昔のことを忘れない! Reinforcement Learning for Robots
Using Neural Network, 1993, Lin 経験1 経験2 経験3 経験4 Replay Memory 学習 54 -
Clipping rewards ゲームによってスコアの大きさが違う 例 • Pongだったら一回点を取ると1点もらえる • Space Invadorsだったら倒したインベーダの場所に応じて10~30点 いろんなゲームに対応するために、
• 負のスコアは-1 • 正のスコアは+1 で統一する 57 -
実行環境 Python3系 以下をpipでインストール • chainer==2.0.0 • chainerrl==0.2.0 • gym[atari] •
opencv-python(OpenCV3は別の方法でもOK) 60 -
まずは動かしてみよう 以下をcloneして https://github.com/takuseno/dqn-sokushukai 以下から任意のステップまで学習したモデルを落とす https://goo.gl/MN8676 breakout/30000000を上からダウンロードして実行する例 python play.py --gpu -1
--load 30000000 --env Breakout-v0 --render 62 -
報酬がスパースな環境への対策の例 個人的に感動した UC Berkeley から出てた新しい論文 報酬なしでマリオをプレイできるようにした https://www.youtube.com/watch?v=J3FHOyhUn3A Deepak Pathak, Pulkit
Agrawal, Alexei A. Efros, Trevor Darrell, Curiosity-driven Exploration by Self-supervised Prediction, 2017 68 -
報酬がスパースな環境への対策の例 見たことない状態へ移動すると追加で報酬を与える 好奇心 69 Deepak Pathak, Pulkit Agrawal, Alexei A.
Efros, Trevor Darrell, Curiosity-driven Exploration by Self-supervised Prediction, 2017 -
家で別のゲームを学習する 頑張って以下を実行してください CPUだとめちゃくちゃ時間かかります... python train.py --gpu -1 --env {environment} GPUある場合はgpuオプションなしで実行
以下でゲーム一覧を確認できます https://gym.openai.com/envs#atari 70