yawning_titan.envs.generic.helpers.eval_printout.EvalPrintout#

class yawning_titan.envs.generic.helpers.eval_printout.EvalPrintout(avg_every)[source]#

Bases: object

Class to represnt an Eval Printer.

Initialise printout object.

Parameters:

avg_every – Number of timesteps to average stats over

Methods

calculate_metrics

Calculate the metrics to be printed.

print_stats

Print out the (averaged) stats from the last avg_every number of games to the console.

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