Compare immediate reward with total return

Keep each reward, discount and value next to its number. · 160 words

The immediate reward is the score received after the current action. The total return combines that score with future rewards. A choice can look poor now but lead to a larger return. Consider an online bookstore that can recommend a city map or a best-seller. Recommending the map earns +1 when the shopper clicks, and a later related purchase earns +5. Recommending the best-seller earns +4 immediately but no later reward.

In this deterministic example, let gamma = 0.9. The map choice has immediate reward 1 and total return 1 + 0.9(5) + 0.9^2(0) = 5.5. The best-seller choice has immediate reward 4 and total return 4 + 0.9(0) + 0.9^2(0) = 4. A greedy policy chooses the largest immediate reward, so it selects the best-seller. A return-based policy compares 5.5 with 4 and selects the map because it values the delayed purchase. This is why reinforcement learning must sometimes accept a smaller current reward to gain more value later.

Check your recall

Why does the bookstore agent choose the city map even though its immediate reward is smaller?

Check your answer

The map gives an immediate reward of 1 but a total return of 5.5. The best-seller gives an immediate reward of 4 but a total return of only 4. Since 5.5 is larger, the return-based agent chooses the map.

Sources and credits

Original KeyTouch lesson. Background reading · UC Berkeley · Introduction to Artificial Intelligence.