catboost.train

catboost.train(learn_pool,
               test_pool = NULL,
               params = list())

Purpose

Train the model using a CatBoost dataset.

Note

Training or inference on CUDA-enabled GPUs requires NVIDIA Driver of version 450.80.02 or higher.

Arguments

learn_pool

Description

The dataset used for training the model.

Default value

Required argument

test_pool

Description

The dataset used for testing the quality of the model.

Default value

NULL (not used)

params

Description

The list of parameters to start training with.

If omitted, default values are used (refer to the  Parameters section).

If set, the passed list of parameters overrides the default values.

Default value

Required argument

Parameters

Common parameters

loss_function

Description

The metric to use in training. The specified value also determines the machine learning problem to solve. Some metrics support optional parameters (see the Objectives and metrics section for details on each metric).

Format:

<Metric>[:<parameter 1>=<value>;..;<parameter N>=<value>]
Supported metrics
  • RMSE

  • Logloss

  • MAE

  • CrossEntropy

  • Quantile

  • LogLinQuantile

  • Lq

  • MultiRMSE

  • MultiClass

  • MultiClassOneVsAll

  • MultiLogloss

  • MultiCrossEntropy

  • MAPE

  • Poisson

  • PairLogit

  • PairLogitPairwise

  • QueryRMSE

  • QuerySoftMax

  • GroupQuantile

  • Tweedie

  • YetiRank

  • YetiRankPairwise

  • StochasticFilter

  • StochasticRank

  • LambdaMart

For example, use the following construction to calculate the value of Quantile with the coefficient α=0.1\alpha = 0.1:

Quantile:alpha=0.1

Default value

RMSE

Supported processing units

CPU and GPU

custom_loss

Description

Metric values to output during training. These functions are not optimized and are displayed for informational purposes only. Some metrics support optional parameters (see the Objectives and metrics section for details on each metric).

Format:

<Metric>[:<parameter 1>=<value>;..;<parameter N>=<value>]

Supported metrics

Examples:

  • Calculate the value of CrossEntropy:

    c('CrossEntropy')
    

    Or simply:

    'CrossEntropy'
    
  • Calculate the values of Logloss and AUC:

    c('Logloss', 'AUC')
    
  • Calculate the value of Quantile with the coefficient α=0.1\alpha = 0.1

    c('Quantile:alpha=0.1')
    

Values of all custom metrics for learn and validation datasets are saved to the Metric output files (learn_error.tsv and test_error.tsv respectively). The directory for these files is specified in the --train-dir (train_dir) parameter.

Default value

None

Supported processing units

CPU and GPU

eval_metric

Description

The metric used for overfitting detection (if enabled) and best model selection (if enabled). Some metrics support optional parameters (see the Objectives and metrics section for details on each metric).

Format:

<Metric>[:<parameter 1>=<value>;..;<parameter N>=<value>]

Supported metrics

Quantile:alpha=0.3

Default value

Optimized objective is used

Supported processing units

CPU and GPU

iterations

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.

Default value

1000

Supported processing units

CPU and GPU

learning_rate

Description

The learning rate.

Used for reducing the gradient step.

Default value

The default value is defined automatically for Logloss, MultiClass & RMSE loss functions depending on the number of iterations if none of

  • leaf_estimation_iterations
  • --leaf-estimation-method
  • l2_leaf_reg

is set. In this case, the selected learning rate is printed to stdout and saved in the model.

In other cases, the default value is 0.03.

Supported processing units

CPU and GPU

random_seed

Description

The random seed used for training.

Default value

0

Supported processing units

CPU and GPU

l2_leaf_reg

Description

Coefficient at the L2 regularization term of the cost function.
Any positive value is allowed.

Default value

3.0

Supported processing units

CPU and GPU

bootstrap_type

Description

Bootstrap type. Defines the method for sampling the weights of objects.

Supported methods:

  • Bayesian
  • Bernoulli
  • MVS
  • Poisson (supported for GPU only)
  • No

Default value

The default value depends on the selected mode and processing unit type:

  • QueryCrossEntropy, YetiRankPairwise: Bernoulli with the subsample parameter set to 0.5.
  • MultiClass and MultiClassOneVsAll: Bayesian.
  • Other modes:
    • GPU: Bayesian
    • CPU: MVS with the subsample parameter set to 0.8.

Supported processing units

CPU and GPU

bagging_temperature

Description

Defines the settings of the Bayesian bootstrap. It is used by default in classification and regression modes.

Use the Bayesian bootstrap to assign random weights to objects.

The weights are sampled from exponential distribution if the value of this parameter is set to 1. All weights are equal to 1 if the value of this parameter is set to 0.

Possible values are in the range [0;inf)[0; \inf). The higher the value the more aggressive the bagging is.

This parameter can be used if the selected bootstrap type is Bayesian.

Default value

1

Supported processing units

CPU and GPU

subsample

Description

Sample rate for bagging.

This parameter can be used if one of the following bootstrap types is selected:

  • Poisson
  • Bernoulli
  • MVS

Default value

The default value depends on the dataset size and the bootstrap type:

  • Datasets with less than 100 objects — 1
  • Datasets with 100 objects or more:
    • Poisson, Bernoulli — 0.66
    • MVS — 0.8

