1 / 49

CS 182/Ling109/CogSci110 Spring 2008

Explore the fundamentals of reinforcement learning, understanding how agents maximize expected utility through reward-based actions. Dive into aspects like MEU, utility theory, neural correlates of reward, and more. Discover the importance of foresight and planning in optimal decision-making.

gomeza
Download Presentation

CS 182/Ling109/CogSci110 Spring 2008

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 182/Ling109/CogSci110Spring 2008 Reinforcement Learning: Basics 3/20/2008 Srini Narayanan – ICSI and UC Berkeley

  2. Lecture Outline • Introduction • Basic Concepts • Expectation, Utility, MEU • Neural correlates of reward based learning • Utility theory from economics • Preferences, Utilities. • Reinforcement Learning: AI approach

  3. Models of Learning • Hebbian ~ coincidence • Recruitment ~ one trial • Supervised ~ correction (backprop) • Reinforcement ~ Reward based • delayed reward • Unsupervised ~ similarity

  4. Reinforcement Learning • Basic idea: • Receive feedback in the form of rewards • also called reward based learning in psychology • Agent’s utility is defined by the reward function • Must learn to act so as to maximize expected utility • Change the rewards, change the behavior • Examples: • Learning coordinated behavior/skills (x-schemas) • Playing a game, reward at the end for winning / losing • Vacuuming robot, reward for each piece of dirt picked up • Automated taxi, reward for each passenger delivered

  5. Coordination: Making Breakfast • Phil prepares his breakfast. Closely examined, even this apparently mundane activity reveals a complex web of conditional behavior and interlocking goal-subgoal relationships: walking to the cupboard, opening it, selecting a cereal box, then reaching for, grasping, and retrieving the box. Other complex, tuned, interactive sequences of behavior are required to obtain a bowl, spoon, and milk jug. Each step involves a series of eye movements to obtain information and to guide reaching and locomotion. Rapid judgments are continually made about how to carry the objects or whether it is better to ferry some of them to the dining table before obtaining others. Each step is guided by goals, such as grasping a spoon or getting to the refrigerator, and is in service of other goals, such as having the spoon to eat with once the cereal is prepared and ultimately obtaining nourishment (Sutton and Barto,Section 1.1)

  6. Basic Features • Interaction between agent and environment. • Agent seeks to achieve a goal despite uncertainty in the environment. • Effects of actions cannot be completely predicted • Requires monitoring the environment frequently. • Agent’s actions change the future state of the environment (opportunities and future options are impacted) • Correct choice requires taking into account indirect, delayed consequences of actions, thus may require foresight or planning.

  7. Reinforcement Learning • Multiple fields contribute to the study of reinforcement learning • Economics • Utility theory and preferences, game theory • Artificial Intelligence • Machine learning, action and state representation, inference • Psychology • Reward based prediction and control, conditioning • Neuroscience • Reward related circuits, timing of rewards, neuroeconomics

  8. Basic Ideas • Utility • Preferences • Maximum Expected Utility (MEU) • Reward • Immediate and Delayed rewards • Average Reward • Discounting • Learning and Acting • Prediction error • Optimal Policy

  9. Basic Idea: Maximum Expected Utility (MEU) • MEU: An agent should chose the action which maximizes its expected utility, given its knowledge • General principle for decision making • Often taken as the definition of rationality • Let’s decompress this definition…

  10. Reminder: Expectations • Often a quantity of interest depends on a random variable • The expected value of a function is the average output, weighted by some distribution over inputs • Example: How late will I be? • Lateness is a function of traffic: L(T=none) = -10, L(T=light) = -5, L(T=heavy) = 15 • What is my expected lateness? • Need to specify some belief over T to weight the outcomes • Say P(T) = {none: 2/5, light: 2/5, heavy: 1/5} • The expected lateness:

  11. Expectations • Real valued functions of random variables: • Expectation of a function of a random variable • Example: Expected value of a fair die roll

  12. Utilities • Utilities are functions from outcomes (states of the world) to real numbers that describe an agent’s preferences • Where do utilities come from? • In a game, may be simple (+1/-1) • Utilities summarize the agent’s goals • Theorem: any set of preferences between outcomes can be summarized as a utility function (provided the preferences meet certain conditions) • In general, utilities are determined from rewards and actions emerge to maximize expected utility.

  13. Lecture Outline • Introduction • Basic Concepts • Expectation, Utility, MEU • Neural correlates of reward based learning • Utility theory from economics • Preferences, Utilities. • Reinforcement Learning: AI approach

  14. Multiple neurotransmitters are involved in reinforcement learning

  15. Dopamine based neural correlates Skill learning Natural rewards  Reward pathway?  Learning? Intracranial self-stimulation; Drug addiction; Parkinson’s Disease  Motor control + initiation? Also involved in: • Working memory • Novel situations • ADHD • Schizophrenia • …

  16. Conditioning Ivan Pavlov I rang the bell! CS UCS

  17. Unpredicted reward (unlearned/no stimulus) Predicted reward (learned task) Omitted reward (probe trial) Dopamine levels track prediction error (Montague et al. 1996) Wolfram Schultz Lab 1990-1996

  18. Basic concept: Prediction Error • Learning theory suggests that learning occurs when • a reward value fails to meet the value predicted by conditioned stimuli • The difference between expected and actual reward is the prediction error.

  19. Ventral Striatum and amount of reward

  20. Areas that are probably directly involved in RL • Basal Ganglia • Striatum (Ventral/Dorsal), Putamen, Substantia Nigra • Midbrain (VT) • Amygdala • Orbito-Frontal Cortex • Cingulate Circuit (ACC) • Cerebellum • PFC

  21. Current Hypothesis • Ventral Striatum (Nucleus Accumbens) encodes anticipation of reward. • Different (overlapping) circuits for reward and punishment (OFC involvement in punishment). • Phasic dopamine encodes a reward prediction error • Evidence • Monkey single cell recordings • Human fMRI studies • Current Research • Better information processing model • Other reward/punishment circuits including Amygdala (for visual perception) • Overall circuit (PFC-Basal Ganglia interaction) • More in future lectures! Preview Wolfram Schultz’s article at • http://www.scholarpedia.org/article/Reward_signals

  22. Lecture Outline • Introduction • Basic Concepts • Expectation, Utility, MEU • Neural correlates of reward based learning • Utility theory from economics • Preferences, Utilities. • Reinforcement Learning: AI approach

  23. Economic Models of Utility • Preferences • Rational Preferences • Axioms for preferences • Human Rationality?

  24. Preferences • An agent chooses among: • Prizes: A, B, etc. • Lotteries: situations with uncertain prizes • Notation:

  25. Rational Preferences • We want some constraints on preferences before we call them rational • For example: an agent with intransitive preferences can be induced to give away all its money • If B > C, then an agent with C would pay (say) 1 cent to get B • If A > B, then an agent with B would pay (say) 1 cent to get A • If C > A, then an agent with A would pay (say) 1 cent to get C

  26. Rational Preferences • Preferences of a rational agent must obey constraints. • These constraints (plus one more) are the axioms of rationality • Theorem: Rational preferences imply behavior describable as maximization of expected utility

  27. MEU Principle • Theorem: • [Ramsey, 1931; von Neumann & Morgenstern, 1944] • Given any preferences satisfying these constraints, there exists a real-valued function U such that: • Maximum expected likelihood (MEU) principle: • Choose the action that maximizes expected utility • Note: an agent can be entirely rational (consistent with MEU) without ever representing or manipulating utilities and probabilities • E.g., a lookup table for perfect tictactoe, reflex vacuum cleaner

  28. Human Utilities • Utilities map states to real numbers. Which numbers? • Standard approach to assessment of human utilities: • Compare a state A to a standard lottery Lp between • ``best possible prize'' u+ with probability p • ``worst possible catastrophe'' u- with probability 1-p • Adjust lottery probability p until A ~ Lp • Resulting p is a utility in [0,1]

  29. Utility Scales • Normalized utilities: u+ = 1.0, u- = 0.0 • Micromorts: one-millionth chance of death, useful for paying to reduce product risks, etc. • QALYs: quality-adjusted life years, useful for medical decisions involving substantial risk • One year with good health = 1 QALY • Note: behavior is invariant under positive linear transformation • With deterministic prizes only (no lottery choices), only ordinal utility can be determined, i.e., total order on prizes

  30. Example: Insurance • Consider the lottery [0.5,$1000; 0.5,$0] • What is its expected monetary value? ($500) • What is its certainty equivalent? • Monetary value acceptable in lieu of lottery • $400 for most people • Difference of $100 is the insurance premium • There’s an insurance industry because people will pay to reduce their risk • If everyone were risk-prone, no insurance needed!

  31. Example: Human Rationality? • Famous example of Allais (1953) • A: [0.8,$4k; 0.2,$0] • B: [1.0,$3k; 0.0,$0] • C: [0.2,$4k; 0.8,$0] • D: [0.25,$3k; 0.75,$0] • Most people prefer B > A, C > D • But if U($0) = 0, then • B > A  U($3k) > 0.8 U($4k) • C > D  0.8 U($4k) > U($3k)

  32. The Ultimatum Game • Proposer: receives $x, offers split $k / $(x-k) • Accepter: either • Accepts: gets $k, proposer gets $(x-k) • Rejects: neither gets anything • Nash equilibrium (MEU play)? • Any strategy profile where proposer offers $k and accepter will accept $k or greater • Issues: • Why do people tend to reject offers which are very unfair (e.g. $20 from $100)? • Irrationality? • Utility of $20 exceeded by utility of punishing the unfair proposer? • What about if x is very very large? • fMRI experiments: • Dopamine pathways implicated. • Pleasure from punishment of others or injustice? • More in coming lectures!

  33. Lecture Outline • Introduction • Basic Concepts • Expectation, Utility, MEU • Neural correlates of reward based learning • Utility theory from economics • Preferences, Utilities. • Reinforcement Learning: AI approach • The problem • Computing total expected value with discounting • Bellman’s equation

  34. Reinforcement Learning DEMO • Basic idea: • Receive feedback in the form of rewards • Agent’s utility is defined by the reward function • Must learn to act so as to maximize expected utility • Change the rewards, change the behavior • Examples: • Learning your way around, reward for reaching the destination. • Playing a game, reward at the end for winning / losing • Vacuuming a house, reward for each piece of dirt picked up • Automated taxi, reward for each passenger delivered

  35. State Reward Action Elements of RL • Transition model, how action influences states • Reward R, immediate value of state-action transition • Policy , maps states to actions Agent Policy Environment

  36. Markov Decision Processes • Markov decision processes (MDPs) • A set of states s  S • A model T(s,a,s’) = P(s’ | s,a) • Probability that action a in state s leads to s’ • A reward function R(s, a, s’) (sometimes just R(s) for leaving a state or R(s’) for entering one) • A start state (or distribution) • Maybe a terminal state • MDPs are the simplest case of reinforcement learning • In general reinforcement learning, we don’t know the model or the reward function

  37. MDP Solutions • In deterministic single-agent search, want an optimal sequence of actions from start to a goal • In an MDP we want an optimal policy (s) • A policy gives an action for each state • Optimal policy maximizes expected utility (i.e. expected rewards) if followed • Defines a reflex agent Optimal policy when R(s, a, s’) = -0.04 for all non-terminals s

  38. Example Optimal Policies R(s) = -0.01 R(s) = -0.03 R(s) = -0.4 R(s) = -2.0

  39. Stationarity • In order to formalize optimality of a policy, need to understand utilities of reward sequences • Typically consider stationary preferences: • Theorem: only two ways to define stationary utilities • Additive utility: • Discounted utility:

  40. Infinite Utilities?! • Problem: infinite state sequences with infinite rewards • Solutions: • Finite horizon: • Terminate after a fixed T steps • Gives nonstationary policy ( depends on time left) • Absorbing state(s): guarantee that for every policy, agent will eventually “die” (like a “done” state) • Discounting: for 0 <  < 1 • Smaller  means smaller horizon

  41. Finding Optimal Policies Demo

  42. How (Not) to Solve an MDP • The inefficient way: • Enumerate policies • For each one, calculate the expected utility (discounted rewards) from the start state • E.g. by simulating a bunch of runs • Choose the best policy • We’ll return to a (better) idea like this later

  43. Optimal Utilities • Goal: calculate the optimal utility of each state V*(s) = expected (discounted) rewards with optimal actions • Why: Given optimal utilities, MEU tells us the optimal policy

  44. That’s my equation! Bellman’s Equation for Selecting actions • Definition of utility leads to a simple relationship amongst optimal utility values: Optimal rewards = maximize over first action and then follow optimal policy Formally: Bellman’s Equation

  45. Example: GridWorld

  46. 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

  47. Example: Bellman Updates

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

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

More Related