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_if_necessary(self, t, episodes):
      if t >= self.prev_eval_t + self.eval_interval:
          score = self.evaluate_and_update_max_score(t, episodes)
          self.prev_eval_t = t - t % self.eval_interval
          return score
      return None
  
imports: import logging
  import multiprocessing
  import os
  import statistics
  import time
  import numpy
  import chainerrl
label_desc: Use image node_id 3 for calling the Evaluator obj's underlying member method code with example usage: obj.evaluate_if_necessary(t, episodes) and returns: None, score