Using the file

Let's first code the file. The steps involved in this are as follows:

  1. Import the required packages:
import numpy as npimport sysimport osimport randomimport tensorflow as tf
  1. Choose the bigger or smaller network: We will use two neural network architectures, one called bigger and the other smaller. Let's use the bigger network for now; the interested user can later change the network to the smaller option and compare performance:
NET = 'bigger' # 'smaller'
  1. Choose the loss function (L2 loss or the Huber loss): For the Q-learning loss function, we can use either the L2 loss or the Huber loss. Both options will be used in the code. We will choose huber for now:
LOSS = 'huber' # 'L2'
  1. Define neural network ...

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.