liveBook · Manning

Temporal-difference error

As explained in Build a Robo-Advisor with Python (From Scratch)

A temporal difference is the discrepancy between a current value estimate and a reward-adjusted estimate based on a subsequent state.

A temporal-difference error measures the signed gap between a current value estimate and the discounted value estimated for the next period. A positive gap raises the current estimate; a negative gap lowers it. The learning rate controls how quickly Q responds. section 6.2.2

Updating Q in financial planning

For a wealth–time state and selected action, Q-learning samples the next wealth state, finds the maximum next-state action value, and updates the chosen Q value by alpha times the temporal-difference error. Repeated episodes refine estimates without transition probabilities.

How Build a Robo-Advisor with Python (From Scratch) covers it

How deep it goes
Defines the signed discrepancy and implements its Q update, while deferring detailed transition-probability calculations.
Examples
Uses a wealth–time grid, random wealth transitions, Q-table updates, and repeated generated episodes.
What it assumes
Assumes Q-learning states and actions, while defining the discount rate, temporal difference, and learning rate alongside the update.
What you can do after
Apply it via Python to update Q values while learning financial-planning policies from sampled transitions.
How it connects
Connects Q-learning with discount rate, learning rate, exploration and exploitation, and model-free reinforcement learning.

Also explained in

Compare how 2 books explain temporal-difference error →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Robo-Advisor with Python (From Scratch). The section links point to the parts of the book it draws on.