---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://catboost.ai/docs/en/concepts/python-reference_train.md
  - href: en/concepts/python-reference_train.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://catboost.ai/docs/en/llms.txt

# train

```python
train(pool=None,
      params=None,
      dtrain=None,
      logging_level=None,
      verbose=None,
      iterations=None,
      num_boost_round=None,
      evals=None,
      eval_set=None,
      plot=None,
      verbose_eval=None,
      metric_period=None,
      early_stopping_rounds=None,
      save_snapshot=None,
      snapshot_file=None,
      snapshot_interval=None,
      init_model=None)
```

## Purpose {#purpose}

Train a model.

{% note info %}

<!-- source: en/_includes/work_src/reusage-code-examples/nvidia-driver-reqs.md -->
Training or inference on CUDA-enabled GPUs requires NVIDIA Driver of version 450.80.02 or higher.
<!-- endsource: en/_includes/work_src/reusage-code-examples/nvidia-driver-reqs.md -->

{% endnote %}


## Parameters {#parameters}

### pool

_Alias_: `dtrain`

#### Description

<!-- source: en/_includes/work_src/reusage/python__x__desc__paragraph-no-note.md -->
The input training dataset.
<!-- endsource: en/_includes/work_src/reusage/python__x__desc__paragraph-no-note.md -->

**Possible types**

catboost.Pool

**Default value**

Required parameter

**Supported processing units**

CPU and GPU

### params

#### Description

The list of [parameters](https://catboost.ai/docs/en/references/training-parameters/index.md) to start training with.

**Possible types**

dict

**Default value**

Required parameter

**Supported processing units**

CPU and GPU

### logging_level

#### Description

<!-- source: en/_includes/work_src/reusage/cli__logging-level__intro.md -->
The logging level to output to stdout.
<!-- endsource: en/_includes/work_src/reusage/cli__logging-level__intro.md -->


<!-- source: en/_includes/work_src/reusage/cli__logging-level__outro.md -->
Possible values:
- Silent — Do not output any logging information to stdout.

- Verbose — Output the following data to stdout:

    - optimized metric
    - elapsed time of training
    - remaining time of training

- Info — Output additional information and the number of trees.

- Debug — Output debugging information.
<!-- endsource: en/_includes/work_src/reusage/cli__logging-level__outro.md -->


{% note alert %}

Should not be used with the `verbose` parameter.

{% endnote %}

**Possible types**

string

**Default value**

None (corresponds to the Verbose logging level)

**Supported processing units**

CPU and GPU

### verbose

_Alias_: `verbose_eval`

#### Description

<!-- source: en/_includes/work_src/reusage/python__feature-importances__verbose__short-description__list-intro.md -->
The purpose of this parameter depends on the type of the given value:
<!-- endsource: en/_includes/work_src/reusage/python__feature-importances__verbose__short-description__list-intro.md -->


- bool — Defines the logging level:
    - <q>True</q>  corresponds to the Verbose logging level
    - <q>False</q> corresponds to the Silent logging level

- int — Use the Verbose logging level and set the logging period to the value of this parameter.

{% note alert %}

Do not use this parameter with the `logging_level` parameter.

{% endnote %}

**Possible types**

- bool
- int

**Default value**

1

**Supported processing units**

CPU and GPU


### iterations

_Alias_: `num_boost_round`

#### Description

The maximum number of trees that can be built when solving machine learning problems.

When using other parameters that limit the number of iterations, the final number of trees may be less than the number specified in this parameter.

**Possible types**

int

**Default value**

1000

**Supported processing units**

CPU and GPU

### eval_set

_Alias_: `evals`

#### Description

The validation dataset or datasets used for the following processes:
- [overfitting detector](https://catboost.ai/docs/en/concepts/overfitting-detector.md)
- the best iteration selection
- monitoring metrics' changes

**Possible types**

- catboost.Pool
- list of catboost.Pool
- tuple (X, y)
- list of tuples (X, y)
- string (path to the dataset file)
- list of strings (paths to dataset files)


**Default value**

None

**Supported processing units**

CPU and GPU

{% note info %}

Only a single validation dataset can be input if the training is performed on GPU

{% endnote %}

### plot

#### Description

Plot the following information during training:
- the metric values;
- the custom loss values;
- the loss function change during feature selection;
- the time has passed since training started;
- the remaining time until the end of training.
This [option can be used](https://catboost.ai/docs/en/features/visualization_jupyter-notebook.md) if training is performed in Jupyter notebook.

**Possible types**

bool

**Default value**

False

**Supported processing units**

CPU

### metric_period

#### Description

The frequency of iterations to calculate the values of [objectives and metrics](https://catboost.ai/docs/en/concepts/loss-functions.md). The value should be a positive integer.

The usage of this parameter speeds up the training.

{% note info %}

It is recommended to increase the value of this parameter to maintain training speed if a GPU processing unit type is used.

{% endnote %}

**Possible types**

int

**Default value**

1

**Supported processing units**

CPU and GPU

### early_stopping_rounds

#### Description

Sets the overfitting detector type to Iter and stops the training after the specified number of iterations since the iteration with the optimal metric value.

**Possible types**

int

**Default value**

False

**Supported processing units**

CPU and GPU

### save_snapshot

#### Description

Enable snapshotting for [restoring the training progress after an interruption](https://catboost.ai/docs/en/features/snapshots.md). If enabled, the default period for making snapshots is 600 seconds. Use the `snapshot_interval` parameter to change this period.

<!-- source: en/_includes/work_src/reusage-common-phrases/snapshot-not-working-for-cv.md -->
{% note info %}

This parameter is not supported in the `params` parameter of the [cv](https://catboost.ai/docs/en/concepts/python-reference_cv.md) function.

{% endnote %}
<!-- endsource: en/_includes/work_src/reusage-common-phrases/snapshot-not-working-for-cv.md -->

**Possible types**

bool

**Default value**

None

**Supported processing units**

CPU and GPU

### snapshot_file

#### Description

The name of the file to save the training progress information in. This file is used for [recovering training after an interruption](https://catboost.ai/docs/en/features/snapshots.md).

<!-- source: en/_includes/work_src/reusage/snapshot-filename-desc.md -->
Depending on whether the specified file exists in the file system:
- Missing — Write information about training progress to the specified file.
- Exists — Load data from the specified file and continue training from where it left off.
<!-- endsource: en/_includes/work_src/reusage/snapshot-filename-desc.md -->

<!-- source: en/_includes/work_src/reusage-common-phrases/snapshot-not-working-for-cv.md -->
{% note info %}

This parameter is not supported in the `params` parameter of the [cv](https://catboost.ai/docs/en/concepts/python-reference_cv.md) function.

{% endnote %}
<!-- endsource: en/_includes/work_src/reusage-common-phrases/snapshot-not-working-for-cv.md -->

**Possible types**

string

**Default value**

{% cut "experiment..." %}

experiment.cbsnapshot

{% endcut %}

**Supported processing units**

CPU and GPU


### snapshot_interval

#### Description

The interval between saving snapshots in seconds.

The first snapshot is taken after the specified number of seconds since the start of training. Every subsequent snapshot is taken after the specified number of seconds since the previous one. The last snapshot is taken at the end of the training.

<!-- source: en/_includes/work_src/reusage-common-phrases/snapshot-not-working-for-cv.md -->
{% note info %}

This parameter is not supported in the `params` parameter of the [cv](https://catboost.ai/docs/en/concepts/python-reference_cv.md) function.

{% endnote %}
<!-- endsource: en/_includes/work_src/reusage-common-phrases/snapshot-not-working-for-cv.md -->

**Possible types**

int

**Default value**

600

**Supported processing units**

CPU and GPU

### init_model

#### Description

The model to continue learning from.

{% note info %}

The initial model must have the same problem type as the one being solved in the current training (binary classification, multiclassification or regression/ranking).

{% endnote %}

**Possible types**

{% cut "catboost.CatBoost, catboost.CatBoostClassifier, catboost.CatBoostRegressor" %}

The initial model object:
  - [catboost.CatBoost](https://catboost.ai/docs/en/concepts/python-reference_catboost.md)
  - [catboost.CatBoostClassifier](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier.md)
  - [catboost.CatBoostRegressor](https://catboost.ai/docs/en/concepts/python-reference_catboostregressor.md)

{% endcut %}

{% cut "string" %}

The path to the input file that contains the initial model.

{% endcut %}

**Default value**

None (incremental learning is not used)

**Supported processing units**

CPU
