Skip to content

Instantly share code, notes, and snippets.

@SolClover
Created October 16, 2022 06:50
Show Gist options
  • Save SolClover/2daafd4bcb2add55c3ed281622657b7b to your computer and use it in GitHub Desktop.
Save SolClover/2daafd4bcb2add55c3ed281622657b7b to your computer and use it in GitHub Desktop.
Call evaluation function and plot the results
# Evaluate
n_eval_episodes=10000
mean_reward, std_reward, episode_rewards = evaluate_agent(n_max_steps, n_eval_episodes, Qtable)
# Print evaluation results
print(f"Mean Reward = {mean_reward:.2f} +/- {std_reward:.2f}")
print(f"Min = {min(episode_rewards):.1f} and Max {max(episode_rewards):.1f}")
# Show the distribution of rewards obtained from evaluation
plt.figure(figsize=(9,6), dpi=200)
plt.title(label='Rewards distribution from evaluation', loc='center')
plt.hist(episode_rewards, bins=25, color='#00000f')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment