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

Function play_one_episode

tf2.0/rl_trader.py:325–340  ·  view source on GitHub ↗
(agent, env, is_train)

Source from the content-addressed store, hash-verified

323
324
325def play_one_episode(agent, env, is_train):
326 # note: after transforming states are already 1xD
327 state = env.reset()
328 state = scaler.transform([state])
329 done = False
330
331 while not done:
332 action = agent.act(state)
333 next_state, reward, done, info = env.step(action)
334 next_state = scaler.transform([next_state])
335 if is_train == 'train':
336 agent.update_replay_memory(state, action, reward, next_state, done)
337 agent.replay(batch_size)
338 state = next_state
339
340 return info['cur_val']
341
342
343

Callers 1

rl_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