# Difference between revisions of "Temporal Difference Learning"

Jump to: navigation, search

Home * Learning * Temporal Difference Learning

Temporal Difference Learning, (TD learning)
is a machine learning method applied to multi-step prediction problems. As a prediction method primarily used for reinforcement learning, TD learning takes into account the fact that subsequent predictions are often correlated in some sense, while in supervised learning, one learns only from actually observed values. TD resembles Monte Carlo methods with dynamic programming techniques [1]. In the domain of computer games and computer chess, TD learning is applied through self play, subsequently predicting the probability of winning a game during the sequence of moves from the initial position until the end, to adjust weights for a more reliable prediction.

# Prediction

Each prediction is a single number, derived from a formula using adjustable weights of features, for instance a neural network most simply a single neuron perceptron, that is a linear evaluation function ...

Sigmoid and Derivative

... with the pawn advantage converted to a winning probability by the standard sigmoid squashing function, also topic in logistic regression in the domain of supervised learning and automated tuning, ...

... which has the advantage of its simple derivative:

# TD(λ)

Each pair of temporally successive predictions P at time step t and t+1 gives rise to a recommendation for weight changes, to converge Pt to Pt+1, first applied in the late 50s by Arthur Samuel in his Checkers player for automamated evaluation tuning [2]. This TD method was improved, generalized and formalized by Richard Sutton et al. in the 80s, the term Temporal Difference Learning coined in 1988 [3], also introducing the decay or recency parameter λ, where proportions of the score came from the outcome of Monte Carlo simulated games, tapering between bootstrapping (λ = 0) and Monte Carlo predictions (λ = 1), the latter equivalent to gradient descent on the mean squared error function. Weight adjustments in TD(λ) are made according to ...

... where P is the series of temporally successive predictions, w the set of adjustable weights. α is a parameter controlling the learning rate, also called step-size, ∇wPk [4] is the gradient, the vector of partial derivatives of Pt with respect of w. The process may be applied to any initial set of weights. Learning performance depends on λ and α, which have to be chosen appropriately for the domain. In principle, TD(λ) weight adjustments may be made after each move, or at any arbitrary interval. For game playing tasks the end of every game is a convenient point to actually alter the evaluation weights [5].

TD(λ) was famously applied by Gerald Tesauro in his Backgammon program TD-Gammon [6] [7], a stochastic game picking the action whose successor state minimizes the opponent's expected reward, i.e. looking one ply ahead.

# TDLeaf(λ)

In games like chess or Othello, due to their tactical nature, deep searches are necessary for expert performance. The problem has already been recognized and solved by Arthur Samuel but seemed to have been forgotten later on [8] - rediscovered independently by Don Beal and Martin C. Smith in 1997 [9], and by Jonathan Baxter, Andrew Tridgell, and Lex Weaver [10], who coined the term TD-Leaf. TD-Leaf is the adaption of TD(λ) to minimax search, where instead of the corresponding positions of the root the leaf nodes of the principal variation are considered in the weight adjustments. TD-Leaf was successfully used in evaluation tuning of chess programs [11], with KnightCap [12] and CilkChess as most prominent samples, while the latter used the improved Temporal Coherence Learning [13], which automatically adjusts α and λ [14].

# Quotes

## Don Beal

Don Beal in a 1998 CCC discussion with Jonathan Baxter [15]:

```With fixed learning rates (aka step size) we found piece values settle to consistent relative ordering in around 500 self-play games. The ordering remains in place despite considerable erratic movements. But piece-square values can take a lot longer - more like 5000.
```
```The learning rate is critical - it has to be as large as one dares for fast learning, but low for stable values.  We've been experimenting with methods for automatically adjusting the learning rate. (Higher rates if the adjustments go in the same direction, lower if they keep changing direction.)
```
```The other problem is learning weights for terms which only occur rarely. Then the learning process doesn't see enough examples to settle on good weights in a reasonable time. I suspect this is the main limitation of the method, but it may be possible to devise ways to generate extra games which exercise the rare conditions.
```

## Bas Hamstra

Bas Hamstra in a 2002 CCC discussion on TD learning [16]:

```I have played with it. I am convinced it has possibilities, but one problem I encountered was the cause-effect problem. For say I am a piece down. After I lost the game TD will conclude that the winner had better mobility and will tune it up. However worse mobility was not the cause of the loss, it was the effect of simply being a piece down. In my case it kept tuning mobility up and up until ridiculous values.
```

## Don Dailey

Don Dailey in a reply [17] to Ben-Hur Carlos Vieira Langoni Junior, CCC, December 2010 [18] :

```Another approach that may be more in line with what you want is called "temporal difference learning", and it is based on feedback from each move to the move that precedes it. For example if you play move 35 and the program thinks the position is equal, but then on move 36 you find that you are winning a pawn, it indicates that the evaluation of move 35 is in error, the position is better than the program thought it was. Little tiny incremental adjustments are made to the evaluation function so that it is ever so slightly biased in favor of being slightly more positive in this case, or slightly more negative in the case where you find your score is dropping. This is done recursively back through the moves of the game so that winning the game gives some credit to all the positions of the game. Look on the web and read up on the "credit assignment problem" and temporal difference learning. It's probably ideal for what you are looking for. It can be done at the end of the game one time and scores then updated. If you are not using floating point evaluation you may have to figure out how to modify this to be workable.
```

RootStrap
TreeStrap

1996

1997

1998

1999

2001

2002

2003

2004

2006

2007

2008

2009

2011

2012

2013

2014

2016

2017

# Forum Posts

## 1995 ...

Re: Parameter Tuning by Don Beal, CCC, October 02, 1998

## 2000 ...

Re: Temporal Differences by Guy Haworth, CCC, November 04, 2004 [21]

## 2010 ...

Re: Positional learning by Don Dailey, CCC, December 13, 2010
Re: Pawn Advantage, Win Percentage, and Elo by Don Dailey, CCC, April 15, 2012