Supported processing units

CPU and GPU

sampling_frequency

Description

Frequency to sample weights and objects when building trees.

Supported values:

  • PerTree — Before constructing each new tree
  • PerTreeLevel — Before choosing each new split of a tree

Default value

PerTreeLevel

Supported processing units

CPU

sampling_unit

Description

The sampling scheme.

Possible values:

  • Object — The weight wiw_{i} of the i-th object oio_{i} is used for sampling the corresponding object.
  • Group — The weight wjw_{j} of the group gjg_{j} is used for sampling each object oijo_{i_{j}} from the group gjg_{j}.

Default value

Object

Supported processing units

CPU and GPU

mvs_reg

Description

Affects the weight of the denominator and can be used for balancing between the importance and Bernoulli sampling (setting it to 0 implies importance sampling and to \infty - Bernoulli).

Note

This parameter is supported only for the MVS sampling method (the bootstrap_type parameter must be set to MVS).

Default value

The value is set based on the gradient distribution on the current iteration

Supported processing units

CPU

random_strength

Description

The amount of randomness to use for scoring splits when the tree structure is selected. Use this parameter to avoid overfitting the model.

The value of this parameter is used when selecting splits. On every iteration each possible split gets a score (for example, the score indicates how much adding this split will improve the loss function for the training dataset). The split with the highest score is selected.

The scores have no randomness. A normally distributed random variable is added to the score of the feature. It has a zero mean and a variance that decreases during the training. The value of this parameter is the multiplier of the variance.

This parameter is not supported for the following loss functions:

  • QueryCrossEntropy
  • YetiRankPairwise
  • PairLogitPairwise

Default value

1

Supported processing units

CPU

use_best_model

Description

If this parameter is set, the number of trees that are saved in the resulting model is defined as follows:

  1. Build the number of trees defined by the training parameters.
  2. Use the validation dataset to identify the iteration with the optimal value of the metric specified in  --eval-metric (--eval-metric).

No trees are saved after this iteration.

This option requires a validation dataset to be provided.

Default value

True if a validation set is input (the train_pool parameter is defined) and at least one of the label values of objects in this set differs from the others. False otherwise.

Supported processing units

CPU and GPU

best_model_min_trees

Description

The minimal number of trees that the best model should have. If set, the output model contains at least the given number of trees even if the optimal value of the evaluation metric on the validation dataset is achieved with smaller number of trees.

Should be used with the --use-best-model parameter.

Default value

None (The minimal number of trees for the best model is not set)

Supported processing units

CPU and GPU

train_pool

Description

The validation set for the following processes:

Default value

None

Supported processing units

CPU and GPU

depth

Description

Depth of the trees.

The range of supported values depends on the processing unit type and the type of the selected loss function:

  • CPU — Any integer up to  16.

  • GPU — Any integer up to 8pairwise modes (YetiRank, PairLogitPairwise and QueryCrossEntropy) and up to   16 for all other loss functions.

Default value

6 (16 if the growing policy is set to Lossguide)

Supported processing units

CPU and GPU

grow_policy

Description

The tree growing policy. Defines how to perform greedy tree construction.

Possible values:

  • SymmetricTree —A tree is built level by level until the specified depth is reached. On each iteration, all leaves from the last tree level are split with the same condition. The resulting tree structure is always symmetric.

  • Depthwise — A tree is built level by level until the specified depth is reached. On each iteration, all non-terminal leaves from the last tree level are split. Each leaf is split by condition with the best loss improvement.

    Note

    Models with this growing policy can not be analyzed using the PredictionDiff feature importance and can be exported only to json and cbm.

  • Lossguide — A tree is built leaf by leaf until the specified maximum number of leaves is reached. On each iteration, non-terminal leaf with the best loss improvement is split.

    Note

    Models with this growing policy can not be analyzed using the PredictionDiff feature importance and can be exported only to json and cbm.

Default value

SymmetricTree

Supported processing units

CPU and GPU

min_data_in_leaf

Description

The minimum number of training samples in a leaf. CatBoost does not search for new splits in leaves with samples count less than the specified value.
Can be used only with the Lossguide and Depthwise growing policies.

Default value

1

Supported processing units

CPU and GPU

max_leaves

Description

The maximum number of leafs in the resulting tree. Can be used only with the Lossguide growing policy.

Note

It is not recommended to use values greater than 64, since it can significantly slow down the training process.

Default value

31

Supported processing units

CPU and GPU

ignored_features

Description

Feature indices to exclude from the training.

Specifics:

  • Non-negative indices that do not match any features are successfully ignored. For example, if five features are defined for the objects in the dataset and this parameter is set to 42, the corresponding non-existing feature is successfully ignored.

  • The identifier corresponds to the feature's index. Feature indices used in train and feature importance are numbered from 0 to featureCount – 1. If a file is used as input data then any non-feature column types are ignored when calculating these indices. For example, each row in the input file contains data in the following order: cat feature<\t>label value<\t>num feature. So for the row rock<\t>0<\t>42, the identifier for the rock feature is 0, and for the 42 feature it's 1.

The identifiers of features to exclude should be enumerated at vector.

For example, if training should exclude features with the identifiers 1, 2, 7, 42, 43, 44, 45, the value of this parameter should be set to c(1,2,7,42,43,44,45).

