Lably
Skip to content

Temporal difference learning

Computer programming concept

  • 3 min read
  • 3 chapters

Related on Lably

Through Reinforcement learning, Algorithm and Neuron

While Monte Carlo methods only adjust their estimates once the outcome is known, TD methods adjust predictions to match later, more-accurate predictions about the future, before the outcome is known. This is a form of bootstrapping, as illustrated with the following example:

Suppose you wish to predict the weather for Saturday, and you have some model that predicts Saturday's weather, given the weather of each day in the week. In the standard case, you would wait until Saturday and then adjust all your models. However, when it is, for example, Friday, you should have a pretty good idea of what the weather would be on Saturday – and thus be able to change, say, Saturday's model before Saturday arrives.

Temporal difference methods are related to the temporal difference model of animal learning.

Mathematical formulation

The tabular TD(0) method is one of the simplest TD methods. It is a special case of more general stochastic approximation methods. It estimates the state value function of a finite-state Markov decision process (MDP) under a policy π. Let Vπ denote the state value function of the MDP with states (St)t∈N, rewards (Rt)t∈N and discount rate γ under the policy π:

Vπ(s)=Ea∼π{∑t=0∞γtRt+1|S0=s}.

We drop the action from the notation for convenience. Vπ satisfies the Bellman Equation:

Vπ(s)=Eπ{R1+γVπ(S1)|S0=s},

so R1+γVπ(S1) is an unbiased estimate for Vπ(s). This observation motivates the following algorithm for estimating Vπ.

The algorithm starts by initializing a table V(s) arbitrarily, with one value for each state of the MDP. A positive learning rate α is chosen.

We then repeatedly evaluate the policy π, obtain a reward r and update the value function for the current state using the rule:

V(St)←(1−α)V(St)+α⏟learning rate[Rt+1+γV(St+1)⏞The TD target]

where St and St+1 are the current and next states, respectively. The value Rt+1+γV(St+1) is known as the TD target, and Rt+1+γV(St+1)−V(St) is known as the TD error.

Sign in to keep reading

2 more chapters are free with a Lably account.

More in Computing and communication