ethicalgardeners.algorithms.evaluate

ethicalgardeners.algorithms.evaluate(env, model, algorithm_name: str = 'maskable_ppo', num_games=100, seed=42, deterministic=True, needs_action_mask=False, **kwargs)[source]

Evaluate a trained agent vs a random agent

Parameters:
  • env – A PettingZoo AEC environment instance.

  • model – A trained model instance to evaluate. The model class should contain a predict method as in Stable Baselines3.

  • algorithm_name – The algorithm name (e.g., “maskable_ppo”, “dqn”). It is used in the printed messages.

  • num_games – The number of games to play for the evaluation.

  • seed – The random seed for the environment. The seed is incremented for each game to ensure different initial conditions.

  • deterministic – Whether to use deterministic actions when predicting with the model.

  • needs_action_mask – Whether the algorithm requires an action mask (e.g., MaskablePPO) or not (e.g., DQN).

  • **kwargs – Additional keyword arguments to pass to the model’s predict method.