April 2019
Intermediate to advanced
212 pages
5h 34m
English
Once we've defined the network, let's start training it as follows:
init = tf.global_variables_initializer()total_epochs = 0total_rewards = 0gamma = .7epsilon = 0.2epsilon_decay = 0.99episodes = 2000
We choose the starting values for the hyperparameters and the number of episodes that we want to train for. The longer we train this model, the better its performance should be.
We're also using total_epochs and total_rewards to keep track of the timesteps that the network takes for each task cycle and the rewards it collects each time.
We start a session and initialize the task loop, as follows:
with tf.Session() as sess: sess.run(init) for episode in range(episodes): state = env.reset() rewards_this_episode = 0 done = ...
Read now
Unlock full access