class_docstr: Early stopping callback.
  
  This callback is CatBoost specific.
  
  Parameters
  ----------
  stopping_rounds : int or tuple
     If int, The possible number of rounds without the trend occurrence.
     If tuple, contains early stopping class as first element and class init kwargs as second element.
  eval_metric : str
     The eval_metric to use for early stopping. Must also be specified in the CatBoost model params.
  compare_key : str, default = 'validation'
      The data to use for scoring. It is recommended to keep as default.
code: def __init__(
      self, stopping_rounds, eval_metric, compare_key="validation"
  ):
      if isinstance(stopping_rounds, int):
          from autogluon.core.utils.early_stopping import SimpleES
  
          self.es = SimpleES(patience=stopping_rounds)
      else:
          self.es = stopping_rounds[0](**stopping_rounds[1])
      self.best_score = None
      self.compare_key = compare_key
  
      if isinstance(eval_metric, str):
          # FIXME: Avoid using private API! (https://github.com/autogluon/autogluon/issues/1381)
          from catboost._catboost import is_maximizable_metric
  
          is_max_optimal = is_maximizable_metric(eval_metric)
          eval_metric_name = eval_metric
      else:
          is_max_optimal = eval_metric.is_max_optimal()
          # FIXME: Unsure if this works for custom metrics!
          eval_metric_name = eval_metric.__class__.__name__
  
      self.eval_metric_name = eval_metric_name
      self.is_max_optimal = is_max_optimal
      self.is_quantile = self.eval_metric_name.startswith(
          CATBOOST_QUANTILE_PREFIX
      )
  
file_path: autogluon/tabular/src/autogluon/tabular/models/catboost/callbacks.py
imports: import logging
  import time
  from autogluon.common.utils.resource_utils import ResourceManager
  from .catboost_utils import CATBOOST_QUANTILE_PREFIX
label_desc: Use image node_id 1 to create a new EarlyStoppingCallback object  with example: obj = EarlyStoppingCallback(stopping_rounds, eval_metric, compare_key)