evorl.evaluators¶
Package Contents¶
Classes¶
Mutli-objective evaluator for Brax environments. |
|
Evaluate and return eval metrics and episodic trajectory. |
|
Streamlined episode collector for observation only. |
|
Evaluate the agent in the environments. |
API¶
- class evorl.evaluators.BraxEvaluator[source]¶
Bases:
evorl.evaluators.evaluator.EvaluatorMutli-objective evaluator for Brax environments.
- Variables:
metric_names – The names of the metrics to evaluate, default is (“reward”, “episode_lengths”)
- metric_names: tuple[str]¶
‘pytree_field(…)’
- class evorl.evaluators.EpisodeCollector[source]¶
Bases:
evorl.types.PyTreeNodeEvaluate and return eval metrics and episodic trajectory.
EpisodeCollector is similar as
Evaluator, but it also returns the trajectories. When evaluating the agent, callrollout().- Variables:
env – Vectorized environment w/o autoreset.
action_fn – The agent action function.
max_episode_steps – The maximum number of steps in an episode.
env_extra_fields – The extra fields to collect from the environment.
discount – The discount factor.
- action_fn: evorl.agent.AgentActionFn¶
None
- discount: float¶
1.0
- env: evorl.envs.Env¶
None
- env_extra_fields: collections.abc.Sequence[str]¶
()
- max_episode_steps: int¶
‘pytree_field(…)’
- rollout(agent_state, key: chex.PRNGKey, num_episodes: int) tuple[evorl.metrics.EvaluateMetric, evorl.sample_batch.SampleBatch][source]¶
- rollout_fn: evorl.rollout.RolloutFn¶
‘pytree_field(…)’
- class evorl.evaluators.EpisodeObsCollector[source]¶
Bases:
evorl.evaluators.episode_collector.EpisodeCollectorStreamlined episode collector for observation only.
- rollout_fn: evorl.evaluators.episode_collector.RolloutFn¶
‘pytree_field(…)’
- class evorl.evaluators.Evaluator[source]¶
Bases:
evorl.types.PyTreeNodeEvaluate the agent in the environments.
- Variables:
env – Vectorized environment w/o autoreset.
action_fn – The agent action function.
max_episode_steps – The maximum number of steps in an episode.
discount – The discount factor.
- action_fn: evorl.agent.AgentActionFn¶
‘pytree_field(…)’
- discount: float¶
‘pytree_field(…)’
- env: evorl.envs.Env¶
‘pytree_field(…)’
- evaluate(agent_state: evorl.agent.AgentState, key: chex.PRNGKey, num_episodes: int) evorl.metrics.EvaluateMetric[source]¶
Evaluate the agent based on its state.
- Parameters:
agent_state – The state of the agent.
key – The PRNG key.
num_episodes – The number of episodes to evaluate.
- Returns:
EvaluateMetric(episode_returns, episode_lengths).
- max_episode_steps: int¶
‘pytree_field(…)’