Default value

None

Supported processing units

CPU and GPU

one_hot_max_size

Description

Use one-hot encoding for all categorical features with a number of different values less than or equal to the given parameter value. Ctrs are not calculated for such features.

See details.

Default value

The default value depends on various conditions:

  • N/A if training is performed on CPU in Pairwise scoring mode

    Read more about Pairwise scoring

    The following loss functions use Pairwise scoring:

    • YetiRankPairwise
    • PairLogitPairwise
    • QueryCrossEntropy

    Pairwise scoring is slightly different from regular training on pairs, since pairs are generated only internally during the training for the corresponding metrics. One-hot encoding is not available for these loss functions.

  • 255 if training is performed on GPU and the selected Ctr types require target data that is not available during the training

  • 10 if training is performed in Ranking mode

  • 2 if none of the conditions above is met

Supported processing units

CPU and GPU

has_time

Description

Use the order of objects in the input data (do not perform random permutations during the Transforming categorical features to numerical features and Choosing the tree structure stages).

The Timestamp column type is used to determine the order of objects if specified in the input data.

Default value

FALSE (not used; generate random permutations)

Supported processing units

CPU and GPU

rsm

Description

Random subspace method. The percentage of features to use at each split selection, when features are selected over again at random.

The value must be in the range (0;1].

Default value

1

Supported processing units

CPU and GPU for pairwise ranking

nan_mode

Description

The method for  processing missing values in the input dataset.

Possible values:

  • "Forbidden" — Missing values are not supported, their presence is interpreted as an error.
  • "Min" — Missing values are processed as the minimum value (less than all other values) for the feature. It is guaranteed that a split that separates missing values from all other values is considered when selecting trees.
  • "Max" — Missing values are processed as the maximum value (greater than all other values) for the feature. It is guaranteed that a split that separates missing values from all other values is considered when selecting trees.

Using the  Min or Max value of this parameter guarantees that a split between missing values and other values is considered when selecting a new split in the tree.

Note

The method for processing missing values can be set individually for each feature in the Custom quantization borders and missing value modes input file. Such values override the ones specified in this parameter.

Default value

Min

Supported processing units

CPU and GPU

fold_permutation_block

Description

Objects in the dataset are grouped in blocks before the random permutations. This parameter defines the size of the blocks. The smaller is the value, the slower is the training. Large values may result in quality degradation.

Default value

Default value differs depending on the dataset size and ranges from 1 to
256 inclusively

Supported processing units

CPU and GPU

leaf_estimation_method

Description

The method used to calculate the values in leaves.

Possible values:

  • Newton
  • Gradient
  • Exact

Default value

Depends on the mode and the selected loss function:

  • Regression with Quantile or MAE loss functions — One Exact iteration.
  • Regression with any loss function but Quantile or MAE – One Gradient iteration.
  • Classification mode – Ten Newton iterations.
  • Multiclassification mode – One Newton iteration.

Supported processing units

  • The Exact method is available only on CPU
  • All other methods are available on both CPU and GPU

leaf_estimation_iterations

Description

CatBoost might calculate leaf values using several gradient or newton steps instead of a single one.

This parameter regulates how many steps are done in every tree when calculating leaf values.

Default value

Depends on the training objective

Supported processing units

CPU and GPU

leaf_estimation_backtracking

Description

When the value of the --leaf-estimation-iterationsfor the Command-line version parameter is greater than 1, CatBoost makes several gradient or newton steps when calculating the resulting leaf values of a tree.

The behaviour differs depending on the value of this parameter:

  • No — Every next step is a regular gradient or newton step: the gradient step is calculated and added to the leaf.
  • Any other value —Backtracking is used.
    In this case, before adding a step, a condition is checked. If the condition is not met, then the step size is reduced (divided by 2), otherwise the step is added to the leaf.

When --leaf-estimation-iterationsfor the Command-line version is set to n, the leaf estimation iterations are calculated as follows: each iteration is either an addition of the next step to the leaf value, or it's a scaling of the leaf value. Scaling counts as a separate iteration. Thus, it is possible that instead of having n gradient steps, the algorithm makes a single gradient step that is reduced n times, which means that it is divided by 2n2\cdot n times.

Possible values:

  • No — Do not use backtracking. Supported on CPU and GPU.
  • AnyImprovement — Reduce the descent step up to the point when the loss function value is smaller than it was on the previous step. The trial reduction factors are 2, 4, 8, and so on. Supported on CPU and GPU.
  • Armijo — Reduce the descent step until the Armijo condition is met. Supported only on GPU.

Default value

AnyImprovement

Supported processing units

Depends on the selected value

name

Description

The experiment name to display in visualization tools.

Default value

experiment

Supported processing units

CPU and GPU

fold_len_multiplier

Description

Coefficient for changing the length of folds.

The value must be greater than 1. The best validation result is achieved with minimum values.

With values close to 1 (for example, 1+ϵ1+\epsilon), each iteration takes a quadratic amount of memory and time for the number of objects in the iteration. Thus, low values are possible only when there is a small number of objects.

Default value

2

Supported processing units

CPU and GPU

approx_on_full_history

Description

The principles for calculating the approximated values.

