Lecture 1
made by Pavel Temirchev
Assume we have:
We want an agent to act optimally in the environment.
Forgotten something?
The measure of optimality - REWARD
Agent
Environment
Environment state:
Agent's actions:
Rewards:
Pancake flipped +1
Pancake baked +10
Pancake failed -10
Environment state:
Agent's actions:
Rewards:
\( r_t = q_o - \alpha q_w - \beta q_g \)
Environment state:
Agent's actions:
Rewards:
Destination point achieved +1
Rules break -1
Accident -10
Environment state:
Agent's actions:
Rewards:
Win +1
Lose -1
The set of the environment states
The set of agent's actions
The reward (is a scalar)
- transition probabilities
- agent's policy (behavior, strategy)
- reward function
If the domain of function \(f\) is finite, then it can be written as a table:
Aim is to maximize expected cumulative reward:
Trajectory:
New states are dependent only on the previous state and action made
(not on the history!)
It is enough to make decisions solely using the current state (not the history!)
What if the process is infinite?
Then
can be unbounded
Let's make it bounded again!
Introduce - discount factor
Then, given bounded reward:
Cake today is better
then cake tomorrow
Encourages the agent to
get rewards faster!
Cake eating problem:
At which time-step you should eat the cake?
Episode terminates after eating
Advertisement problem:
Need a dataset:
No way to take time dependencies into account!
And no dataset too!
Theorem (kinda):
If the Q-function of a policy \(\pi^*\) for any state-action pair \( (s_t, a_t) \) is equal to:
then the policy \(\pi^*\) - is the optimal policy
and \(Q^{\pi^*} = Q^*\) - is the optimal state-value function
If the optimal Q-function for any state-action pair \( (s_t, a_t) \) is known (it is just a table)
Then recovering optimal policy is easy:
for Optimality Bellman Equation
The loop:
while not convergent: for : for :
Will converge to the optimal Q-function
What's wrong with this algorithm? Can you use it in practice?
It requires us to know the transition probabilities \( p(s'|s, a) \)
Dynamic Programming with Monte-Carlo sampling
REMINDER: Monte-Carlo estimate of an expectation
Will (with some dirty hacks) converge to the optimal Q-function
What's wrong with this algorithm? Can you use it in practice?
while not convergent: for t=0 to T:
will be discussed at the next slide
use exponential averaging as MC estimate
Exploration vs. Exploitation
Let's learn how to move forward:
Q-function estimate:
Solution (\(\epsilon\)-greedy strategy): add noise to \( \pi \) :
make random action with probability \( \epsilon \)
Graphical representation of the learning loop
behave
collect
update \(Q\)-function
set optimal policy \(\pi\)
set behavioral policy \(\pi_b\)
Windy Gridworld Navigation Problem
wind
Actions:
States:
Rewards:
Discounting:
Learning rate:
\(\epsilon\)-greedy strategy:
(decrease \(\epsilon\) after each episode)
(one step behind neural networks)
Why do we need approximations? All is good, stop.
number of atoms in the Universe
For Atari Games:
Thank you for your attention!
Links (clickable):
for reading:
online course: