Using the overfitting detector

If overfitting occurs, CatBoost can stop the training earlier than the training parameters dictate. For example, it can be stopped before the specified number of trees are built. This option is set in the starting parameters.

Choose the implementation for more details.

Python package

The following parameters can be set for the corresponding methods and are used when the model is trained.

Method

Parameters

od_type

Description

The type of the overfitting detector to use.

Possible values:

  • IncToDec
  • Iter

Method

od_pval

Parameters

The threshold for the IncToDec overfitting detector type. The training is stopped when the specified value is reached. Requires that a validation dataset was input.

The value of this parameter must exceed 0 to turn on the overfitting detection.

Method

od_wait

Parameters The number of iterations to continue the training after the iteration with the optimal metric value.
The purpose of this parameter differs depending on the selected overfitting detector type:

  • IncToDec — Ignore the overfitting detector when the threshold is reached and continue learning for the specified number of iterations after the iteration with the optimal metric value.
  • Iter — Consider the model overfitted and stop training after the specified number of iterations since the iteration with the optimal metric value.

R package

The following parameters can be set for the corresponding methods and are used when the model is trained.

For the catboost.train method:

od_type

The type of the overfitting detector to use.

Possible values:

  • IncToDec
  • Iter

od_pval

The threshold for the IncToDec overfitting detector type. The training is stopped when the specified value is reached. Requires that a validation dataset was input.

The value of this parameter must exceed 0 to turn on the overfitting detection.

od_wait

The number of iterations to continue the training after the iteration with the optimal metric value.
The purpose of this parameter differs depending on the selected overfitting detector type:

  • IncToDec — Ignore the overfitting detector when the threshold is reached and continue learning for the specified number of iterations after the iteration with the optimal metric value.
  • Iter — Consider the model overfitted and stop training after the specified number of iterations since the iteration with the optimal metric value.

Command-line version

The following command keys can be specified for the corresponding commands and are used when the model is trained.**

For the catboost fit command:

--od-type

The type of the overfitting detector to use.

Possible values:

  • IncToDec
  • Iter

--od-pval

The threshold for the IncToDec overfitting detector type. The training is stopped when the specified value is reached. Requires that a validation dataset was input.

The value of this parameter must exceed 0 to turn on the overfitting detection.

--od-wait

The number of iterations to continue the training after the iteration with the optimal metric value.
The purpose of this parameter differs depending on the selected overfitting detector type:

  • IncToDec — Ignore the overfitting detector when the threshold is reached and continue learning for the specified number of iterations after the iteration with the optimal metric value.
  • Iter — Consider the model overfitted and stop training after the specified number of iterations since the iteration with the optimal metric value.