Possible values:

  • TRUE — Use all the preceding rows in the fold for calculating the approximated values. This mode is slower and in rare cases slightly more accurate.
  • FALSE — Use only а fraction of the fold for calculating the approximated values. The size of the fraction is calculated as follows: 1X\frac{1}X, where X is the specified coefficient for changing the length of folds. This mode is faster and in rare cases slightly less accurate

Default value

TRUE

Supported processing units

CPU

class_weights

Description

Class weights. The values are used as multipliers for the object weights. This parameter can be used for solving binary classification and multiclassification problems.

For example, class_weights <- c(0.1, 4)multiplies the weights of objects from class 0 by 0.1 and the weights of objects from class 1 by 4.

Alert

Do not use this parameter with auto_class_weights.

Default value

None (the weight for all classes is set to 1)

Supported processing units

CPU and GPU

auto_class_weights

Description

Automatically calculate class weights based either on the total weight or the total number of objects in each class. The values are used as multipliers for the object weights.

Supported values:

  • None — All class weights are set to 1

  • Balanced:

    CWk=maxc=1K(ti=cwi)ti=kwiCW_k=\displaystyle\frac{max_{c=1}^K(\sum_{t_{i}=c}{w_i})}{\sum_{t_{i}=k}{w_{i}}}

  • SqrtBalanced:

    CWk=maxc=1K(ti=cwi)ti=kwiCW_k=\sqrt{\displaystyle\frac{max_{c=1}^K(\sum_{t_i=c}{w_i})}{\sum_{t_i=k}{w_i}}}

Alert

Do not use this parameter with class_weights.

Default value

None — All class weights are set to 1

Supported processing units

CPU and GPU

boosting_type

Description

Boosting scheme.

Possible values:

  • Ordered — Usually provides better quality on small datasets, but it may be slower than the Plain scheme.
  • Plain — The classic gradient boosting scheme.

Default value

