class_docstr: Internal early stopping callable class.
class_docstr_tok: ["Internal","early","stopping","callable","class","."]
docstr: Check, by name, if a given Dataset is the training data.
docstr_tok: ["Check",",","by","name",",","if","a","given","Dataset","is","the","training","data","."]
code: def _is_train_set(
      self, ds_name: str, eval_name: str, env: CallbackEnv
  ) -> bool:
      """Check, by name, if a given Dataset is the training data."""
      # for lgb.cv() with eval_train_metric=True, evaluation is also done on the training set
      # and those metrics are considered for early stopping
      if ds_name == "cv_agg" and eval_name == "train":
          return True
  
      # for lgb.train(), it's possible to pass the training data via valid_sets with any eval_name
      if (
          isinstance(env.model, Booster)
          and ds_name == env.model._train_data_name
      ):
          return True
  
      return False
  
imports: from collections import OrderedDict
  from dataclasses import dataclass
  from functools import partial
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
  from .basic import Booster, _ConfigAliases, _LGBM_BoosterEvalMethodResultType, _LGBM_BoosterEvalMethodResultWithStandardDeviationType, _log_info, _log_warning
label_desc: Use image node_id 5 for calling the _EarlyStoppingCallback obj's underlying member method code with example usage: obj._is_train_set(ds_name, eval_name, env) and returns: False, True, True