smarts.env.gymnasium.wrappers.metric.metrics module
- class smarts.env.gymnasium.wrappers.metric.metrics.Metrics(*args: Any, **kwargs: Any)[source]
Metrics class wraps an underlying MetricsBase class. The underlying MetricsBase class computes agents’ performance metrics in a SMARTS environment. Whereas, this Metrics class is a basic gym.Wrapper class which prevents external users from accessing or modifying (i) protected attributes or (ii) attributes beginning with an underscore, to ensure security of the metrics computed.
- Parameters:
env (gym.Env) – The gym environment to be wrapped.
- Raises:
AttributeError – Upon accessing (i) a protected attribute or (ii) an attribute beginning with an underscore.
- Returns:
A wrapped gym environment which computes agents’ performance metrics.
- Return type:
gym.Env
- class smarts.env.gymnasium.wrappers.metric.metrics.MetricsBase(*args: Any, **kwargs: Any)[source]
Computes agents’ performance metrics in a SMARTS environment.
- records() Dict[str, Dict[str, Record]] [source]
Fine grained performance metric for each agent in each scenario.
$ env.records() $ { scen1: { agent1: Record(costs, counts, metadata), agent2: Record(costs, counts, metadata), }, scen2: { agent1: Record(costs, counts, metadata), }, }
- Returns:
Performance record in a nested dictionary for each agent in each scenario.
- Return type:
Dict[str, Dict[str, Record]]