Depends on the processing unit type, the number of objects in the training dataset and the selected learning mode:

  • {CPU:
    • Plain
  • GPU:
    • Any number of objects, MultiClass or MultiClassOneVsAll mode: Plain
    • More than 50 thousand objects, any mode: Plain
    • Less than or equal to 50 thousand objects, any mode but MultiClass or MultiClassOneVsAll: Ordered

Supported processing units

CPU and GPU

Only the Plain mode is supported for the MultiClass loss on GPU

boost_from_average

Description

Initialize approximate values by best constant value for the specified loss function. Sets the value of bias to the initial best constant value.

Available for the following loss functions:

  • RMSE
  • Logloss
  • CrossEntropy
  • Quantile
  • MAE
  • MAPE

Default value

Depends on the selected loss function:

  • True for RMSE, Quantile, MAE, MAPE
  • False for all other loss functions

Supported processing units

CPU and GPU

langevin

Description

Enables the Stochastic Gradient Langevin Boosting mode.

Refer to the SGLB: Stochastic Gradient Langevin Boosting paper for details.

Default value

False

Supported processing units

CPU

diffusion_temperature

Description

The diffusion temperature of the Stochastic Gradient Langevin Boosting mode.

Only non-negative values are supported.

Default value

10000

Supported processing units

CPU

allow_const_label

Description

Use it to train models with datasets that have equal label values for all objects.

Default value

False

Supported processing units

CPU and GPU

score_function

Description

The score type used to select the next split during the tree construction.

Possible values:

  • Cosine (do not use this score type with the Lossguide tree growing policy)
  • L2
  • NewtonCosine (do not use this score type with the Lossguide tree growing policy)
  • NewtonL2

Default value

Cosine

Supported processing units

The supported score functions vary depending on the processing unit type:

  • GPU — All score types

  • CPU — Cosine, L2

cat_features

Description

A vector of categorical features indices.

The indices are zero-based and can differ from the ones given in the columns description file.

Default value

NULL (it is assumed that all columns are the values of numerical
features)

Supported processing units

CPU and GPU

monotone_constraints

Description

Impose monotonic constraints on numerical features.

Possible values:

  • 1 — Increasing constraint on the feature. The algorithm forces the model to be a non-decreasing function of this features.

  • -1 — Decreasing constraint on the feature. The algorithm forces the model to be a non-increasing function of this features.

  • 0 — constraints are disabled.

Supported formats for setting the value of this parameter (all feature indices are zero-based):

  • Set constraints individually for each feature as a string (the number of features is n).

    Format

    "(<constraint_0>, <constraint_2>, .., <constraint_n-1>)"
    

    In

    monotone_constraints = "(1,0,-1)"
    

    an increasing constraint is set on the first feature and a decreasing one on the third. Constraints are disabled for all other features.

  • Set constraints individually for each explicitly specified feature as a string (the number of features is n).

    "<feature index or name>:<constraint>, .., <feature index or name>:<constraint>"
    
    These examples
    monotone-constraints = "2:1,4:-1"
    
    monotone-constraints = "Feature2:1,Feature4:-1"
    

    are identical, given that the name of the feature index 2 is Feature2 and the name of the feature indexed 4 is Feature4.

Default value

None

Supported processing units

CPU

feature_weights

Description

Per-feature multiplication weights used when choosing the best split. The score of each candidate is multiplied by the weights of features from the current split.

Non-negative float values are supported for each weight.

Supported formats for setting the value of this parameter:

  • Set the multiplication weight for each feature as a string (the number of features is n).

    Format

    "(<feature-weight_0>,<feature-weight_2>,..,<feature-weight_n-1>)"
    

    Note

    Spaces between values are not allowed.

    Values should be passed as a parenthesized string of comma-separated values. Multiplication weights equal to 1 at the end of the list may be dropped.

    In this

    feature_weights = "(0.1,1,3)"
    

    the multiplication weight is set to 0.1, 1 and 3 for the first, second and third features respectively. The multiplication weight for all other features is set to 1.

  • Set the multiplication weight individually for each explicitly specified feature as a string (the number of features is n).

    Format

    "<feature index or name>:<weight>, .., <feature index or name>:<weight>"
    

    Note

    Spaces between values are not allowed.

    These examples
    feature_weights = "2:1.1,4:0.1"
    
    feature_weights = "Feature2:1.1,Feature4:0.1"
    

    are identical, given that the name of the feature indexed 2 is Feature2 and the name of the feature indexed 4 is Feature4.

Default value

1 for all features

Supported processing units

CPU

first_feature_use_penalties

Description

Per-feature penalties for the first occurrence of the feature in the model. The given value is subtracted from the score if the current candidate is the first one to include the feature in the model.

Refer to the Per-object and per-feature penalties section for details on applying different score penalties.

Non-negative float values are supported for each penalty.

  • Set the penalty for each feature as a string (the number of features is n).

    Format

    "(<feature-penalty_0>, <feature-penalty_2>, .., <feature-penalty_n-1>)"
    

    Note

    Spaces between values are not allowed.

    Values should be passed as a parenthesized string of comma-separated values. Penalties equal to 0 at the end of the list may be dropped.

    Penalties equal to 0 at the end of the list may be dropped.

    In this

    example

    first_feature_use_penalties parameter:

    first_feature_use_penalties = "(0.1,1,3)"
    

    per_object_feature_penalties parameter:

    per_object_feature_penalties = "(0.1,1,3)"
    

    Note

    Spaces between values are not allowed.

    the multiplication weight is set to 0.1, 1 and 3 for the first, second and third features respectively. The multiplication weight for all other features is set to 1.

  • Set the penalty individually for each explicitly specified feature as a string (the number of features is n).

    Format

    "<feature index or name>:<penalty>,..,<feature index or name>:<penalty>"
    

    Note

    Spaces between values are not allowed.

    These examples

    first_feature_use_penalties parameter:

    first_feature_use_penalties = "2:1.1,4:0.1"
    
    first_feature_use_penalties = "Feature2:1.1,Feature4:0.1"
    

    per_object_feature_penalties parameter:

    per_object_feature_penalties = "2:1.1,4:0.1"
    
    per_object_feature_penalties = "Feature2:1.1,Feature4:0.1"
    

    are identical, given that the name of the feature indexed 2 is Feature2 and the name of the feature indexed 4 is Feature4.

Default value

0 for all features

Supported processing units

CPU

fixed_binary_splits

Description

A list of indices of binary features to put at the top of each tree; ignored if grow_policy is Symmetric.

Default value

None

Supported processing units

GPU

penalties_coefficient

Description

A single-value common coefficient to multiply all penalties.

Non-negative values are supported.

Default value

1

Supported processing units

CPU

per_object_feature_penalties

Description

Per-object penalties for the first use of the feature for the object. The given value is multiplied by the number of objects that are divided by the current split and use the feature for the first time.

Refer to the Per-object and per-feature penalties section for details on applying different score penalties.

Non-negative float values are supported for each penalty.

  • Set the penalty for each feature as a string (the number of features is n).

    Format

    "(<feature-penalty_0>, <feature-penalty_2>, .., <feature-penalty_n-1>)"
    

    Note

    Spaces between values are not allowed.

    Values should be passed as a parenthesized string of comma-separated values. Penalties equal to 0 at the end of the list may be dropped.

    Penalties equal to 0 at the end of the list may be dropped.

    In this

    example

    first_feature_use_penalties parameter:

    first_feature_use_penalties = "(0.1,1,3)"
    

    per_object_feature_penalties parameter:

    per_object_feature_penalties = "(0.1,1,3)"
    

    Note

    Spaces between values are not allowed.

    the multiplication weight is set to 0.1, 1 and 3 for the first, second and third features respectively. The multiplication weight for all other features is set to 1.

  • Set the penalty individually for each explicitly specified feature as a string (the number of features is n).

    Format

    "<feature index or name>:<penalty>,..,<feature index or name>:<penalty>"
    

    Note

    Spaces between values are not allowed.

    These examples

    first_feature_use_penalties parameter:

    first_feature_use_penalties = "2:1.1,4:0.1"
    
    first_feature_use_penalties = "Feature2:1.1,Feature4:0.1"
    

    per_object_feature_penalties parameter:

    per_object_feature_penalties = "2:1.1,4:0.1"
    
    per_object_feature_penalties = "Feature2:1.1,Feature4:0.1"
    

    are identical, given that the name of the feature indexed 2 is Feature2 and the name of the feature indexed 4 is Feature4.

Default value

0 for all objects

Supported processing units

CPU

model_shrink_rate

Description

The constant used to calculate the coefficient for multiplying the model on each iteration.
The actual model shrinkage coefficient calculated at each iteration depends on the value of the --model-shrink-modefor the Command-line version parameter. The resulting value of the coefficient should be always in the range (0, 1].

Default value

The default value depends on the values of the following parameters:

  • --model-shrink-modefor the Command-line version
  • --monotone-constraintsfor the Command-line version

Supported processing units

CPU

model_shrink_mode

Description

Determines how the actual model shrinkage coefficient is calculated at each iteration.

Possible values:

  • Constant:

    1model_shrink_ratelearning_rate,1 - model\_shrink\_rate \cdot learning\_rate{,}

    • model_shrink_ratemodel\_shrink\_rate is the value of the --model-shrink-ratefor the Command-line version parameter.
    • learning_ratelearning\_rate is the value of the --learning-rate for the Command-line version parameter
  • Decreasing:
    1model_shrink_ratei,1 - \frac{model\_shrink\_rate}{i}{,}

    • model_shrink_ratemodel\_shrink\_rate is the value of the --model-shrink-ratefor the Command-line version parameter.
    • ii is the identifier of the iteration.

Default value

Constant

Supported processing units

CPU

Overfitting detection settings

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.

Default value

FALSE

Supported processing units

CPU and GPU

od_type

Description

The type of the overfitting detector to use.

Possible values:

  • IncToDec
  • Iter

Default value

IncToDec

Supported processing units

CPU and GPU

od_pval

Description

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.

For best results, it is recommended to set a value in the range [1010;102][10^{–10}; 10^{-2}].

The larger the value, the earlier overfitting is detected.

Alert

Do not use this parameter with the Iter overfitting detector type.

Default value

0 (the overfitting detection is turned off)

Supported processing units

CPU and GPU

od_wait

Description

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.

Default value

20

Supported processing units

CPU and GPU

Quantization settings

target_border

Description

If set, defines the border for converting target values to 0 and 1.

Depending on the specified value:

  • target_valueborder_valuetarget\_value \le border\_value the target is converted to 0
  • target_value>border_valuetarget\_value > border\_value the target is converted to 1

Default value

None

Supported processing units

CPU and GPU

border_count

Description

The number of splits for numerical features. Allowed values are integers from 1 to 65535 inclusively.

Default value

The default value depends on the processing unit type and other parameters:

  • CPU: 254
  • GPU in PairLogitPairwise and YetiRankPairwise modes: 32
  • GPU in all other modes: 128

Supported processing units

CPU and GPU

feature_border_type

Description

The quantization mode for numerical features.

Possible values:

  • Median
  • Uniform
  • UniformAndQuantiles
  • MaxLogSum
  • MinEntropy
  • GreedyLogSum

Default value

GreedyLogSum

Supported processing units

CPU and GPU

per_float_feature_quantization

Description

The quantization description for the specified feature or list of features.

Description format for a single feature:

FeatureId[:border_count=BorderCount][:nan_mode=BorderType][:border_type=border_selection_method]

Examples:

  •   per_float_feature_quantization = '0:border_count=1024')
    

    In this example, the feature indexed 0 has 1024 borders.

  •   per_float_feature_quantization = c('0:border_count=1024', '1:border_count=1024'
    

    In this example, features indexed 0 and 1 have 1024 borders.

Default value

None

Supported processing units

CPU and GPU

Multiclassification settings

classes_count

Description

The upper limit for the numeric class label. Defines the number of classes for multiclassification.

Only non-negative integers can be specified. The given integer should be greater than any of the label values.

If this parameter is specified the labels for all classes in the input dataset should be smaller than the given value

Default value

maximum class label + 1

Supported processing units

CPU and GPU

Performance settings

thread_count

Description

The number of threads to use for operation.

Optimizes the speed of execution. This parameter doesn't affect results.

Default value

-1 (the number of threads is equal to the number of processor cores)

Supported processing units

CPU and GPU

Processing units settings

task_type

Description

The processing unit type to use for training.

Possible values:

  • CPU
  • GPU

Default value

CPU

Supported processing units

CPU and GPU

devices

Description

IDs of the GPU devices to use for training (indices are zero-based).

Format

  • <unit ID> for one device (for example, 3)
  • <unit ID1>:<unit ID2>:..:<unit IDN> for multiple devices (for example, devices='0:1:3')
  • <unit ID1>-<unit IDN> for a range of devices (for example, devices='0-3')

Default value

-1 (all GPU devices are used if the corresponding processing unit type is selected)

Supported processing units

GPU

Output settings

logging_level

Description

The logging level to output to stdout.

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.

Default value

Verbose

Supported processing units

CPU and GPU

metric_period

Description

The frequency of iterations to calculate the values of objectives and metrics. The value should be a positive integer.

Default value

1

Supported processing units

CPU and GPU

verbose

Description

The frequency of iterations to print the information to stdout. The value of this parameter should be divisible by the value of the frequency of iterations to calculate the values of objectives and metrics.

Alert

Do not use this parameter with the --logging-level parameter.

Default value

1

Supported processing units

CPU and GPU

train_dir

Description

The directory for storing the files generated during training.

Default value

catboost_info

Supported processing units

CPU and GPU

model_size_reg

Description

The model size regularization coefficient. The larger the value, the smaller the model size. Refer to the Model size regularization coefficient section for details.

Possible values are in the range [0;inf)[0; \inf).

This regularization is needed only for models with categorical features (other models are small). Models with categorical features might weight tens of gigabytes or more if categorical features have a lot of values. If the value of the regularizer differs from zero, then the usage of categorical features or feature combinations with a lot of values has a penalty, so less of them are used in the resulting model.

Note that the resulting quality of the model can be affected. Set the value to 0 to turn off the model size optimization option.

Default value

Turned on and set to 0.5

Supported processing units

CPU and GPU

allow_writing_files

Description

Allow to write analytical and snapshot files during training.

If set to False, the snapshot and data visualization tools are unavailable.

Default value

TRUE

Supported processing units

CPU and GPU

save_snapshot

Description

Enable snapshotting for restoring the training progress after an interruption. If enabled, the default period for making snapshots is 600 seconds. Use the snapshot_interval parameter to change this period.

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.

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.

Note

This parameter is not supported in the params parameter of the cv function.

Default value

File can't be generated or read. If the value is omitted, the file name is
experiment.cbsnapshot.

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.

Default value

600

Supported processing units

CPU and GPU

CTR settings

simple_ctr

Description

Quantization settings for simple categorical features. Use this parameter to specify the principles for defining the class of the object for regression tasks. By default, it is considered that an object belongs to the positive class if its' label value is greater than the median of all label values of the dataset.

Format:

c(CtrType[:TargetBorderCount=BorderCount][:TargetBorderType=BorderType][:CtrBorderCount=Count][:CtrBorderType=Type][:Prior=num_1/denum_1]..[:Prior=num_N/denum_N])

Components:

  • CtrType — The method for transforming categorical features to numerical features.

    Supported methods for training on CPU:

    • Borders
    • Buckets
    • BinarizedTargetMeanValue
    • Counter

    Supported methods for training on GPU:

    • Borders
    • Buckets
    • FeatureFreq
    • FloatTargetMeanValue
  • TargetBorderCount — The number of borders for label value quantization. Only used for regression problems. Allowed values are integers from 1 to 255 inclusively. The default value is 1.

    This option is available for training on CPU only.

  • TargetBorderType — The quantization type for the label value. Only used for regression problems.

    Possible values:

    • Median
    • Uniform
    • UniformAndQuantiles
    • MaxLogSum
    • MinEntropy
    • GreedyLogSum

    By default, MinEntropy.

    This option is available for training on CPU only.

  • CtrBorderCount — The number of splits for categorical features. Allowed values are integers from 1 to 255 inclusively.

  • CtrBorderType — The quantization type for categorical features.

    Supported values for training on CPU:

    • Uniform

    Supported values for training on GPU:

    • Median
    • Uniform
    • UniformAndQuantiles
    • MaxLogSum
    • MinEntropy
    • GreedyLogSum
  • Prior — Use the specified priors during training (several values can be specified).

    Possible formats:

    • One number — Adds the value to the numerator.
    • Two slash-delimited numbers (for GPU only) — Use this format to set a fraction. The number is added to the numerator and the second is added to the denominator.

Examples

  •   simple_ctr='Borders:TargetBorderCount=2'
    

Two new features with differing quantization settings are generated. The first one concludes that an object belongs to the positive class when the label value exceeds the first border. The second one concludes that an object belongs to the positive class when the label value exceeds the second border.

For example, if the label takes three different values (0, 1, 2), the first border is 0.5 while the second one is 1.5.

  •   simple_ctr='Buckets:TargetBorderCount=2'
    

The number of features depends on the number of different labels. For example, three new features are generated if the label takes three different values (0, 1, 2). In this case, the first one concludes that an object belongs to the positive class when the value of the feature is equal to 0 or belongs to the bucket indexed 0. The second one concludes that an object belongs to the positive class when the value of the feature is equal to 1 or belongs to the bucket indexed 1, and so on.

Supported processing units

CPU and GPU

combinations_ctr

Description

Quantization settings for combinations of categorical features.

Format:

c(CtrType[:TargetBorderCount=BorderCount][:TargetBorderType=BorderType][:CtrBorderCount=Count][:CtrBorderType=Type][:Prior=num_1/denum_1]..[:Prior=num_N/denum_N])

Components:

  • CtrType — The method for transforming categorical features to numerical features.

    Supported methods for training on CPU:

    • Borders
    • Buckets
    • BinarizedTargetMeanValue
    • Counter

    Supported methods for training on GPU:

    • Borders
    • Buckets
    • FeatureFreq
    • FloatTargetMeanValue
  • TargetBorderCount — The number of borders for label value quantization. Only used for regression problems. Allowed values are integers from 1 to 255 inclusively. The default value is 1.

    This option is available for training on CPU only.

  • TargetBorderType — The quantization type for the label value. Only used for regression problems.

    Possible values:

    • Median
    • Uniform
    • UniformAndQuantiles
    • MaxLogSum
    • MinEntropy
    • GreedyLogSum

    By default, MinEntropy.

    This option is available for training on CPU only.

  • CtrBorderCount — The number of splits for categorical features. Allowed values are integers from 1 to 255 inclusively.

  • CtrBorderType — The quantization type for categorical features.

    Supported values for training on CPU:

    • Uniform

    Supported values for training on GPU:

    • Uniform
    • Median
  • Prior — Use the specified priors during training (several values can be specified).

    Possible formats:

    • One number — Adds the value to the numerator.
    • Two slash-delimited numbers (for GPU only) — Use this format to set a fraction. The number is added to the numerator and the second is added to the denominator.

Supported processing units

CPU and GPU

ctr_target_border_count

Description

The maximum number of borders to use in target quantization for categorical features that need it. Allowed values are integers from 1 to 255 inclusively.

The value of the TargetBorderCount component overrides this parameter if it is specified for one of the following parameters:

  • simple_ctr
  • combinations_ctr

Default value

Number_of_classes - 1 for Multiclassification problems when training on CPU, 1 otherwise

Supported processing units

CPU and GPU

counter_calc_method

Description

The method for calculating the Counter CTR type.

Possible values:

  • SkipTest — Objects from the validation dataset are not considered at all
  • Full — All objects from both learn and validation datasets are considered

Default value

SkipTest

Supported processing units

CPU and GPU

max_ctr_complexity

Description

The maximum number of features that can be combined.

Each resulting combination consists of one or more categorical features and can optionally contain binary features in the following form: numeric feature > value.

Default value

The default value depends on the processing unit type, combined features' type and the selected mode:

  • GPU for categorical features in MultiClass and MultiClassOneVsAll modes: 1
  • In all other cases: 4

Supported processing units

CPU and GPU

ctr_leaf_count_limit

Description

The maximum number of leaves with categorical features. If the quantity exceeds the specified value a part of leaves is discarded.

The leaves to be discarded are selected as follows:

  1. The leaves are sorted by the frequency of the values.
  2. The top N leaves are selected, where N is the value specified in the parameter.
  3. All leaves starting from N+1 are discarded.

This option reduces the resulting model size and the amount of memory required for training. Note that the resulting quality of the model can be affected.

Default value

None

The number of different category values is not limited

Supported processing units

CPU

store_all_simple_ctr

Description

Ignore categorical features, which are not used in feature combinations, when choosing candidates for exclusion.

There is no point in using this parameter without the --ctr-leaf-count-limitfor the Command-line version parameter.

Default value
False

Both simple features and feature combinations are taken in account when limiting the number of leafs with categorical features

Supported processing units

CPU

final_ctr_computation_mode

Description

Final CTR computation mode.

Possible values:

  • Default — Compute final CTRs for learn and validation datasets.
  • Skip — Do not compute final CTRs for learn and validation datasets. In this case, the resulting model can not be applied. This mode decreases the size of the resulting model. It can be useful for research purposes when only the metric values have to be calculated.

Default value

Default

Supported processing units

CPU and GPU

Examples

Load a dataset with numerical features, define the training parameters and start the training:

library(catboost)

dataset = matrix(c(1900,7,
                   1896,1,
                   1896,41),
                 nrow=3,
                 ncol=2,
                 byrow = TRUE)
label_values = c(0,1,1)

fit_params <- list(iterations = 100,
                   loss_function = 'Logloss')

pool = catboost.load_pool(dataset, label = label_values)

model <- catboost.train(pool, params = fit_params)

Load a dataset with numerical features, define the training parameters and start the training on GPU:

library(catboost)

dataset = matrix(c(1900,7,
                   1896,1,
                   1896,41),
                 nrow=3,
                 ncol=2,
                 byrow = TRUE)
label_values = c(0,1,1)

fit_params <- list(iterations = 100,
                   loss_function = 'Logloss',
                   task_type = 'GPU')

pool = catboost.load_pool(dataset, label = label_values)

model <- catboost.train(pool, params = fit_params)

Load a dataset with numerical and categorical features, define the training parameters and start the training:

library(catboost)

countries = c('RUS','USA','SUI')
years = c(1900,1896,1896)
phone_codes = c(7,1,41)
domains = c('ru','us','ch')

dataset = data.frame(countries, years, phone_codes, domains)

label_values = c(0,1,1)

fit_params <- list(iterations = 100,
                   loss_function = 'Logloss',
                   ignored_features = c(4,9),
                   border_count = 32,
                   depth = 5,
                   learning_rate = 0.03,
                   l2_leaf_reg = 3.5)

pool = catboost.load_pool(dataset, label = label_values, cat_features = c(0,3))

model <- catboost.train(pool, params = fit_params)

Load a dataset with numerical and categorical features, define the training parameters and start the training on GPU:

library(catboost)

countries = c('RUS','USA','SUI')
years = c(1900,1896,1896)
phone_codes = c(7,1,41)
domains = c('ru','us','ch')

dataset = data.frame(countries, years, phone_codes, domains)

label_values = c(0,1,1)

fit_params <- list(iterations = 100,
                   loss_function = 'Logloss',
                   ignored_features = c(4,9),
                   border_count = 32,
                   depth = 5,
                   learning_rate = 0.03,
                   l2_leaf_reg = 3.5,
                   task_type = 'GPU')

pool = catboost.load_pool(dataset, label = label_values, cat_features = c(0,3))

model <- catboost.train(pool, params = fit_params)