go as planned ✤ 80% of the time, the action North takes the agent North (if there is no wall there) ✤ 10% of the time, North takes the agent West, 10% East ✤ If there is a wall in the direction the agent would have been taken, the agent stays put The agent receives rewards each time step ✤ Small “living” reward each step (can be negative) ✤ Big rewards come at the end (good or bad) Goal: maximize sum of rewards
+2 … U(s 0 s 1 s 2 ...) = R(s t ) t=0 ∞ ∑ Non-stationarity X U(s 0 s 1 s 2 ...) = γ t R(s t ) t=0 ∞ ∑ ≤ γ t R max t=0 ∞ ∑ = R max 1−γ Discount 0 ≤ γ <1
~ Pr(s' | s,a) s ∈S a ∈A R(s,a) = E[R t+1 | s,a] π(s)→ a, !* U(s 0 s 1 s 2 ...) = γ t R(s t ) t=0 ∞ ∑ ≤ γ t R max t=0 ∞ ∑ = R max 1−γ a s s, a s,a,s’ s’
transition s,a,s’ s is a state (s, a) is a q-state ✤ The value (utility) of a state s: V*(s) = expected utility starting in s and acting optimally ✤ The value (utility) of a q-state (s,a): Q*(s,a) = expected utility starting out having taken action a from state s and (thereafter) acting optimally ✤ The optimal policy: !*(s) = optimal action from state s V(s) = E[U t | S t = s] Q(s,a) = E[U t | S t = s,A t = a]
E[U t | S t = s,A t = a] = R s a +γ P ss' a s'∈S ∑ max a' Q*(s',a') Value Iteration V k+1 (s) ← T(s,a,s')[R(s,a,s')+γV k (s')] s' ∑ (Convergent) Q k+1 (s,a) ← T(s,a,s') s' ∑ [R(s,a,s')+γ max a' Q k (s',a')]
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. we don’t know which states are good or what the actions do ✤ Must actually try actions and states out to learn
environment works from its observations Step 2: plan a solution using that model ˆ T(s,a,s') ˆ R(s,a,s') Learn and through (s, a, s’) pairs. For example, use value iteration solve the learned MDP as before.
Q k (s',a')] Q-Learning In MDP: In RL (Model-Free): ✤ Receive a sample (s,a,s’,r) ✤ Consider your old estimate: Q(s,a) ✤ Consider your new sample estimate (sample suggest Q-value): ✤ Incorporate the new estimate into a running average: Q(s,a) ← (1−α)Q(s,a)+α ⋅sample sample = Q suggest (s,a) = R(s,a,s')+γ max a' Q(s',a') From CS188x
-a q -k 100 -n 0 How to Explore? Random Actions (ε-greedy) ✤ Every time step, flip a coin ✤ With (small) probability ε, act randomly ✤ With (large) probability 1-ε, act on current policy ✤ Lower ε over time
of features (properties) ✤ Features are functions from states to real numbers (often 0/1) that capture important properties of the state ✤ Example features: ✤ Distance to closest ghost ✤ Distance to closest dot ✤ Number of ghosts ✤ 1 / (dist to dot)2 ✤ Is Pacman in a tunnel? (0/1) ✤ …… etc. ✤ Is it the exact state on this slide? ✤ Can also describe a q-state (s, a) with features (e.g. action moves closer to food)