class_docstr: Object that is responsible for evaluating a given agent.
  
  Args:
      agent (Agent): Agent to evaluate.
      env (Env): Env to evaluate the agent on.
      n_steps (int): Number of timesteps used in each evaluation.
      n_episodes (int): Number of episodes used in each evaluation.
      eval_interval (int): Interval of evaluations in steps.
      outdir (str): Path to a directory to save things.
      max_episode_len (int): Maximum length of episodes used in evaluations.
      step_offset (int): Offset of steps used to schedule evaluations.
      save_best_so_far_agent (bool): If set to True, after each evaluation,
          if the score (= mean of returns in evaluation episodes) exceeds
          the best-so-far score, the current agent is saved.
class_docstr_tok: ["Object","that","is","responsible","for","evaluating","a","given","agent",".","Args",":","agent","(","Agent",")",":","Agent","to","evaluate",".","env","(","Env",")",":","Env","to","evaluate","the","agent","on",".","n_steps","(","int",")",":","Number","of","timesteps","used","in","each","evaluation",".","n_episodes","(","int",")",":","Number","of","episodes","used","in","each","evaluation",".","eval_interval","(","int",")",":","Interval","of","evaluations","in","steps",".","outdir","(","str",")",":","Path","to","a","directory","to","save","things",".","max_episode_len","(","int",")",":","Maximum","length","of","episodes","used","in","evaluations",".","step_offset","(","int",")",":","Offset","of","steps","used","to","schedule","evaluations",".","save_best_so_far_agent","(","bool",")",":","If","set","to","True",",","after","each","evaluation",",","if","the","score","(","=","mean","of","returns","in","evaluation","episodes",")","exceeds","the","best-so-far","score",",","the","current","agent","is","saved","."]
code: def evaluate_and_update_max_score(self, t, episodes):
      eval_stats = eval_performance(
          self.env,
          self.agent,
          self.n_steps,
          self.n_episodes,
          max_episode_len=self.max_episode_len,
          logger=self.logger,
      )
      elapsed = time.time() - self.start_time
      custom_values = tuple(
          tup[1] for tup in self.agent.get_statistics()
      )
      mean = eval_stats["mean"]
      values = (
          t,
          episodes,
          elapsed,
          mean,
          eval_stats["median"],
          eval_stats["stdev"],
          eval_stats["max"],
          eval_stats["min"],
      ) + custom_values
      record_stats(self.outdir, values)
      if mean > self.max_score:
          self.logger.info(
              "The best score is updated %s -> %s", self.max_score, mean
          )
          self.max_score = mean
          if self.save_best_so_far_agent:
              save_agent(self.agent, "best", self.outdir, self.logger)
      return mean
  
imports: import logging
  import multiprocessing
  import os
  import statistics
  import time
  import numpy
  import chainerrl
label_desc: Use image node_id 2 for calling the Evaluator obj's underlying member method code with example usage: obj.evaluate_and_update_max_score(t, episodes) and returns: mean