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

Function play_one_episode

tf2.0/keras_trader.py:332–347  ·  view source on GitHub ↗
(agent, env, is_train)

Source from the content-addressed store, hash-verified

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

Callers 1

keras_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