June 2018
Intermediate to advanced
318 pages
9h 24m
English
So far, we have seen how to build a dueling DQN. Now, we will see how to make use of our dueling DQN when playing the car racing game.
First, let's import our necessary libraries:
import gymimport timeimport loggingimport osimport sysimport tensorflow as tf
Initialize all of the necessary variables:
ENV_NAME = 'Seaquest-v0'TOTAL_FRAMES = 20000000 MAX_TRAINING_STEPS = 20*60*60/3TESTING_GAMES = 30MAX_TESTING_STEPS = 5*60*60/3TRAIN_AFTER_FRAMES = 50000epoch_size = 50000 MAX_NOOP_START = 30LOG_DIR = 'logs'outdir = 'results'logger = tf.train.SummaryWriter(LOG_DIR)# Intialize tensorflow sessionsession = tf.InteractiveSession()
Build the agent:
agent = DQN(state_size=env.observation_space.shape, action_size=env.action_space.n, session=session, ...
Read now
Unlock full access