class_docstr: Callback for catboost to prune unpromising trials.
  
  See `the example <https://github.com/optuna/optuna-examples/blob/main/
  catboost/catboost_pruning.py>`__
  if you want to add a pruning callback which observes validation accuracy of
  a CatBoost model.
  
  .. note::
      :class:`optuna.TrialPruned` cannot be raised
      in :meth:`~optuna.integration.CatBoostPruningCallback.after_iteration`
      that is called in CatBoost via ``CatBoostPruningCallback``.
      You must call :meth:`~optuna.integration.CatBoostPruningCallback.check_pruned`
      after training manually unlike other pruning callbacks
      to raise :class:`optuna.TrialPruned`.
  
  .. note::
      This callback cannot be used with CatBoost on GPUs because CatBoost doesn't support
      a user-defined callback for GPU.
      Please refer to `CatBoost issue <https://github.com/catboost/catboost/issues/1792>`_.
  
  Args:
      trial:
          A :class:`~optuna.trial.Trial` corresponding to the current evaluation of the
          objective function.
      metric:
          An evaluation metric for pruning, e.g., ``Logloss`` and ``AUC``.
          Please refer to
          `CatBoost reference
          <https://catboost.ai/docs/references/eval-metric__supported-metrics.html>`_
          for further details.
      eval_set_index:
          The index of the target validation dataset.
          If you set only one ``eval_set``, ``eval_set_index`` is None.
          If you set multiple datasets as ``eval_set``, the index of ``eval_set`` must be
          ``eval_set_index``, e.g., ``0`` or ``1`` when ``eval_set`` contains two datasets.
code: def __init__(
      self,
      trial: optuna.trial.Trial,
      metric: str,
      eval_set_index: Optional[int] = None,
  ) -> None:
      default_valid_name = "validation"
      self._trial = trial
      self._metric = metric
      if eval_set_index is None:
          self._valid_name = default_valid_name
      else:
          self._valid_name = (
              default_valid_name + "_" + str(eval_set_index)
          )
      self._pruned = False
      self._message = ""
  
file_path: optuna/optuna/integration/catboost.py
imports: from typing import Any
  from typing import Optional
  from packaging import version
  import optuna
  from optuna._experimental import experimental_class
  from optuna._imports import try_import
label_desc: Use image node_id 1 to create a new CatBoostPruningCallback object  with example: obj = CatBoostPruningCallback(trial, metric, eval_set_index)