liveBook · Manning

Discount factor

As explained in Evolutionary Deep Learning: Genetic algorithms and neural networks

A discount factor, commonly denoted gamma, is a numerical multiplier that reduces the contribution of temporally distant rewards.

A discount factor, commonly written as gamma, multiplies rewards so temporally distant rewards contribute less to learning or evaluation. In Q-learning, gamma controls how strongly future rewards influence the value of an action alongside the immediate reward. section 11.1.1

The same idea serves two related purposes:

  • Q-learning uses gamma in its update rule: the value estimate combines the observed reward with gamma times the best value of the next state. section 11.1.1
  • A NEAT lunar-lander experiment uses a genome-specific discount to calculate normalized discounted rewards for fitness evaluation rather than directly selecting actions. section 11.4

Frozen Lake

A Q-learning agent sets gamma to 0.95, trains for 20,000 episodes, and applies the factor while updating a state-action Q-table. The resulting values support later greedy action selection. section 11.1.1

Listing 11.4 EDL_11_1_FrozenLake.ipynb: Defining hyperparameters
total_episodes = 20000    #1
learning_rate = 0.7       #2
max_steps = 99            #3
gamma = 0.95              #4
 
epsilon = 1.0             #5
max_epsilon = 1.0         #5
min_epsilon = 0.01        #5
decay_rate = 0.005        #5

Inspect the hyperparameter listing to see gamma alongside the learning rate, episode count, step limit, and exploration settings. section 11.1.1

How Evolutionary Deep Learning: Genetic algorithms and neural networks covers it

How deep it goes
Defines the mechanism and shows executable update and fitness formulas, while deferring theoretical derivation and broader limitations.
Examples
Uses a Frozen Lake Q-table with gamma 0.95 and a Lunar Lander genome whose discount is initialized, crossed over, mutated, and bounded.
What you can do after
Apply it by configuring Q-learning updates or by computing discounted rewards for comparing evolutionary-agent fitness.
How it connects
Connects reinforcement learning, Q-learning, exploration and exploitation, NEAT, genome mutation, and fitness evaluation.

Also explained in

Compare how 4 books explain discount factor →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Evolutionary Deep Learning: Genetic algorithms and neural networks. The section links point to the parts of the book it draws on.