Cliff walking with SARSA

We will now learn how to code the aforementioned equations in Python and implement the cliff walking problem with SARSA. First, let's import the numpy, sys, and matplotlib packages in Python. If you have not used these packages in the past, there are several Packt books on these topics to help you come up to speed. Type the following command to install the required packages in a Linux Terminal:

sudo apt-get install python-numpy python-scipy python-matplotlib

We will now summarize the code involved to solve the grid world problem. In a Terminal, use your favorite editor (for example, gedit, emacs, or vi) to code the following:

import numpy as np import sys import matplotlib.pyplot as plt

We will use a 3 x 12 grid for ...

Get TensorFlow Reinforcement Learning Quick Start Guide 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.