MCPcopy Create free account
hub / github.com/Farama-Foundation/ViZDoom / test

Function test

examples/python/learning_tensorflow.py:225–244  ·  view source on GitHub ↗
(test_episodes_per_epoch, game, agent)

Source from the content-addressed store, hash-verified

223
224
225def test(test_episodes_per_epoch, game, agent):
226 test_scores = []
227
228 print("\nTesting...")
229 for test_episode in trange(test_episodes_per_epoch, leave=False):
230 game.new_episode()
231 while not game.is_episode_finished():
232 state = preprocess(game.get_state().screen_buffer)
233 best_action_index = agent.choose_action(state)
234 game.make_action(actions[best_action_index], frames_per_action)
235
236 r = game.get_total_reward()
237 test_scores.append(r)
238
239 test_scores = np.array(test_scores)
240 print(
241 f"Results: mean: {test_scores.mean():.1f}±{test_scores.std():.1f},",
242 "min: %.1f" % test_scores.min(),
243 "max: %.1f" % test_scores.max(),
244 )
245
246
247class DQN(Model):

Callers 1

runFunction · 0.70

Calls 2

choose_actionMethod · 0.80
preprocessFunction · 0.70

Tested by

no test coverage detected