tac.gui.dashboards package¶
Submodules¶
tac.gui.dashboards.agent module¶
Module containing the agent dashboard and related classes.
-
class
tac.gui.dashboards.agent.
AgentDashboard
(agent_name: str, visdom_addr: str = 'localhost', visdom_port: int = 8097, env_name: Optional[str] = None)¶ Bases:
tac.gui.dashboards.base.Dashboard
Class to manage a Visdom dashboard for the participant agent.
It assumes that a Visdom server is running at the address and port provided in input (default: http://localhost:8097)
-
add_transaction
(new_tx: tac.platform.game.base.Transaction, agent_name: Optional[str] = None) → None¶ Add a transaction to the transaction table.
- Parameters
new_tx – a new transaction
agent_name – the agent name
- Returns
None
-
init
()¶ Re-initiate the AgentDashboard.
-
update_from_agent_state
(agent_state: tac.agents.participant.v1.base.states.AgentState, append: bool = True) → None¶ Update the dashboard from the agent state.
-
update_from_stats_manager
(stats_manager: tac.agents.participant.v1.base.stats_manager.StatsManager, append: bool = True) → None¶ Update the dashboard from the stats manager.
-
-
class
tac.gui.dashboards.agent.
TransactionTable
¶ Bases:
object
Class maintaining a html table of transactions.
-
add_transaction
(tx: tac.platform.game.base.Transaction, agent_name: Optional[str] = None) → None¶ Add a transaction to the table.
- Parameters
tx – the Transaction object
agent_name – the name of the agent
- Returns
None
-
to_html
() → str¶ Convert the table to html.
-
tac.gui.dashboards.base module¶
Module wrapping the visdom dashboard initialization.
-
class
tac.gui.dashboards.base.
Dashboard
(visdom_addr: str = 'localhost', visdom_port: int = 8097, env_name: Optional[str] = None)¶ Bases:
object
Visdom dashboard base class.
-
start
()¶ Start the dashboard.
-
stop
()¶ Stop the dashboard.
-
property
viz
¶ Get the visdom server.
-
-
tac.gui.dashboards.base.
start_visdom_server
() → subprocess.Popen¶ Start the visdom server.
tac.gui.dashboards.controller module¶
Module containing the controller dashboard and related classes.
-
class
tac.gui.dashboards.controller.
ControllerDashboard
(game_stats: Optional[tac.platform.game.stats.GameStats] = None, visdom_addr: str = 'localhost', visdom_port: int = 8097, env_name: Optional[str] = 'tac_controller')¶ Bases:
tac.gui.dashboards.base.Dashboard
Class to manage a Visdom dashboard for the controller agent.
It assumes that a Visdom server is running at the address and port provided in input (default: http://localhost:8097)
-
static
from_datadir
(datadir: str, env_name: str) → tac.gui.dashboards.controller.ControllerDashboard¶ Return a ControllerDashboard from a data directory.
- Parameters
datadir – the data directory
env_name – the environment name
- Returns
controller dashboard
-
update
()¶ Update the dashboard.
-
static
-
tac.gui.dashboards.controller.
parse_args
()¶ Parse the arguments.
tac.gui.dashboards.helpers module¶
A module containing helpers for dashboard.
-
tac.gui.dashboards.helpers.
escape_html
(string: str, quote=True) → str¶ Replace special characters “&”, “<” and “>” to HTML-safe sequences.
- Parameters
string – the string
quote – If the optional flag quote is true (the default), the quotation mark characters, both double quote (“) and single quote (‘) characters are also translated.
- Returns
the escaped string
-
tac.gui.dashboards.helpers.
generate_html_table_from_dict
(dictionary: Dict[str, List[str]], title='') → str¶ Generate a html table from a dictionary.
- Parameters
dictionary – the dictionary
title – the title
- Returns
a html string
tac.gui.dashboards.leaderboard module¶
Module containing the controller dashboard and related classes.
-
class
tac.gui.dashboards.leaderboard.
LeaderboardDashboard
(competition_directory: str, visdom_addr: str = 'localhost', visdom_port: int = 8097, env_name: Optional[str] = 'leaderboard', dump_stats: bool = False)¶ Bases:
tac.gui.dashboards.base.Dashboard
Class to display the aggregated statistics of multiple TAC instances.
It assumes that a Visdom server is running at the address and port provided in input (default: http://localhost:8097)
-
display
()¶ Display the leaderboard.
-
-
tac.gui.dashboards.leaderboard.
compute_aggregate_scores
(all_game_stats: List[tac.platform.game.stats.GameStats]) → Dict[str, float]¶ Compute the sum of all scores for every agents.
- Parameters
all_game_stats – the GameStats object for every instance of TAC.
- Returns
a dictionary “agent_name” -> “final score”
-
tac.gui.dashboards.leaderboard.
compute_statistics
(all_game_stats: List[tac.platform.game.stats.GameStats]) → None¶ Compute statistics and dump them.
-
tac.gui.dashboards.leaderboard.
parse_args
()¶ Parse the arguments.
Module contents¶
Module that contains dashboards.