Reinforcement Learning

Similar documents
Lecture 10: Reinforcement Learning

Reinforcement Learning by Comparing Immediate Reward

Module 12. Machine Learning. Version 2 CSE IIT, Kharagpur

Exploration. CS : Deep Reinforcement Learning Sergey Levine

Axiom 2013 Team Description Paper

ISFA2008U_120 A SCHEDULING REINFORCEMENT LEARNING ALGORITHM

Georgetown University at TREC 2017 Dynamic Domain Track

Laboratorio di Intelligenza Artificiale e Robotica

TD(λ) and Q-Learning Based Ludo Players

High-level Reinforcement Learning in Strategy Games

Challenges in Deep Reinforcement Learning. Sergey Levine UC Berkeley

Lecture 1: Machine Learning Basics

Artificial Neural Networks written examination

CSL465/603 - Machine Learning

Laboratorio di Intelligenza Artificiale e Robotica

Python Machine Learning

AMULTIAGENT system [1] can be defined as a group of

Learning Optimal Dialogue Strategies: A Case Study of a Spoken Dialogue Agent for

Improving Action Selection in MDP s via Knowledge Transfer

Speeding Up Reinforcement Learning with Behavior Transfer

FF+FPG: Guiding a Policy-Gradient Planner

Lecture 1: Basic Concepts of Machine Learning

LEARNING TO PLAY IN A DAY: FASTER DEEP REIN-

Intelligent Agents. Chapter 2. Chapter 2 1

Continual Curiosity-Driven Skill Acquisition from High-Dimensional Video Inputs for Humanoid Robots

Regret-based Reward Elicitation for Markov Decision Processes

AI Agent for Ice Hockey Atari 2600

(Sub)Gradient Descent

A Reinforcement Learning Variant for Control Scheduling

Lecture 6: Applications

Learning Prospective Robot Behavior

An Introduction to Simio for Beginners

On the Combined Behavior of Autonomous Resource Management Agents

Learning and Transferring Relational Instance-Based Policies

CS Machine Learning

Generative models and adversarial training

Machine Learning and Data Mining. Ensembles of Learners. Prof. Alexander Ihler

The Evolution of Random Phenomena

Automatic Discretization of Actions and States in Monte-Carlo Tree Search

An OO Framework for building Intelligence and Learning properties in Software Agents

ReinForest: Multi-Domain Dialogue Management Using Hierarchical Policies and Knowledge Ontology

Learning Structural Correspondences Across Different Linguistic Domains with Synchronous Neural Language Models

Active Learning. Yingyu Liang Computer Sciences 760 Fall

Deep search. Enhancing a search bar using machine learning. Ilgün Ilgün & Cedric Reichenbach

New Features & Functionality in Q Release Version 3.2 June 2016

Visual CP Representation of Knowledge

OCR for Arabic using SIFT Descriptors With Online Failure Prediction

Discriminative Learning of Beam-Search Heuristics for Planning

Agents and environments. Intelligent Agents. Reminders. Vacuum-cleaner world. Outline. A vacuum-cleaner agent. Chapter 2 Actuators

The 9 th International Scientific Conference elearning and software for Education Bucharest, April 25-26, / X

The Good Judgment Project: A large scale test of different methods of combining expert predictions

Evolutive Neural Net Fuzzy Filtering: Basic Description

Task Completion Transfer Learning for Reward Inference

Stochastic Calculus for Finance I (46-944) Spring 2008 Syllabus

Task Completion Transfer Learning for Reward Inference

Session 2B From understanding perspectives to informing public policy the potential and challenges for Q findings to inform survey design

LEGO MINDSTORMS Education EV3 Coding Activities

Improving Fairness in Memory Scheduling

An investigation of imitation learning algorithms for structured prediction

AP Calculus AB. Nevada Academic Standards that are assessable at the local level only.

ACTL5103 Stochastic Modelling For Actuaries. Course Outline Semester 2, 2014

SARDNET: A Self-Organizing Feature Map for Sequences

OPTIMIZATINON OF TRAINING SETS FOR HEBBIAN-LEARNING- BASED CLASSIFIERS

Using focal point learning to improve human machine tacit coordination

Introduction to Ensemble Learning Featuring Successes in the Netflix Prize Competition

Functional Skills Mathematics Level 2 assessment

DIGITAL GAMING & INTERACTIVE MEDIA BACHELOR S DEGREE. Junior Year. Summer (Bridge Quarter) Fall Winter Spring GAME Credits.

Cal s Dinner Card Deals

Probability and Game Theory Course Syllabus

IAT 888: Metacreation Machines endowed with creative behavior. Philippe Pasquier Office 565 (floor 14)

Seminar - Organic Computing

Testing A Moving Target: How Do We Test Machine Learning Systems? Peter Varhol Technology Strategy Research, USA

Chapter 2. Intelligent Agents. Outline. Agents and environments. Rationality. PEAS (Performance measure, Environment, Actuators, Sensors)

Teachable Robots: Understanding Human Teaching Behavior to Build More Effective Robot Learners

Managerial Decision Making

Executive Guide to Simulation for Health

Transferring End-to-End Visuomotor Control from Simulation to Real World for a Multi-Stage Task

Softprop: Softmax Neural Network Backpropagation Learning

Curriculum Design Project with Virtual Manipulatives. Gwenanne Salkind. George Mason University EDCI 856. Dr. Patricia Moyer-Packenham

Iterative Cross-Training: An Algorithm for Learning from Unlabeled Web Pages

AUTOMATIC DETECTION OF PROLONGED FRICATIVE PHONEMES WITH THE HIDDEN MARKOV MODELS APPROACH 1. INTRODUCTION

Mathematics process categories

ADVANCED MACHINE LEARNING WITH PYTHON BY JOHN HEARTY DOWNLOAD EBOOK : ADVANCED MACHINE LEARNING WITH PYTHON BY JOHN HEARTY PDF

Using Deep Convolutional Neural Networks in Monte Carlo Tree Search

A Comparison of Annealing Techniques for Academic Course Scheduling

Unsupervised Learning of Word Semantic Embedding using the Deep Structured Semantic Model

Statewide Framework Document for:

Knowledge Transfer in Deep Convolutional Neural Nets

Mathematics subject curriculum

12- A whirlwind tour of statistics

Essentials of Ability Testing. Joni Lakin Assistant Professor Educational Foundations, Leadership, and Technology

Experiments with SMS Translation and Stochastic Gradient Descent in Spanish Text Author Profiling

Software Maintenance

Version Space. Term 2012/2013 LSI - FIB. Javier Béjar cbea (LSI - FIB) Version Space Term 2012/ / 18

Results In. Planning Questions. Tony Frontier Five Levers to Improve Learning 1

Lesson plan for Maze Game 1: Using vector representations to move through a maze Time for activity: homework for 20 minutes

Getting Started with TI-Nspire High School Science

INTERMEDIATE ALGEBRA PRODUCT GUIDE

COMPUTER-AIDED DESIGN TOOLS THAT ADAPT

The Strong Minimalist Thesis and Bounded Optimality

Transcription:

School of Computer Science 10-701 Introduction to Machine Learning Reinforcement Learning Readings: Mitchell Ch. 13 Matt Gormley Lecture 22 November 30, 2016 1

Poster Session Reminders Fri, Dec 2: 2:30pm 5:30 pm Final Report due Fri, Dec 9 2

REINFORCEMENT LEARNING 3

What is Learning? Learning takes place as a result of interaction between an agent and the world, the idea behind learning is that Percepts received by an agent should be used not only for understanding/interpreting/prediction, as in the machine learning tasks we have addressed so far, but also for acting, and further more for improving the agent s ability to behave optimally in the future to achieve the goal. 4

Types of Learning Supervised Learning A situation in which sample (input, output) pairs of the function to be learned can be perceived or are given You can think it as if there is a kind teacher - Training data: (X,Y). (features, label) - Predict Y, minimizing some loss. - Regression, Classification. Unsupervised Learning - Training data: X. (features only) - Find similar points in high-dim X-space. - Clustering. 5

Example of Supervised Learning Predict the price of a stock in 6 months from now, based on economic data. (Regression) Predict whether a patient, hospitalized due to a heart attack, will have a second heart attack. The prediction is to be based on demographic, diet and clinical measurements for that patient. (Logistic Regression) Identify the numbers in a handwritten ZIP code, from a digitized image (pixels). (Classification) 6

