1 / 30

CS 188: Artificial Intelligence Spring 2007

CS 188: Artificial Intelligence Spring 2007. Lecture 23: Reinforcement Learning: III 4/17/2007. Srini Narayanan – ICSI and UC Berkeley. Announcements. Othello tournament rules up. On-line readings for this week. Value Iteration. Idea:

merrill
Télécharger la présentation

CS 188: Artificial Intelligence Spring 2007

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 188: Artificial IntelligenceSpring 2007 Lecture 23: Reinforcement Learning: III 4/17/2007 Srini Narayanan – ICSI and UC Berkeley

  2. Announcements • Othello tournament rules up. • On-line readings for this week.

  3. Value Iteration • Idea: • Start with bad guesses at all utility values (e.g. V0(s) = 0) • Update all values simultaneously using the Bellman equation (called a value update or Bellman update): • Repeat until convergence • Theorem: will converge to unique optimal values • Basic idea: bad guesses get refined towards optimal values • Policy may converge long before values do

  4. Example: Bellman Updates

  5. Example: Value Iteration • Information propagates outward from terminal states and eventually all states have correct value estimates [DEMO]

  6. Policy Iteration • Alternate approach: • Policy evaluation: calculate utilities for a fixed policy until convergence (remember last lecture) • Policy improvement: update policy based on resulting converged utilities • Repeat until policy converges • This is policy iteration • Can converge faster under some conditions

  7. Policy Iteration • If we have a fixed policy , use simplified Bellman equation to calculate utilities: • For fixed utilities, easy to find the best action according to one-step look-ahead

  8. Comparison • In value iteration: • Every pass (or “backup”) updates both utilities (explicitly, based on current utilities) and policy (possibly implicitly, based on current policy) • In policy iteration: • Several passes to update utilities with frozen policy • Occasional passes to update policies • Hybrid approaches (asynchronous policy iteration): • Any sequences of partial updates to either policy entries or utilities will converge if every state is visited infinitely often

  9. Reinforcement Learning • Reinforcement learning: • Still have an MDP: • A set of states s  S • A set of actions (per state) A • A model T(s,a,s’) • A reward function R(s,a,s’) • Still looking for a policy (s) • New twist: don’t know T or R • I.e. don’t know which states are good or what the actions do • Must actually try actions and states out to learn [DEMO]

  10. Example: Animal Learning • RL studied experimentally for more than 60 years in psychology • Rewards: food, pain, hunger, drugs, etc. • Mechanisms and sophistication debated • Example: foraging • Bees learn near-optimal foraging plan in field of artificial flowers with controlled nectar supplies • Bees have a direct neural connection from nectar intake measurement to motor planning area

  11. Passive Learning • Simplified task • You don’t know the transitions T(s,a,s’) • You don’t know the rewards R(s,a,s’) • You are given a policy (s) • Goal: learn the state values (and maybe the model) • In this case: • No choice about what actions to take • Just execute the policy and learn from experience • We’ll get to the general case soon

  12. Example: Direct EstimationSimple Monte Carlo y • Episodes: +100 (1,1) up -1 (1,2) up -1 (1,2) up -1 (1,3) right -1 (2,3) right -1 (3,3) right -1 (3,2) up -1 (3,3) right -1 (4,3) exit +100 (done) (1,1) up -1 (1,2) up -1 (1,3) right -1 (2,3) right -1 (3,3) right -1 (3,2) up -1 (4,2) exit -100 (done) -100 x  = 1, R = -1 U(1,1) ~ (92 + -106) / 2 = -7 U(3,3) ~ (99 + 97 + -102) / 3 = 31.3

  13. Model-Based Learning • Idea: • Learn the model empirically (rather than values) • Solve the MDP as if the learned model were correct • Empirical model learning • Simplest case: • Count outcomes for each s,a • Normalize to give estimate of T(s,a,s’) • Discover R(s,a,s’) the first time we experience (s,a,s’) • More complex learners are possible (e.g. if we know that all squares have related action outcomes, e.g. “stationary noise”)

  14. Example: Model-Based Learning y • Episodes: +100 (1,1) up -1 (1,2) up -1 (1,2) up -1 (1,3) right -1 (2,3) right -1 (3,3) right -1 (3,2) up -1 (3,3) right -1 (4,3) exit +100 (done) (1,1) up -1 (1,2) up -1 (1,3) right -1 (2,3) right -1 (3,3) right -1 (3,2) up -1 (4,2) exit -100 (done) -100 x  = 1 T(<3,3>, right, <4,3>) = 1 / 3 T(<2,3>, right, <3,3>) = 2 / 2

  15. Model-Based Learning • In general, want to learn the optimal policy, not evaluate a fixed policy • Idea: adaptive dynamic programming • Learn an initial model of the environment: • Solve for the optimal policy for this model (value or policy iteration) • Refine model through experience and repeat • Crucial: we have to make sure we actually learn about all of the model

  16. Example: Greedy ADP • Imagine we find the lower path to the good exit first • Some states will never be visited following this policy from (1,1) • We’ll keep re-using this policy because following it never collects the regions of the model we need to learn the optimal policy ? ?

  17. What Went Wrong? • Problem with following optimal policy for current model: • Never learn about better regions of the space if current policy neglects them • Fundamental tradeoff: exploration vs. exploitation • Exploration: must take actions with suboptimal estimates to discover new rewards and increase eventual utility • Exploitation: once the true optimal policy is learned, exploration reduces utility • Systems must explore in the beginning and exploit in the limit ? ?

  18. T T T T T T T T T T Dynamic Programming T T T

  19. T T T T T T T T T T T T T T T T T T T T Simple Monte Carlo

  20. T T T T T T T T T T T T T T T T T T T T Simplest TD Method

  21. s a s, a s,a,s’ s’ Model-Free Learning • Big idea: why bother learning T? • Update each time we experience a transition • Frequent outcomes will contribute more updates (over time) • Temporal difference learning (TD) • Policy still fixed! • Move values toward value of whatever successor occurs

  22. TD Learning features • On-line • Incremental • Bootstrapping (like DP unlike MC) • Model free • Does not require special treatment of exploration actions (unlike DP) • Converges for any policy to the correct value of a state for that policy. • As long as • Alpha is high in the beginning and low at the end (say 1/k) • Gamma less than one

  23. s a s, a s,a,s’ s’ Problems with TD Value Learning • TD value learning is model-free for policy evaluation • However, if we want to turn our value estimates into a policy, we’re sunk: • Idea: Learn state-action pairings (Q-values) directly • Makes action selection model-free too!

  24. Q-Functions • To simplify things, introduce a q-value, for a state and action under a policy • Utility of taking starting in state s, taking action a, then following  thereafter

  25. The Bellman Equations • Definition of utility leads to a simple relationship amongst optimal utility values: Optimal rewards = maximize over first action and then follow optimal policy • Formally:

  26. Q-Learning • Learn Q*(s,a) values • Receive a sample (s,a,s’,r) • Consider your old estimate: • Consider your new sample estimate: • Nudge the old estimate towards the new sample:

  27. Q-Learning

  28. Exploration / Exploitation • Several schemes for forcing exploration • Simplest: random actions (-greedy) • Every time step, flip a coin • With probability , act randomly • With probability 1-, act according to current policy • Problems with random actions? • You do explore the space, but keep thrashing around once learning is done • One solution: lower  over time • Another solution: exploration functions

  29. Demo of Q Learning • Demo Robot crawling • Parameters • a = 1/k (learning rate) • g = discounted reward (high for future rewards) • e = exploration(should decrease with time) • MDP • number of pixel moved to the right/ iteration number • Actions : Arm up and down (yellow line), hand up and down (red line)

  30. Q-Learning Properties • Will converge to optimal policy • If you explore enough • If you make the learning rate small enough • Neat property: does not learn policies which are optimal in the presence of action selection noise

More Related