class_docstr: Can be used to control early stopping with a Trainer class. Any object can be used instead which
  implements the method check_stopping and and provides the attribute save_dir
class_docstr_tok: ["Can","be","used","to","control","early","stopping","with","a","Trainer","class",".","Any","object","can","be","used","instead","which","implements","the","method","check_stopping","and","and","provides","the","attribute","save_dir"]
docstr: Provide the evaluation value for the current evaluation. Returns true if stopping should occur.
  This will save the model, if necessary.
  
  :param eval: the current evaluation result
  :return: a tuple (stopprocessing, savemodel, evalvalue) indicating if processing should be stopped
           and if the current model should get saved and the evaluation value used.
docstr_tok: ["Provide","the","evaluation","value","for","the","current","evaluation",".","Returns","true","if","stopping","should","occur",".","This","will","save","the","model",",","if","necessary",".",":","param","eval",":","the","current","evaluation","result",":","return",":","a","tuple","(","stopprocessing",",","savemodel",",","evalvalue",")","indicating","if","processing","should","be","stopped","and","if","the","current","model","should","get","saved","and","the","evaluation","value","used","."]
code: def check_stopping(self, eval_result):
      """
      Provide the evaluation value for the current evaluation. Returns true if stopping should occur.
      This will save the model, if necessary.
  
      :param eval: the current evaluation result
      :return: a tuple (stopprocessing, savemodel, evalvalue) indicating if processing should be stopped
               and if the current model should get saved and the evaluation value used.
      """
  
      if isinstance(self.metric, str):
          eval_value = eval_result[self.head][self.metric]
      else:
          eval_value = self.metric(eval_result)
      self.eval_values.append(float(eval_value))
      stopprocessing, savemodel = False, False
      if len(self.eval_values) <= self.min_evals:
          return stopprocessing, savemodel, eval_value
      if self.mode == "min":
          delta = self.best_so_far - eval_value
      else:
          delta = eval_value - self.best_so_far
      if delta > self.min_delta:
          self.best_so_far = eval_value
          self.n_since_best = 0
          if self.save_dir:
              savemodel = True
      else:
          self.n_since_best += 1
      if self.n_since_best > self.patience:
          stopprocessing = True
      return stopprocessing, savemodel, eval_value
  
imports: import logging
  import sys
  import torch
  from pathlib import Path
  from tqdm import tqdm
  import numpy
  import shutil
  import dill
  from farm.utils import MLFlowLogger
  from farm.utils import GracefulKiller, set_all_seeds
  from farm.eval import Evaluator
  from farm.data_handler.data_silo import DataSilo
  from farm.visual.ascii.images import GROWING_TREE
  from farm.modeling.adaptive_model import AdaptiveModel
  from farm.modeling.biadaptive_model import BiAdaptiveModel
  from farm.modeling.optimization import get_scheduler
label_desc: Use image node_id 2 for calling the EarlyStopping obj's underlying member method code with example usage: obj.check_stopping(eval_result) and returns: stopprocessing,  savemodel,  eval_value, stopprocessing,  savemodel,  eval_value