Example of Unsupervised Learning From the DNA micro-array data, determine which genes are most similar in terms of their expression profiles. (Clustering) 7

Types of Learning (Cont d) Reinforcement Learning in the case of the agent acts on its environment, it receives some evaluation of its action (reinforcement), but is not told of which action is the correct one to achieve its goal - Training data: (S, A, R). (State-Action-Reward) - Develop an optimal policy (sequence of decision rules) for the learner so as to maximize its long-term reward. - Robotics, Board game playing programs. 8

RL is learning from interaction 9

Examples of Reinforcement Learning How should a robot behave so as to optimize its performance? (Robotics) How to automate the motion of a helicopter? (Control Theory) How to make a good chess-playing program? (Artificial Intelligence) 10

Autonomous Helicopter Video: https://www.youtube.com/watch?v=vcdxqn0fcne 11

Robot in a room what s the strategy to achieve max reward? what if the actions were NOT deterministic? 12

Pole Balancing Task: Move car left/right to keep the pole balanced State representation Position and velocity of the car Angle and angular velocity of the pole 13

History of Reinforcement Learning Roots in the psychology of animal learning (Thorndike,1911). Another independent thread was the problem of optimal control, and its solution using dynamic programming (Bellman, 1957). Idea of temporal difference learning (on-line method), e.g., playing board games (Samuel, 1959). A major breakthrough was the discovery of Q-learning (Watkins, 1989). 14

What is special about RL? RL is learning how to map states to actions, so as to maximize a numerical reward over time. Unlike other forms of learning, it is a multistage decisionmaking process (often Markovian). An RL agent must learn by trial-and-error. (Not entirely supervised, but interactive) Actions may affect not only the immediate reward but also subsequent rewards (Delayed effect). 15

Elements of RL A policy - A map from state space to action space. - May be stochastic. A reward function - It maps each state (or, state-action pair) to a real number, called reward. A value function - Value of a state (or, state-action pair) is the total expected reward, starting from that state (or, state-action pair). 16

Maze Example Start Rewards: -1 per time-step Actions: N, E, S, W States: Agent s location Goal Slide from David Silver (Intro RL lecture) 17

Maze Example Policy: Start Goal Arrows represent policy (s) for each state s Slide from David Silver (Intro RL lecture) 18

Maze Example Value Function: (Expected Future Reward) -14-13 -12-11 -10-9 Start -16-15 -12-8 -16-17 -6-7 -18-19 -5-24 -20-4 -3-23 -22-21 -22-2 -1 Goal Numbers represent value v (s) of each state s Slide from David Silver (Intro RL lecture) 19

Maze Example Model: Start -1-1 -1-1 -1-1 -1-1 -1-1 -1-1 -1-1 -1-1 -1-1 Goal Agent may have an internal model of the environment Dynamics: how actions change the state Rewards: how much reward from each state The model may be imperfect Grid layout represents transition model P a ss 0 Numbers represent immediate reward R a s from each state s (same for all a) Slide from David Silver (Intro RL lecture) 20

Policy 21

Reward for each step -2 22

Reward for each step: -0.1 23

Reward for each step: -0.04 24

The Precise Goal To find a policy that maximizes the Value function. transitions and rewards usually not available There are different approaches to achieve this goal in various situations. Value iteration and Policy iteration are two more classic approaches to this problem. But essentially both are dynamic programming. Q-learning is a more recent approaches to this problem. Essentially it is a temporal-difference method. 25

MARKOV DECISION PROCESSES 26

Markov Decision Processes A Markov decision process is a tuple where: 27

The dynamics of an MDP We start in some state s 0, and get to choose some action a 0 A As a result of our choice, the state of the MDP randomly transitions to some successor state s 1, drawn according to s 1 ~ P s0a0 Then, we get to pick another action a 1 28

The dynamics of an MDP, (Cont d) Upon visiting the sequence of states s 0, s 1,, with actions a 0, a 1,, our total payoff is given by Or, when we are writing rewards as a function of the states only, this becomes For most of our development, we will use the simpler state-rewards R(s), though the generalization to state-action rewards R(s; a) offers no special diffculties. Our goal in reinforcement learning is to choose actions over time so as to maximize the expected value of the total payoff: 29

