Pages and contents
Pages
Reinforcement Learning
Markov Decision Process
Rewards
If you have a sequence of rewards received after time step , , then the typical reinforcement learning maxim problem is to maximize total reward
This is applicable to episodic tasks such as a game, where the final state is different from other states . In situations without a terminal state, we seek to maximize discounted return
Markov Property
A state signal that succeeds in retaining all relevant information is said to be Markov, or to have the Markov property (we define this formally below). For example, a checkers position—the current configuration of all the pieces on the board—would serve as a Markov state because it summarizes everything important about the complete sequence of positions that led to it.
Consider the general causal case in which an event may depend on everything that happened previously In this case the dynamics can be defined only by specifying the complete probability distribution.
If the state signal has the Markov property, on the other hand, then the environment’s response at depends only on the state and action representations at t, in which case the environment’s dynamics can be defined by specifying only
In this case a state signal has the Markov property, and is a Markov state.
MDP
A reinforcement learning task that satisfies the Markov property is called a Markov decision process, or MDP. If the state and action spaces are finite, then it is called a finite Markov decision process (finite MDP).
Given any state and action and , the probability of each possible pair of next state and reward, is denoted
Value Functions
Value functions allow us to estimate “how good” it is for an agent to be in a given state, which is defined in terms of future expected rewards.
A policy is a map from each state and action to the probability of taking action when in state : .
The value of a state under policy , denoted is the expected return from starting at and following thereafter. We can write the value function for a Markov Decision Process as follows
Similarly, we denote the action-value function of taking an action at state under policy .
Temporal-Difference Learning
Temporal-difference (TD) learning estimates the value of a state using both the observed reward and the current estimate of the next state’s value. This is a method known as bootstrapping: updating estimates of the values of states based on estimates of the values of successor states, or more broadly, updating estimates based on the value of other estimates.
For a value function , the one-step TD error is
where is the observed reward, is the discount factor, andis the bootstrapped estimate of future return.
The value estimate is updated as
where is the learning rate. Unlike Monte Carlo methods, TD methods can update after every transition without waiting for an episode to finish.
Common extensions include TD() which combines information from multiple future time horizons, and action-value methods such as SARSA and Q-learning.
Eligibility Trace
An eligibility trace is a temporary record of the occurrence of an event, such as the visiting of a state or the taking of an action. The trace marks the memory parameters associated with the event as eligible for undergoing learning changes. When a TD error occurs, only the eligible states or actions are assigned credit or blame for the error.
Actor-Critic Methods
Actor–critic methods are TD methods that have a separate memory structure to explicitly represent the policy independent of the value function. The policy structure is known as the actor, because it is used to select actions, and the estimated value function is known as the critic, because it criticizes the actions made by the actor.
The one-step actor-critic method updates the actor by
Where is the preference for actionat timein state. We can include eligibility traces as follows
Advantage Functions
Sometimes in RL, we don’t need to describe how good an action is in an absolute sense, but only how much better it is than others on average. That is to say, we want to know the relative advantage of that action. We make this concept precise with the advantage function.
The advantage function corresponding to a policy describes how much better it is to take a specific action in state over randomly selecting an action according to assuming you act according to forever after. Mathematically, the advantage function is defined by
Generalized Advantage Estimation
GAE introduces a parameter that allows us to reduce variance by downweighting rewards corresponding to delayed effects, at the cost of introducing bias. This parameter corresponds to the discount factor used in discounted formulations of MDPs, but we treat it as a variance reduction parameter in an undiscounted problem.
The true advantage is unknown, so GAE estimates it using TD errors. First compute
This is the difference between what actually happened and what the critic expected. GAE combines TD errors over future time steps
controls how far into the future the estimate looks, with
• : mostly one-step TD; lower variance, more bias.
• : longer-horizon estimate; less bias, more variance.
Thus GAE can be thought of as a smoothed estimate of how good an action was. A critic can use the GAE estimate to construct a return target and minimize .
PPO
A normal policy-gradient objective is approximately
where
measures how much the new policy changed the probability of the chosen action. If we want the action to become more likely, and if we want it to become less likely. The problem is that unrestricted policy-gradient updates can change the policy too much. PPO limits this with clipping.
The clipping prevents the new policy from moving too far from the policy that generated the training data. Therefore PPO can be thought of as a policy gradient with constrained policy updates.
PPO + GAE
The overall process is
(s_t,a_t,r_t,s_{t+1}) \\ \downarrow \\ r_t+\gamma V(s_{t+1})-V(s_t) \\ \downarrow \\ \text{GAE} \rightarrow \hat{A}_t \\ \downarrow \\ \text{PPO} \rightarrow \text{update} \ \pi_\theta
In short:
• Critic: predicts expected future reward.
• GAE: estimates whether an action was better or worse than expected.
• PPO: updates the actor using that advantage while preventing excessively large policy changes.