Welcome to the final lesson of our first module on the foundations of Markov Decision Processes. In our previous lesson, we introduced the concept of the return, the cumulative reward an agent receives over a trajectory. We distinguished between finite-horizon and discounted infinite-horizon returns and saw that the discount factor, , is a crucial component for making the sum of rewards in a continuing task finite.
This lesson focuses squarely on the meaning and implication of that discount factor. You will learn how the choice of fundamentally shapes an agent's behavior by dictating how far into the future it "looks" when making decisions. By the end, you will be able to explain precisely how controls an agent's effective planning horizon.
The Myopic-to-Farsighted Spectrum
The discount factor , a value between 0 and 1, directly controls the trade-off between immediate and future rewards. Let's start by considering the two extremes:
- Myopic Agent (): If , the formula for the discounted return collapses to . The agent only cares about the very next reward. This creates a purely "greedy" or shortsighted agent that will always choose the action leading to the best immediate outcome, even if it leads to disastrous results later on.
- Farsighted Agent (): As approaches 1, the agent becomes increasingly farsighted. The weights applied to future rewards decrease very slowly, meaning rewards far in the future are valued almost as much as immediate ones. The agent is willing to endure short-term pain for long-term gain.
David Silver's lecture provides a concrete example of how the values of states change based on the discount factor. The "Student MRP" example shows a dramatic shift in the desirability of different states when moving from a myopic to a farsighted perspective.
RL Course by David Silver - Lecture 2: Markov Decision Process
Please watch the segment from David Silver's lecture on the impact of changing the discount factor.
Start by watching the analysis for a "maximally shortsighted" agent with gamma = 0. Then, see how the values change for a more "long-sighted" agent with gamma = 0.9. Notice how states that are steps away from a large reward (like passing the class) become much more valuable with a higher \gamma.
A Probabilistic Interpretation of Discounting
While discounting is mathematically necessary for convergence, it also has a powerful and intuitive interpretation: it can be seen as a model of survival.
Imagine that at every time step, there is a probability that the process continues and a probability that it terminates (or "dies"). A reward received steps in the future can only be collected if the process has "survived" for those steps. The probability of surviving consecutive steps is .
Therefore, the discounted return can be interpreted as the expected total reward, where the expectation accounts for the possibility of termination at each step. This provides a compelling justification for why future rewards are worth less: there is an inherent uncertainty about whether we will ever reach the point to collect them.
The following reading briefly introduces this "morbid" but powerful way of thinking about the discount factor.
This excerpt from the book Modern Adaptive Control and Reinforcement Learning discusses the role of the discount factor and introduces the concept of an "effective horizon".
In the section "Rewards and Discount Factors," please read the paragraph that begins More morbidly. This text explicitly frames \gamma as a survival probability and connects it to the idea of an effective horizon.
The Effective Horizon:
This probabilistic interpretation leads us to a quantitative relationship between the discount factor and the agent's planning horizon. If the probability of termination at any given step is , then the process follows a geometric distribution for its lifetime. The expected number of steps before termination is .
This gives us the concept of the effective horizon, . It is the characteristic timescale over which an agent using discount factor is planning. We can approximate this horizon as:
This formula provides a rule of thumb for setting . If you believe the significant events in your problem happen within about 50 steps, you might choose a such that , which gives .
The following lecture notes formalize this idea and examine its mathematical underpinnings.
Lecture 14 (Introduction to Reinforcement Learning)
These notes from a UC Berkeley course provide a concise mathematical explanation of the effective horizon.
Please read the subsection titled Effective horizon. Pay close attention to the formula relating H and \gamma.
How "Effective" is the Effective Horizon?
Let's investigate the claim that is a meaningful horizon. How much is a reward received exactly at time step worth today? Its present value is . The weight on this reward is .
Given your background, you'll recognize the form of the famous limit for . For values of close to 1, let . Then and . The weight becomes . As , , and we have:
This is a remarkable result. It means that for any sufficiently high , a reward received at the effective horizon is discounted to roughly 37% of its original value. Rewards beyond this point are diminished much more significantly.
Let's check this for a few values:
- . Weight .
- . Weight .
- . Weight .
This confirms that is a very natural definition for the planning horizon. It's the point where rewards retain a substantial, yet significantly diminished, portion of their value.
Total Value and the Horizon
There's one more elegant connection. In the last lesson, you saw that if an agent receives a constant maximum reward forever, the total discounted return is .
If we substitute our definition of the effective horizon, , we get:
This provides a final, compelling intuition. The total value an agent can ever hope to accumulate in a discounted infinite-horizon problem is equivalent to the value it would get by receiving the maximum possible reward for a finite period equal to the effective horizon, with no discounting at all.
This idea is wonderfully illustrated in a lecture from MIT, which demonstrates the calculation for an infinite stream of rewards.
MIT: Machine Learning 6.036, Lecture 9: State machines and Markov decision processes (Fall 2020)
This video segment derives the total value of an infinite reward stream and provides a concrete example.
Watch the portion from this conception. The lecturer shows that receiving one unit of reward forever with a discount factor \gamma is equivalent to receiving 1/(1-\gamma) units of reward today. The example with \gamma=0.99 leading to a present value of 100 makes this very tangible.
Conclusion
This lesson concludes our foundational tour of Markov Decision Processes. We've moved beyond a simple definition of as a mathematical trick and established its role as the master controller of an agent's planning strategy.
Here are the key takeaways:
- The discount factor places an agent on a spectrum from purely myopic () to infinitely farsighted ().
- can be intuitively understood as a continuation probability, where is the probability of the process terminating at each step.
- This interpretation leads to the definition of an effective planning horizon , which is the expected lifetime of the process.
- At this effective horizon, rewards are discounted to approximately of their nominal value, providing a quantitative anchor for what "horizon" means.
- The maximum achievable discounted return is equivalent to receiving the maximum reward for a duration of undiscounted steps.
We have now formally defined all the components of a finite MDP. In the next module, we will put this theory into action. You will learn how to translate a real-world sequential decision problem into the MDP formalism and, crucially, how to represent the states, actions, transitions, and rewards in Python using NumPy arrays. This will be our first step towards building agents that can actually solve these problems.