FIXED POINT ITERATION 30

Fixed Point Iteration for Optimization Fixed point iteration is a general tool for solving systems of equations It can also be applied to optimization. J( ) dj( ) =0=f( ) d i 0=f( ) ) i = g( ) (t+1) i = g( (t) ) 1. Given objective function: 2. Compute derivative, set to zero (call this function f ). 3. Rearrange the equation s.t. one of parameters appears on the LHS. 4. Initialize the parameters. 5. For i in {1,...,K}, update each parameter and increment t: 6. Repeat #5 until convergence 31

Fixed Point Iteration for Optimization Fixed point iteration is a general tool for solving systems of equations It can also be applied to optimization. J(x) = x3 3 + 3 2 x2 +2x dj(x) dx = f(x) =x2 3x +2=0 ) x = x2 +2 3 x 2 +2 x 3 = g(x) 1. Given objective function: 2. Compute derivative, set to zero (call this function f ). 3. Rearrange the equation s.t. one of parameters appears on the LHS. 4. Initialize the parameters. 5. For i in {1,...,K}, update each parameter and increment t: 6. Repeat #5 until convergence 32

Fixed Point Iteration for Optimization J(x) = x3 3 + 3 2 x2 +2x dj(x) dx = f(x) =x2 3x +2=0 ) x = x2 +2 3 x 2 +2 x 3 = g(x) We can implement our example in a few lines of python. 33

Fixed Point Iteration for Optimization J(x) = x3 3 + 3 2 x2 +2x dj(x) dx = f(x) =x2 3x +2=0 ) x = x2 +2 3 x 2 +2 x 3 = g(x) $ python fixed-point-iteration.py i= 0 x=0.0000 f(x)=2.0000 i= 1 x=0.6667 f(x)=0.4444 i= 2 x=0.8148 f(x)=0.2195 i= 3 x=0.8880 f(x)=0.1246 i= 4 x=0.9295 f(x)=0.0755 i= 5 x=0.9547 f(x)=0.0474 i= 6 x=0.9705 f(x)=0.0304 i= 7 x=0.9806 f(x)=0.0198 i= 8 x=0.9872 f(x)=0.0130 i= 9 x=0.9915 f(x)=0.0086 i=10 x=0.9944 f(x)=0.0057 i=11 x=0.9963 f(x)=0.0038 i=12 x=0.9975 f(x)=0.0025 i=13 x=0.9983 f(x)=0.0017 i=14 x=0.9989 f(x)=0.0011 i=15 x=0.9993 f(x)=0.0007 i=16 x=0.9995 f(x)=0.0005 i=17 x=0.9997 f(x)=0.0003 i=18 x=0.9998 f(x)=0.0002 i=19 x=0.9999 f(x)=0.0001 i=20 x=0.9999 f(x)=0.0001 34

VALUE ITERATION 35

Elements of RL A policy - A map from state space to action space. - May be stochastic. A reward function - It maps each state (or, state-action pair) to a real number, called reward. A value function - Value of a state (or, state-action pair) is the total expected reward, starting from that state (or, state-action pair). 36

Policy A policy is any function mapping from the states to the actions. We say that we are executing some policy if, whenever we are in state s, we take action a = π(s). We also define the value function for a policy π according to V π (s) is simply the expected sum of discounted rewards upon starting in state s, and taking actions according to π. 37

Value Function Given a fixed policy π, its value function V π satisfies the Bellman equations: Immediate reward expected sum of future discounted rewards Bellman's equations can be used to efficiently solve for V π (see later) 38

The Grid world M = 0.8 in direction you want to go 0.2 in perpendicular Policy: mapping from states to actions An optimal policy for the stochastic environmen t: 3 2 1 Environment +1-1 1 2 3 4 0.1 left 0.1 right 3 2 1 0.812 0.762 0.705 utilities of states: 0.868 0.912 0.660 +1-1 0.655 0.611 0.388 1 2 3 4 Observable (accessible): percept identifies the state Partially observable Markov property: Transition probabilities depend on state only, not on the path to the state. Markov decision problem (MDP). Partially observable MDP (POMDP): percepts does not have enough info to identify 39

