Actions and rewards

An action is any decision that we make from a state. The state that we are in determines the actions we can take. If we are in a maze and to the right of a wall, we can't turn left, but in other locations, we can turn left. Turning left may or may not be in the list of possible actions that we can take in any particular state.

A reward is the outcome we receive for making a decision in an environment. Our Q-learning agent will keep track of the rewards it receives and will try to maximize the future rewards that it expects to receive with each action it takes.

The reward function for a driving simulator can be something straightforward, such as the following:

  • +1 for moving one block
  • +10 for making the correct move that ...

Get Hands-On Q-Learning with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.