Docsity

Reinforcement Learning: Estimating Parameters and Learning Optimal Actions, Assignments of Programming Languages

Partial preview of the text

Download Reinforcement Learning: Estimating Parameters and Learning Optimal Actions and more Assignments Programming Languages in PDF only on Docsity!

Intro to Reinforcement

Learning

Learning how to get what you want...

Administrivia

  • HW 2 due today
    • You’ve all turned it in,^ right?
  • Remember:
    • Midterm^ Thu,^ Oct 21
    • Office hours cancelled Oct 20
    • Reading 2 due Oct 26
  • Class survey today
    • Anonymous
    • Help me make the class better!

Exercise

  • Suppose you want to estimate the average air speed of an unladen (African) swallow
  • Let’s say that airspeeds of individual swallows,^ x ,^ are Gaussianly distributed with mean and variance 1:
  • Let’s say,^ also,^ that we think the mean^ is “around” 50 kph, but we’re not sure exactly what it

is. But our uncertainty (variance) is 10 kph.

  • Derive the posterior estimate of the mean airspeed.

μ

f (x) =

2 π

e

−

(x−μ)^2 2

μ

Pop Quiz

  • What happens to the posterior estimate of^ μ^ as N → ∞?
  • Just kidding!^ Not a real pop quiz for credit...
    • ...^ this^ time
    • But a question like this^ could^ be on the exam
    • Be sure you understand how ML and Bayesian parameter estimation work!

Posterior Gaussian Airspeed

α

′ exp

(μ − 50)

2

) N

i=

exp

(xi − μ)

2

= α

′ exp

(μ − 50)

2

exp

∑N

i=1 (xi^ −^ μ)

2

= α

′ exp

(μ − 50)

2

∑N

i=1 (xi^ −^ μ)

2

= α

′ exp

(μ − 50)

2

  • 10

∑N

i=1 (xi^ −^ μ)

2

Posterior Gaussian Airspeed

α

′ exp

(μ − 50)

2

  • 10

∑N

i=1 (xi^ −^ μ)

2

μ

2 − 100 μ + 50

2

  • 10

N ∑

i=

x

2 i −^2 μxi^ +^ μ

2

Let’s look just at the numerator for a second...

= μ

2

  • 10N μ

2

− 100 μ − 20

∑N

i=

xi

μ

2

  • 10

∑N

i=

x

2 i

Posterior Gaussian Airspeed

μ −

[

10 N 10 N +

1 N

∑N

i=

xi

1 10 N +

]) 2

10 10 N +

Average of data

(data mean)

Prior mean

Linear combination

(weighted avg.)

Intro to Reinforcement

Learning

Start with an easy case

  • V.^ simple maze:
    • Whenever Mack goes left,^ he gets cheese
    • Whenever he goes right,^ he gets shocked
    • After reward/punishment,^ he’s reset back to start of maze
  • Q:^ how can Mack learn to act well in this world?

Learning in the easy case

  • Say there are two labels:^ “cheese” and^ “shock”
  • Mack tries a bunch of trials in the world -- that generates a bunch of experiences:
  • Now what?

Action Result        left

left

right

left

. . .

cheese

cheese

shock

cheese

. . .

Reward functions

  • In general,^ we think of a^ reward function:
  • R ()^ tells us whether^ Mack^ thinks a particular outcome is good or bad
  • Mack before drugs:
  • R (cheese)=+
  • R (shock)=-
  • Mack after drugs:
  • R (cheese)=-
  • R (shock)=+
  • Behavior always depends on rewards (utilities)

R : outcomes →

Maximizing reward

  • So Mack wants to get the maximum possible reward
  • (Whatever that means to him)
  • For the one-shot case like this,^ this is fairly easy
  • Now what about a harder case?