The computational graph and training loop

The core of the algorithm, namely the computational graph and the training (and evaluation) loop, is implemented in the DQN function, which takes the name of the environment and all the other hyperparameters as arguments:

def DQN(env_name, hidden_sizes=[32], lr=1e-2, num_epochs=2000, buffer_size=100000, discount=0.99, update_target_net=1000, batch_size=64, update_freq=4, frames_num=2, min_buffer_size=5000, test_frequency=20, start_explor=1, end_explor=0.1, explor_steps=100000):    env = make_env(env_name, frames_num=frames_num, skip_frames=True, noop_num=20)    env_test = make_env(env_name, frames_num=frames_num, skip_frames=True, noop_num=20)    env_test = gym.wrappers.Monitor(env_test, "VIDEOS/TEST_VIDEOS ...

Get Reinforcement Learning Algorithms 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.