Skip to content

Commit

Permalink
Few additions to the eval_bot script:
Browse files Browse the repository at this point in the history
- Formatting
- Show number of steps in addition to reward
  • Loading branch information
saleml committed Oct 17, 2018
1 parent 8cd3e46 commit b56dccd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/eval_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

num_success = 0
total_reward = 0
total_steps = 0

for run_no in range(options.num_runs):
level = level_dict[level_name]
Expand All @@ -85,21 +86,23 @@
obs, reward, done, info = mission.step(action)

total_reward += reward
total_steps += 1

if done == True:
if done:
if reward > 0:
num_success += 1
if reward <= 0:
print('FAILURE on %s, seed %d' % (level_name, mission_seed))
print('FAILURE on %s, seed %d, reward %.2f' % (level_name, mission_seed, reward))
break
except Exception as e:
print('FAILURE on %s, seed %d' % (level_name, mission_seed))
print(e)

success_rate = 100 * num_success / options.num_runs
mean_reward = total_reward / options.num_runs
mean_steps = total_steps / options.num_runs

print('%16s: %.1f%%, r=%.2f' % (level_name, success_rate, mean_reward))
print('%16s: %.1f%%, r=%.3f, s=%.2f' % (level_name, success_rate, mean_reward, mean_steps))

end_time = time.time()
total_time = end_time - start_time
Expand Down

0 comments on commit b56dccd

Please sign in to comment.