Optimal value function We define the optimal value function according to (1) In other words, this is the best possible expected sum of discounted rewards that can be attained using any policy There is a version of Bellman's equations for the optimal value function: (2) Why? 40

Optimal policy We also define a policy : as follows: (3) Fact: Policy π * has the interesting property that it is the optimal policy for all states s. It is not the case that if we were starting in some state s then there'd be some optimal policy for that state, and if we were starting in some other state s 0 then there'd be some other policy that's optimal policy for s 0. The same policy π * attains the maximum above for all states s. This means that we can use the same policy no matter what the initial state of our MDP is. 41

The Basic Setting for Learning Training data: n finite horizon trajectories, of the form s, a, r,..., s, a, r, s }. { 0 0 0 T T T T + 1 Deterministic or stochastic policy: A sequence of decision rules π, π,..., π }. { 0 1 T Each π maps from the observable history (states and actions) to the action space at that time point. 42

Algorithm 1: Value iteration Consider only MDPs with finite state and action spaces The value iteration algorithm: synchronous update asynchronous updates It can be shown that value iteration will cause V to converge to V *. Having found V*, we can then use Equation (3) to find the optimal policy. 43

Algorithm 2: Policy iteration The policy iteration algorithm: The inner-loop repeatedly computes the value function for the current policy, and then updates the policy using the current value function. Greedy update After at most a finite number of iterations of this algorithm, V will converge to V*, and π will converge to π*. 44

Convergence The utility values for selected states at each iteration step in the application of VALUE-ITERATION to the 4x3 world in our example 3 2 1 +1-1 start 1 2 3 4 Thrm: As tà, value iteration converges to exact U even if updates are done asynchronously & i is picked randomly at every step. 45

Convergence When to stop value iteration? 46

Q- LEARNING 47

Q learning Define Q-value function Q-value function updating rule See subsequent slides Key idea of TD-Q learning Combined with temporal difference approach Rule to chose the action to take 48

Algorithm 3: Q learning For each pair (s, a), initialize Q(s,a) Observe the current state s Loop forever { Select an action a (optionally with ε-exploration) and execute it Receive immediate reward r and observe the new state s Update Q(s,a) } s=s 49

Exploration Tradeoff between exploitation (control) and exploration (identification) Extremes: greedy vs. random acting (n-armed bandit models) Q-learning converges to optimal Q-values if Every state is visited infinitely often (due to exploration), The action selection becomes greedy as time approaches infinity, and The learning rate a is decreased fast enough but not too fast (as we discussed in TD learning) 50

RL EXAMPLES 51

A Success Story TD Gammon (Tesauro, G., 1992) - A Backgammon playing program. - Application of temporal difference learning. - The basic learner is a neural network. - It trained itself to the world class level by playing against itself and learning from the outcome. So smart!! - More information: http://www.research.ibm.com/massive/ tdl.html 52

Atari Example: Reinforcement Learni Playing Atari with Deep RL Setup: RL system observes the pixels on the screen It receives rewards as the game score Actions decide how to move the joystick / buttons Figures from David Silver (Intro RL lecture) observation action Ot At reward Rt 53

Playing Atari with Deep RL Figure 1: Screen shots from five Atari 2600 Games: (Left-to-right) Pong, Breakout, Space Invaders, Seaquest, Beam Rider Videos: Atari: https://www.youtube.com/watch? v=v1eynij0rnk Space Invaders: https://www.youtube.com/watch? v=epv0fs9cggu Figures from Mnih et al. (2013) 54

Playing Atari with Deep RL Figure 1: Screen shots from five Atari 2600 Games: (Left-to-right) Pong, Breakout, Space Invaders, Seaquest, Beam Rider B. Rider Breakout Enduro Pong Q*bert Seaquest S. Invaders Random 354 1.2 0 20.4 157 110 179 Sarsa [3] 996 5.2 129 19 614 665 271 Contingency [4] 1743 6 159 17 960 723 268 DQN 4092 168 470 20 1952 1705 581 Human 7456 31 368 3 18900 28010 3690 HNeat Best [8] 3616 52 106 19 1800 920 1720 HNeat Pixel [8] 1332 4 91 16 1325 800 1145 DQN Best 5184 225 661 21 4500 1740 1075 Table 1: The upper table compares average total reward for various learning methods by running an -greedy policy with =0.05 for a fixed number of steps. The lower table reports results of the single best performing episode for HNeat and DQN. HNeat produces deterministic policies that always get the same score while DQN used an -greedy policy with =0.05. Figures from Mnih et al. (2013) 55

Alpha Go Game of Go ( 圍棋 ) 19x19 board Players alternately play black/white stones Goal is to fully encircle the largest region on the board Simple rules, but extremely complex game play Figure from Silver et al. (2016) Game 1 Fan Hui (Black), AlphaGo (White) AlphaGo wins by 2.5 points 229 228 59 39 230 148 208 210 211 156 154 205 155 157 60 31 23 3 36 37 38 194 193 42 52 53 54 55 56 135 61 87 40 10 1 132 128 216 137 206 233 118 74 13 108 2 24 93 35 84 169 271 41 96 95 99 97 91 92 85 86 90 98 94 100 34 58 57 50 49 47 48 70 43 44 20 45 46 8 67 65 69 62 21 51 82 81 224 79 83 88 195 89 242 269 270 145 143 146 255 191 227 237 253 207 267 240 241 204 139 142 144 261 265 254 170 252 256 174 136 212 140 260 63 64 66 71 72 73 133 101 102 258 173 262 121 263 119 110 130 131 103 104 259 217 129 215 218 117 166 163 147 162 203 202 201 151 152 149 150 186 184 183 168 185 181 182 188 167 189 187 264 226 225 80 27 105 109 126 106 124 114 190 171 172 257 141 219 115 116 29 134 22 138 30 179 200 234 at 179 245 at 122 250 at 59 180 196 238 251 213 209 214 266 221 220 120 127 165 164 4 7 68 6 77 75 14 5 12 15 16 28 17 33 223 32 78 76 11 18 19 9 222 231 160 161 236 232 235 248 268 153 199 176 177 192 175 197 178 198 112 158 25 26 113 111 249 107 159 239 272 244 243 123 122 125 246 247 56 136 182 at G A A

Alpha Go State space is too large to represent explicitly since # of sequences of moves is O(b d ) Go: b=250 and d=150 Chess: b=35 and d=80 Key idea: Define a neural network to approximate the value function Train by policy gradient a Rollout policy SL policy network RL policy network Value network Policy network Value network b p p p p (a s) (s ) Classification Classification Human expert positions Policy gradient Figure 1 Neural network training pipeline and architecture. a, A fast Figure from Silver et al. (2016) Self Play Regression Self-play positions Neural network Data s s the current player wins) in positions from the self-play data set. 57

Alpha Go 3,000 9d 7d 2,000 5d 1,500 3d 1,000 1d 1k 5k 7k 0 Beginner kyu (k) 3k 500 Amateur dan (d) Elo Rating 2,500 Professional dan (p) 9p 7p 5p 3p 1p 3,500 GnuGo Fuego Pachi Crazy Stone Fan Hui AlphaGo Figure from Silver et al. (2016) a AlphaGo distributed Results of a tournament From Silver et al. (2016): a 230 point gap corresponds to a 79% probability of winning Va Po Figure 4 Tournament evaluation of AlphaGo. a, Results of a tournament between different Go programs (see Extended Dat 6 11). Each program used approximately 5 s computation time 58 (pa To provide a greater challenge to AlphaGo, some programs

SUMMARY 59

Summary Both value iteration and policy iteration are standard algorithms for solving MDPs, and there isn't currently universal agreement over which algorithm is better. For small MDPs, value iteration is often very fast and converges with very few iterations. However, for MDPs with large state spaces, solving for V explicitly would involve solving a large system of linear equations, and could be difficult. In these problems, policy iteration may be preferred. In practice value iteration seems to be used more often than policy iteration. Q-learning is model-free, and explore the temporal difference 60

Types of Learning Supervised Learning - Training data: (X,Y). (features, label) - Predict Y, minimizing some loss. - Regression, Classification. Unsupervised Learning - Training data: X. (features only) - Find similar points in high-dim X-space. - Clustering. Reinforcement Learning - Training data: (S, A, R). (State-Action-Reward) - Develop an optimal policy (sequence of decision rules) for the learner so as to maximize its long-term reward. - Robotics, Board game playing programs 61