Starting the project

After this long detour into reinforcement learning and the DQN approach, we are finally ready to start coding, having all the basic understanding of how to operate an OpenAI Gym environment and how to set a DQN approximation of a Q function. We simply start importing all the necessary packages:

import gymfrom gym import wrappersimport numpy as npimport random, tempfile, osfrom collections import dequeimport tensorflow as tf

The tempfile module generates temporary files and directories that can be used as a temporary storage area for data files. The deque command, from the collections module, creates a double-ended queue, practically a list where you can append items at the start or at the end. Interestingly, it can be ...

Get TensorFlow Deep Learning Projects 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.