MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / play_one_episode

Function play_one_episode

tf2.0/mlp_trader.py:313–328  ·  view source on GitHub ↗
(agent, env, is_train)

Source from the content-addressed store, hash-verified

311
312
313def play_one_episode(agent, env, is_train):
314 # note: after transforming states are already 1xD
315 state = env.reset()
316 state = scaler.transform([state])
317 done = False
318
319 while not done:
320 action = agent.act(state)
321 next_state, reward, done, info = env.step(action)
322 next_state = scaler.transform([next_state])
323 if is_train == 'train':
324 agent.update_replay_memory(state, action, reward, next_state, done)
325 agent.replay(batch_size)
326 state = next_state
327
328 return info['cur_val']
329
330
331

Callers 1

mlp_trader.pyFile · 0.70

Calls 6

resetMethod · 0.45
transformMethod · 0.45
actMethod · 0.45
stepMethod · 0.45
update_replay_memoryMethod · 0.45
replayMethod · 0.45

Tested by

no test coverage detected