Docsity

Markov Decision Processes in Machine Learning and Data Mining | CS 434, Study notes of Computer Science

Partial preview of the text

Download Markov Decision Processes in Machine Learning and Data Mining | CS 434 and more Study notes Computer Science in PDF only on Docsity!

Markov Decision Processes contMarkov

Decision

Processes

cont

Nov

‐^16

‐^2007

ExampleExample

R(4,3)

=^ +

(Agent

wants

to^

get

here)

R(4,2)

=^ ‐

1 (Agent

wants

to^

avoid

this

R(s)

=^ ‐

(for

all

other

states)

U(s

,^ …, 1

s^ )n

=^ R(s

)^ + 1

…^

+^ R(s

)n If^ the

states

an^ agent

goes

through

are^

Up,^ Up,

Right,

Right,

Right,

the^

utility

of^ this

environment

history

is:^ ‐0.

‐0.

‐0.

‐0.

‐

0 04+1 0 .04+

CS^

  • Fall^2007

2

Markov Decision ProcessMarkov

Decision

Process

The

specification

of^

a^ sequential

decision

problem

for

a^ fully

p^

q^

p^

y

observable

environment

with

a^ Markovian transition

model

and

additive

rewards

is^ called

a^ Markov

Decision

Process

(MDP)

An^

MDP

has

the

following

components:

1

A finite set of states S along with an initial state S

1.^

A^ finite

set

of^

states

S^ along

with

an^

initial

state

S^0

2.^

A^ finite

set

of^

actions

A

3.^

Transition

Model:

T(s,

a,^ s’)

=^ P(

s’^ |

a,^ s

)

( ,^

,^ )

(^

|^ ,

)

4.^

Reward

Function:

R(s)

CS^

  • Fall^2007

4

Is this a good action plan?Is^

this

a

good

action

plan?

[1 1]

Up [1,1]

‐Up [1,2]

‐Up [1 3] Ri ht[1,3]

‐Right [2,3]

‐Right [^

]^

h

[3,3]

‐Right What

if^ we

ended

up

in^ cell

[2,1]?

CS^

  • Fall^2007

5

Value of a policyValue

of

a

policy

-^ There

are

obviously

many

different

policies

for

an^

MDP

-^ Some

are

better

than

others

‐‐‐^

we^

would

like

to^

find

the

“best”

one,

i.e.,

the

optimal

policy

π*

-^ How

do^

we^

evaluate

a^ p

olicy?p

y

-^ We

can

look

at^ the

state

sequence

it^ produces

and

compute

its^ utility • But

every

time

we

start

at^ the

initial

state

and

execute

a

y policy,

we

get

a^ different

state

sequence

(due

to^

the

stochastic

nature

of^ the

environment)

-^ This

means

we

get

a^ different

utility

every

time

we

execute

a

g^

y^

y

policy • Need

to^

measure

the

expected

utility (the

utility

we

will

obtain

on^

average

if^ we

apply

the

policy

for

many

times)

CS^

  • Fall^2007

7

Optimal Policy ExampleOptimal

Policy

Example

R(s)=

‐0.04^ Notice

the^

tradeoff

between

risk^

and^

reward!

CS^

  • Fall^2007

8

Finite/Infinite HorizonsFinite/Infinite

Horizons

-^ Finite

horizon:

fixed

time

N^ after

which

nothing

matters (think of this as a deadline)matters

(think

of^

this

as

a^ deadline)

-^ Suppose

our

agent

starts

at^

R(s)=

and

N=3.

Then

to

get

to^

the

state,

agent

must

go

up. • If^ N=100,

agent

can

take

the

safe

route

around

CS^

  • Fall^2007

10

Nonstationary PoliciesNonstationary

Policies

-^ Nonstationary

policy

π^ (s, t): the action to take

Nonstationary

policy

π^ (s,

t):

the

action

to

take

depends

both

on

s^ (the

state)

and t

(how

many

time

steps

are

remaining)

-^ With

a^ finite

horizon,

the

optimal

policy

is^ nonstationary

-^ With

an

infinite

horizon,

there

is^ no

incentive

to

behave

differently

in^

the

same

state

at^

different

times

-^ With

an

infinite

horizon,

the

optimal

policy

is^ stationary

(π^ (s)) • We

will

assume

infinite

horizons

and

stationary

policies

CS^

  • Fall^2007

11

Discounted RewardsDiscounted

Rewards

We

can

discount

future

rewards,

and

define

the

utility

of a state sequence as:of^ a

state

sequence

as:

U(s

,^ s 0

,^ s 1

,^ …) 2

=^ R(s

)^ + 0 γR(s

)^ + 1

(^2) γR(s

)^ + 2 …

Where 0

≤^ γ

≤^ 1 is the discount factor

Where

γ^ ≤

1 is

the

discount

factor

Assuming

largest

possible

reward

is^ R

max

and

γ^ <

∞

)(

,...), ,(

(^0) max (^21) 0

γ

∞

∞ = R R

sR

ss sU t

t t

t

Discounted

rewards

are

always

finite,

even

for

infinite

) max (^1) ( max 0

γ

γ^

−

≤^ ∑=

R t

t

CS^

  • Fall^2007

13

y^

state

sequences!

More About the Discount FactorMore

About

the

Discount

Factor

-^ Describes

preference

for

current

rewards

over

future

p

rewards • Compensates

for

uncertainty

in^

available

time

(^

d l

l^

(models

mortality)

-^ Eg.

Being

promised

next

year

is^ only

worth

90% of being promised $10000 now90%

of^

being

promised

now

-^ γ

near

0 means

future

rewards

don’t

mean

anything

-^ γ

= 1 makes discounted rewards equivalent to theγ =^1

makes

discounted

rewards

equivalent

to^

the

simple

additive

rewards

CS^

  • Fall^2007

14

How

(not)

to

computing

optimal

policies

(^

)^

p^

g^

p^

p

-^ Enumerate policiesEnumerate

policies

-^ Caculate

the

expected

utility

(discounted

rewards) starting from the initial staterewards)

starting

from

the

initial

state

-^ E.g.,

by

simulating

a^ bunch

of^

runs,

average

their

final

utilities

-^ Choose

the

best

policy

CS^

  • Fall^2007

16

Utilities of StatesUtilities

of

States

-^ Idea: some states are better than the others, a goodIdea:

some

states

are

better

than

the

others,

a^ good

policy

may

be

“try

to^

get

to^

a^ good

states”

•^ (

is^ better

than

because

it^ is

closer

to^

the

goal

state

?

?

CS^

  • Fall^2007

17

Utilities in the Maze ExampleUtilities

in

the

Maze

Example

Start

at^

state

Let’s

suppose

we

choose

the

action

Up.

U(1 1) = R(1 1) +U(1,1)

=^ R(

,1)^

+^ ... Reward for current state

CS^

  • Fall^2007

19

Reward

for^ current

state

Utilities in the Maze ExampleUtilities

in

the

Maze

Example

Start

at^

state

Let’s

h^

h^

i

choose

the

action

Up. b^ f^

h

U(1 1) = R(1 1) + 0 8U(1 2) + 0 1U(2 1) + 0 1*U(1 1)

Prob

of^ moving

right

U(1,1)

=^ R(

,1)^

+^0

.8*U(1,2)

+^0

.1*U(2,1)

+^0

.1*U(1,1)

Prob of moving up

Prob of moving left (into the wall)

Prob

of^ moving

up^

Prob

of^ moving

left^

(into

the^

wall)

and^

staying

put

20

CS^

  • Fall^2007