yawning_titan.envs.generic.helpers.eval_printout#
Util to print out agent evaluation metrics.
- The metrics printed out are:
Total episodes elapsed
Absolute wins for red and blue
Percentage win rate for red and blue
Average episode length
Actions taken by blue each game/Average actions taken by blue over n games
Classes
Class to represnt an Eval Printer. |
- class yawning_titan.envs.generic.helpers.eval_printout.EvalPrintout(avg_every)[source]#
Class to represnt an Eval Printer.
Initialise printout object.
- Parameters:
avg_every – Number of timesteps to average stats over
- __init__(avg_every)[source]#
Initialise printout object.
- Parameters:
avg_every – Number of timesteps to average stats over
- print_stats(game_stats_list, total_games)[source]#
Print out the (averaged) stats from the last avg_every number of games to the console.
- Parameters:
game_stats_list – List of dictionaries containing the last avg_every number of game stats
total_games – Total games played since starting
- calculate_metrics(game_stats_list)[source]#
Calculate the metrics to be printed.
- Parameters:
game_stats_list – List of dictionaries containing the last avg_every number of game stats
- Returns:
Number of games blue won in the last avg_every number of games red_wins: Number of games red won in the last avg_every number of games percentage_blue: Percentage of games blue won in the last avg_every number of games percentage_red: Percentage of games red won in the last avg_every number of games avg_duration: Average number of timesteps per episode over the last avg_every number of games sorted_actions: Dictionary of actions taken by blue, averaged over the last avg_every number of games
and ordered by frequency of each action from highest to lowest. Dictionary values are tuples: (average frequency of action, action usage percentage)
- Return type:
blue_wins