1a693073cd01fffa7cb3f018b7221459703119f9,ch09/01_cartpole_dqn.py,,,#,48
Before Change
optimizer.step()
// clear batch
batch_states.clear()
batch_actions.clear()
batch_targets.clear()
new_rewards = exp_source.pop_total_rewards()
After Change
selector.epsilon = max(EPSILON_STOP, EPSILON_START - step_idx / EPSILON_STEPS)
replay_buffer.populate(1)
if len(replay_buffer) < BATCH_SIZE:
continue
// sample batch
batch = replay_buffer.sample(BATCH_SIZE)
batch_states = [exp.state for exp in batch]
batch_actions = [exp.action for exp in batch]
batch_targets = [calc_target(net, exp.reward, exp.last_state)
for exp in batch]
// train
optimizer.zero_grad()
states_v = Variable(torch.from_numpy(np.array(batch_states, dtype=np.float32)))
net_q_v = net(states_v)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: 1a693073cd01fffa7cb3f018b7221459703119f9
Time: 2017-11-30
Author: max.lapan@gmail.com
File Name: ch09/01_cartpole_dqn.py
Class Name:
Method Name:
Project Name: biolab/orange3
Commit Name: faaa9683764e14d67a483b6948a96577a045f4f2
Time: 2016-09-23
Author: janez.demsar@fri.uni-lj.si
File Name: Orange/widgets/visualize/owboxplot.py
Class Name: OWBoxPlot
Method Name: set_data
Project Name: OpenNMT/OpenNMT-tf
Commit Name: d7db4b1b9a6c9577ca3a09c4241cdd9db58b31bc
Time: 2020-01-16
Author: guillaumekln@users.noreply.github.com
File Name: opennmt/training.py
Class Name: Trainer
Method Name: __call__