ā¹ļø Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| URL | https://catboost.ai/docs/en/concepts/parameter-tuning | |||||||||
| Last Crawled | 2026-04-22 07:43:37 (1 day ago) | |||||||||
| First Indexed | 2024-11-18 16:12:15 (1 year ago) | |||||||||
| HTTP Status Code | 200 | |||||||||
| Content | ||||||||||
| Meta Title | Parameter tuning | CatBoost | |||||||||
| Meta Description | CatBoost provides a flexible interface for parameter tuning and can be configured to suit different tasks. | |||||||||
| Meta Canonical | null | |||||||||
| Boilerpipe Text | CatBoost provides a flexible interface for parameter tuning and can be configured to suit different tasks.
This section contains some tips on the possible parameter settings.
One-hot encoding
Warning
Do not use one-hot encoding during preprocessing. This affects both the training speed and the resulting quality.
Sometimes when categorical features don't have a lot of values, one-hot encoding works well.
Usually one-hot encoding does not significantly improve the quality of the model. But if it is required, use the inbuilt parameters instead of preprocessing the dataset.
Parameters
Command-line version parameters:
--one-hot-max-size
Python parameters:
one_hot_max_size
R parameters:
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.
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
Number of trees
It is recommended to check that there is no obvious underfitting or overfitting before tuning any other parameters. In order to do this it is necessary to analyze the metric value on the validation dataset and select the appropriate number of iterations.
This can be done by setting the number ofĀ
iterations
to a large value, using theĀ
overfitting detector
parameters and turning the
use best model
options on. In this case the resulting model contains only the first
k
best iterations, where
k
is the iteration with the best loss value on the validation dataset.
Also, the metric for choosing the best model may differ from the one used for optimizing the objective value. For example, it is possible to set the optimized function toĀ Logloss and use the AUC function for the overfitting detector. To do so, use the
evaluation metric
parameter.
Parameters
Command-line version parameters:
-i
,
--iterations
Python parameters:
--iterations
R parameters:
--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.
Command-line version parameters:
--use-best-model
Python parameters:
--use-best-model
R parameters:
--use-best-model
Description
If this parameter is set, the number of trees that are saved in the resulting model is defined as follows:
Build the number of trees defined by the training parameters.
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.
Command-line version parameters:
--eval-metric
Python parameters:
--eval-metric
R parameters:
--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
Examples:
R2
Quantile:alpha=0.3
Command-line version parameters:
Overfitting detection settings
Command-line version parameters:
--od-type
Python parameters:
od_type
R parameters:
od_type
Description
The type of the overfitting detector to use.
Possible values:
IncToDec
Iter
Command-line version parameters:
--od-pval
Python parameters:
od_pval
R parameters:
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
[
1
0
ā
10
;
1
0
ā
2
]
[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.
Command-line version parameters:
--od-wait
Python parameters:
od_wait
R parameters:
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.
Learning rate
This setting is used for reducing the gradient step. It affects the overall time of training: the smaller the value, the more iterations are required for training. Choose the value based on the performance expectations.
By default, the learning rate is defined automatically based on the dataset properties and the number of iterations. The automatically defined value should be close to the optimal one.
Possible ways of adjusting the learning rate depending on the overfitting results:
There is no overfitting on the last iterations of training (the training does not converge)Ā ā increase the learning rate.
Overfitting is detectedĀ ā decrease the learning rate.
Parameters
Command-line version parameters:
-w
,
--learning-rate
Python parameters:
learning_rate
R parameters:
learning_rate
Description
The learning rate. Used for reducing the gradient step.
Tree depth
In most cases, the optimal depth ranges from 4 to 10. Values in the range from 6 to 10 are recommended.
Note
The maximum depth of the trees is limited toĀ 8 for pairwise modes (YetiRank, PairLogitPairwise and QueryCrossEntropy) when the training is performed on GPU.
Parameters
Command-line version parameters:
-n
,
--depth
Python parameters:
depth
R parameters:
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 8 pairwise modes (YetiRank, PairLogitPairwise and QueryCrossEntropy) and up to Ā 16 for all other loss functions.
L2 regularization
Try different values for the regularizer to find the best possible.
Parameters
Command-line version parameters:
--l2-leaf-reg
Python parameters:
l2_leaf_reg
R parameters:
l2_leaf_reg
Description
Coefficient at the L2 regularization term of the cost function.
Any positive value is allowed.
Random strength
Try setting different values for theĀ
random_strength
parameter.
Parameters
Command-line version parameters:
--random-strength
Python parameters:
random_strength
R parameters:
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
Bagging temperature
Try setting different values for the
bagging_temperature
parameter
Parameters
Command-line version parameters:
--bagging-temperature
Python parameters:
bagging_temperature
R parameters:
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.
Border count
The number of splits for numerical features.
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
The value of this parameter significantly impacts the speed of training on GPU. The smaller the value, the faster the training is performed (refer to theĀ
Number of splits for numerical features
section for details).
128 splits are enough for many datasets. However, try to set the value of this parameter to 254 when training on GPU if the best possible quality is required.
The value of this parameter does not significantly impact the speed of training on CPU. Try to set it to 254 for the best possible quality.
Parameters
Command-line version parameters:
-x
,
--border-count
Python parameters:
border_count
Alias:
max_bin
R parameters:
border_count
Description
Recommended values are up to 255. Larger values slow down the training.
The number of splits for numerical features. Allowed values are integers from 1 to 65535 inclusively.
Internal dataset order
Use this option if the objects in your dataset are given in the required order. In this case, random permutations are not performed during theĀ
Transforming categorical features to numerical features
andĀ
Choosing the tree structure
stages.
Parameters
Command-line version parameters:
--has-time
Python parameters:
--has-time
R parameters:
--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
.
Tree growing policy
By default, CatBoost uses symmetric trees, which are built if the growing policy is set to SymmetricTree.
Such trees are 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.
Symmetric trees have a very good prediction speed (roughly 10 times faster than non-symmetric trees) and give better quality in many cases.
However, in some cases, other tree growing strategies can give better results than growing symmetric trees.
Try to analyze the results obtained with different growing trees strategies.
Specifics: Symmetric trees, that are used by default, can be applied much faster (up to 10 times faster).
Parameters
Command-line version parameters:
--grow-policy
Python parameters:
grow_policy
R parameters:
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.
Command-line version parameters:
--min-data-in-leaf
Python parameters:
min_data_in_leaf
Alias:
min_child_samples
R parameters:
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.
Command-line version parameters:
--max-leaves
Python parameters:
max_leaves
Alias:
num_leaves
R parameters:
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.
Golden features
If the dataset has a feature, which is a strong predictor of the result, the pre-quantisation of this feature may decrease the information that the model can get from it. It is recommended to use an increased number of borders (1024) for this feature.
Note
An increased number of borders should not be set for all features. It is recommended to set it for one or two golden features.
Command-line
Python
R
Parameter
Description
--per-float-feature-quantization
A semicolon separated list of quantization descriptions.
Format:
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 0:border_count=1024;1:border_count=1024
In this example, features indexed 0 and 1 have 1024 borders.
Parameter
Description
per_float_feature_quantization
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=[
'0:border_count=1024'
,
'1:border_count=1024'
]
In this example, features indexed 0 and 1 have 1024 borders.
Parameter
Description
per_float_feature_quantization
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.
Methods for hyperparameter search
The Python package provides Grid and Randomized search methods for searching optimal parameter values for training the model with the given dataset.
Parameters
Class
Method
Description
CatBoost
grid_search
A simple grid search over specified parameter values for a model.
CatBoost
randomized_search
A simple randomized search on hyperparameters.
CatBoostClassifier
grid_search
A simple grid search over specified parameter values for a model.
CatBoostClassifier
randomized_search
A simple randomized search on hyperparameters.
CatBoostRegressor
grid_search
A simple grid search over specified parameter values for a model.
CatBoostRegressor
randomized_search
A simple randomized search on hyperparameters.
Methods for hyperparameter search by optuna
Optuna is a famous hyperparameter optimization framework.
Optuna enables efficient hyperparameter optimization by adopting state-of-the-art algorithms for sampling hyperparameters and pruning efficiently unpromising trials.
Catboost supports to stop unpromising trial of hyperparameter by callbacking after iteration functionality.
Pull Request
The following is an optuna example that demonstrates a pruner for CatBoost.
Example | |||||||||
| Markdown | [](https://catboost.ai/ "CatBoost")
- Installation
- [Overview](https://catboost.ai/docs/en/concepts/en/concepts/installation)
- Python package installation
- CatBoost for Apache Spark installation
- R package installation
- Command-line version binary
- Build from source
- Key Features
- Training parameters
- Python package
- CatBoost for Apache Spark
- R package
- Command-line version
- Applying models
- Objectives and metrics
- Model analysis
- Data format description
- [Parameter tuning](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning)
- [Speeding up the training](https://catboost.ai/docs/en/concepts/en/concepts/speed-up-training)
- Data visualization
- Algorithm details
- [FAQ](https://catboost.ai/docs/en/concepts/en/concepts/faq)
- Educational materials
- [Development and contributions](https://catboost.ai/docs/en/concepts/en/concepts/development-and-contributions)
- [Contacts](https://catboost.ai/docs/en/concepts/en/concepts/contacts)
Parameter tuning
## In this article:
- [One-hot encoding](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#one-hot-enc)
- [Number of trees](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#trees-number)
- [Learning rate](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#learning-rate)
- [Tree depth](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#tree-depth)
- [L2 regularization](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#l2-reg)
- [Random strength](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#rand-str)
- [Bagging temperature](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#bagg-temp)
- [Border count](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#border-count)
- [Internal dataset order](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#internal-dataset-order)
- [Tree growing policy](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#tree-growing-policy)
- [Golden features](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#golden-features)
- [Methods for hyperparameter search](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#defining-optimal-parameter-values)
- [Methods for hyperparameter search by optuna](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#methods-for-hyperparameter-search-by-optuna)
# Parameter tuning
- [One-hot encoding](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#one-hot-enc)
- [Number of trees](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#trees-number)
- [Learning rate](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#learning-rate)
- [Tree depth](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#tree-depth)
- [L2 regularization](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#l2-reg)
- [Random strength](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#rand-str)
- [Bagging temperature](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#bagg-temp)
- [Border count](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#border-count)
- [Internal dataset order](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#internal-dataset-order)
- [Tree growing policy](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#tree-growing-policy)
- [Golden features](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#golden-features)
- [Methods for hyperparameter search](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#defining-optimal-parameter-values)
- [Methods for hyperparameter search by optuna](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning#methods-for-hyperparameter-search-by-optuna)
CatBoost provides a flexible interface for parameter tuning and can be configured to suit different tasks.
This section contains some tips on the possible parameter settings.
## One-hot encoding
Warning
Do not use one-hot encoding during preprocessing. This affects both the training speed and the resulting quality.
Sometimes when categorical features don't have a lot of values, one-hot encoding works well.
Usually one-hot encoding does not significantly improve the quality of the model. But if it is required, use the inbuilt parameters instead of preprocessing the dataset.
Parameters
**Command-line version parameters:** `--one-hot-max-size`
**Python parameters:** `one_hot_max_size`
**R parameters:** `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.
**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](https://catboost.ai/docs/en/concepts/en/concepts/loss-functions-ranking) mode
- 2 if none of the conditions above is met
## Number of trees
It is recommended to check that there is no obvious underfitting or overfitting before tuning any other parameters. In order to do this it is necessary to analyze the metric value on the validation dataset and select the appropriate number of iterations.
This can be done by setting the number of [iterations](https://catboost.ai/docs/en/concepts/en/references/training-parameters/common#iterations) to a large value, using the [overfitting detector](https://catboost.ai/docs/en/concepts/en/concepts/overfitting-detector) parameters and turning the [use best model](https://catboost.ai/docs/en/concepts/en/references/training-parameters/common#use_best_model) options on. In this case the resulting model contains only the first `k` best iterations, where `k` is the iteration with the best loss value on the validation dataset.
Also, the metric for choosing the best model may differ from the one used for optimizing the objective value. For example, it is possible to set the optimized function to Logloss and use the AUC function for the overfitting detector. To do so, use the [evaluation metric](https://catboost.ai/docs/en/concepts/en/references/training-parameters/common#eval_metric) parameter.
Parameters
**Command-line version parameters:** `-i`, `--iterations`
**Python parameters:** `--iterations`
**R parameters:** `--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.
**Command-line version parameters:** `--use-best-model`
**Python parameters:** `--use-best-model`
**R parameters:** `--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.
**Command-line version parameters:** `--eval-metric`
**Python parameters:** `--eval-metric`
**R parameters:** `--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](https://catboost.ai/docs/en/concepts/en/concepts/loss-functions) section for details on each metric).
Format:
```
<Metric>[:<parameter 1>=<value>;..;<parameter N>=<value>]
```
[Supported metrics](https://catboost.ai/docs/en/concepts/en/references/eval-metric__supported-metrics)
Examples:
```
R2
```
```
Quantile:alpha=0.3
```
**Command-line version parameters:** **Overfitting detection settings**
**Command-line version parameters:** `--od-type`
**Python parameters:** `od_type`
**R parameters:** `od_type`
#### Description
The type of the overfitting detector to use.
Possible values:
- IncToDec
- Iter
**Command-line version parameters:** `--od-pval`
**Python parameters:** `od_pval`
**R parameters:** `od_pval`
#### Description
The threshold for the IncToDec [overfitting detector](https://catboost.ai/docs/en/concepts/en/concepts/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 \[ 1 0 ā 10 ; 1 0 ā 2 \] \[10^{ā10}; 10^{-2}\] \[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.
**Command-line version parameters:** `--od-wait`
**Python parameters:** `od_wait`
**R parameters:** `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.
## Learning rate
This setting is used for reducing the gradient step. It affects the overall time of training: the smaller the value, the more iterations are required for training. Choose the value based on the performance expectations.
By default, the learning rate is defined automatically based on the dataset properties and the number of iterations. The automatically defined value should be close to the optimal one.
Possible ways of adjusting the learning rate depending on the overfitting results:
- There is no overfitting on the last iterations of training (the training does not converge) ā increase the learning rate.
- Overfitting is detected ā decrease the learning rate.
Parameters
**Command-line version parameters:** `-w`, `--learning-rate`
**Python parameters:** `learning_rate`
**R parameters:** `learning_rate`
#### Description
The learning rate. Used for reducing the gradient step.
## Tree depth
In most cases, the optimal depth ranges from 4 to 10. Values in the range from 6 to 10 are recommended.
Note
The maximum depth of the trees is limited to 8 for pairwise modes (YetiRank, PairLogitPairwise and QueryCrossEntropy) when the training is performed on GPU.
Parameters
**Command-line version parameters:** `-n`, `--depth`
**Python parameters:** `depth`
**R parameters:** `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 8 pairwise modes (YetiRank, PairLogitPairwise and QueryCrossEntropy) and up to 16 for all other loss functions.
## L2 regularization
Try different values for the regularizer to find the best possible.
Parameters
**Command-line version parameters:** `--l2-leaf-reg`
**Python parameters:** `l2_leaf_reg`
**R parameters:** `l2_leaf_reg`
#### Description
Coefficient at the L2 regularization term of the cost function.
Any positive value is allowed.
## Random strength
Try setting different values for the `random_strength` parameter.
Parameters
**Command-line version parameters:** `--random-strength`
**Python parameters:** `random_strength`
**R parameters:** `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
## Bagging temperature
Try setting different values for the `bagging_temperature` parameter
Parameters
**Command-line version parameters:** `--bagging-temperature`
**Python parameters:** `bagging_temperature`
**R parameters:** `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) \[0;inf). The higher the value the more aggressive the bagging is.
This parameter can be used if the selected bootstrap type is Bayesian.
## Border count
The number of splits for numerical features.
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
The value of this parameter significantly impacts the speed of training on GPU. The smaller the value, the faster the training is performed (refer to the [Number of splits for numerical features](https://catboost.ai/docs/en/concepts/en/concepts/speed-up-training) section for details).
128 splits are enough for many datasets. However, try to set the value of this parameter to 254 when training on GPU if the best possible quality is required.
The value of this parameter does not significantly impact the speed of training on CPU. Try to set it to 254 for the best possible quality.
Parameters
**Command-line version parameters:** `-x`, `--border-count`
**Python parameters:** `border_count`
*Alias:*`max_bin`
**R parameters:** `border_count`
#### Description
Recommended values are up to 255. Larger values slow down the training.
The number of splits for numerical features. Allowed values are integers from 1 to 65535 inclusively.
## Internal dataset order
Use this option if the objects in your dataset are given in the required order. In this case, random permutations are not performed during the [Transforming categorical features to numerical features](https://catboost.ai/docs/en/concepts/en/concepts/algorithm-main-stages_cat-to-numberic) and [Choosing the tree structure](https://catboost.ai/docs/en/concepts/en/concepts/algorithm-main-stages_choose-tree-structure) stages.
Parameters
**Command-line version parameters:** `--has-time`
**Python parameters:** `--has-time`
**R parameters:** `--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](https://catboost.ai/docs/en/concepts/en/concepts/algorithm-main-stages_cat-to-numberic) and [Choosing the tree structure](https://catboost.ai/docs/en/concepts/en/concepts/algorithm-main-stages_choose-tree-structure) stages).
The Timestamp column type is used to determine the order of objects if specified in the [input data](https://catboost.ai/docs/en/concepts/en/concepts/input-data).
## Tree growing policy
By default, CatBoost uses symmetric trees, which are built if the growing policy is set to SymmetricTree.
Such trees are 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.
Symmetric trees have a very good prediction speed (roughly 10 times faster than non-symmetric trees) and give better quality in many cases.
However, in some cases, other tree growing strategies can give better results than growing symmetric trees.
Try to analyze the results obtained with different growing trees strategies.
Specifics: Symmetric trees, that are used by default, can be applied much faster (up to 10 times faster).
Parameters
**Command-line version parameters:** `--grow-policy`
**Python parameters:** `grow_policy`
**R parameters:** `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.
**Command-line version parameters:** `--min-data-in-leaf`
**Python parameters:** `min_data_in_leaf`
*Alias:*`min_child_samples`
**R parameters:** `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.
**Command-line version parameters:** `--max-leaves`
**Python parameters:** `max_leaves`
*Alias:*`num_leaves`
**R parameters:** `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.
## Golden features
If the dataset has a feature, which is a strong predictor of the result, the pre-quantisation of this feature may decrease the information that the model can get from it. It is recommended to use an increased number of borders (1024) for this feature.
Note
An increased number of borders should not be set for all features. It is recommended to set it for one or two golden features.
Command-line
Python
R
| Parameter | Description |
|---|---|
| `--per-float-feature-quantization` | A semicolon separated list of quantization descriptions. Format: `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 0:border_count=1024;1:border_count=1024
```
In this example, features indexed 0 and 1 have 1024 borders.
| Parameter | Description |
|---|---|
| `per_float_feature_quantization` | 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=['0:border_count=1024', '1:border_count=1024']
```
In this example, features indexed 0 and 1 have 1024 borders.
| Parameter | Description |
|---|---|
| `per_float_feature_quantization` | 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.
## Methods for hyperparameter search
The Python package provides Grid and Randomized search methods for searching optimal parameter values for training the model with the given dataset.
Parameters
| Class | Method | Description |
|---|---|---|
| [CatBoost](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboost) | [grid\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboost_grid_search) | A simple grid search over specified parameter values for a model. |
| [CatBoost](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboost) | [randomized\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboost_randomized_search) | A simple randomized search on hyperparameters. |
| [CatBoostClassifier](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier) | [grid\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_grid_search) | A simple grid search over specified parameter values for a model. |
| [CatBoostClassifier](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier) | [randomized\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_randomized_search) | A simple randomized search on hyperparameters. |
| [CatBoostRegressor](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostregressor) | [grid\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostregressor_grid_search) | A simple grid search over specified parameter values for a model. |
| [CatBoostRegressor](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostregressor) | [randomized\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostregressor_randomized_search) | A simple randomized search on hyperparameters. |
## Methods for hyperparameter search by optuna
Optuna is a famous hyperparameter optimization framework.
Optuna enables efficient hyperparameter optimization by adopting state-of-the-art algorithms for sampling hyperparameters and pruning efficiently unpromising trials.
Catboost supports to stop unpromising trial of hyperparameter by callbacking after iteration functionality. [Pull Request](https://github.com/catboost/catboost/pull/1697/files#diff-ccca44461ac6b094190f29fec157a227996e226ea483213680dd0a152cd412eaR9679)
The following is an optuna example that demonstrates a pruner for CatBoost. [Example](https://github.com/optuna/optuna-examples/blob/main/catboost/catboost_pruning.py)
### Was the article helpful?
Yes
No
Previous
[ROC curve points](https://catboost.ai/docs/en/concepts/en/concepts/output-data_roc-curve-points)
Next
[Speeding up the training](https://catboost.ai/docs/en/concepts/en/concepts/speed-up-training)
 | |||||||||
| Readable Markdown | CatBoost provides a flexible interface for parameter tuning and can be configured to suit different tasks.
This section contains some tips on the possible parameter settings.
## One-hot encoding
Warning
Do not use one-hot encoding during preprocessing. This affects both the training speed and the resulting quality.
Sometimes when categorical features don't have a lot of values, one-hot encoding works well.
Usually one-hot encoding does not significantly improve the quality of the model. But if it is required, use the inbuilt parameters instead of preprocessing the dataset.
Parameters
**Command-line version parameters:** `--one-hot-max-size`
**Python parameters:** `one_hot_max_size`
**R parameters:** `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.
**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](https://catboost.ai/docs/en/concepts/loss-functions-ranking) mode
- 2 if none of the conditions above is met
## Number of trees
It is recommended to check that there is no obvious underfitting or overfitting before tuning any other parameters. In order to do this it is necessary to analyze the metric value on the validation dataset and select the appropriate number of iterations.
This can be done by setting the number of [iterations](https://catboost.ai/docs/en/references/training-parameters/common#iterations) to a large value, using the [overfitting detector](https://catboost.ai/docs/en/concepts/overfitting-detector) parameters and turning the [use best model](https://catboost.ai/docs/en/references/training-parameters/common#use_best_model) options on. In this case the resulting model contains only the first `k` best iterations, where `k` is the iteration with the best loss value on the validation dataset.
Also, the metric for choosing the best model may differ from the one used for optimizing the objective value. For example, it is possible to set the optimized function to Logloss and use the AUC function for the overfitting detector. To do so, use the [evaluation metric](https://catboost.ai/docs/en/references/training-parameters/common#eval_metric) parameter.
Parameters
**Command-line version parameters:** `-i`, `--iterations`
**Python parameters:** `--iterations`
**R parameters:** `--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.
**Command-line version parameters:** `--use-best-model`
**Python parameters:** `--use-best-model`
**R parameters:** `--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.
**Command-line version parameters:** `--eval-metric`
**Python parameters:** `--eval-metric`
**R parameters:** `--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](https://catboost.ai/docs/en/concepts/loss-functions) section for details on each metric).
Format:
```
<Metric>[:<parameter 1>=<value>;..;<parameter N>=<value>]
```
[Supported metrics](https://catboost.ai/docs/en/references/eval-metric__supported-metrics)
Examples:
```
R2
```
```
Quantile:alpha=0.3
```
**Command-line version parameters:** **Overfitting detection settings**
**Command-line version parameters:** `--od-type`
**Python parameters:** `od_type`
**R parameters:** `od_type`
#### Description
The type of the overfitting detector to use.
Possible values:
- IncToDec
- Iter
**Command-line version parameters:** `--od-pval`
**Python parameters:** `od_pval`
**R parameters:** `od_pval`
#### Description
The threshold for the IncToDec [overfitting detector](https://catboost.ai/docs/en/concepts/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 \[ 1 0 ā 10 ; 1 0 ā 2 \] \[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.
**Command-line version parameters:** `--od-wait`
**Python parameters:** `od_wait`
**R parameters:** `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.
## Learning rate
This setting is used for reducing the gradient step. It affects the overall time of training: the smaller the value, the more iterations are required for training. Choose the value based on the performance expectations.
By default, the learning rate is defined automatically based on the dataset properties and the number of iterations. The automatically defined value should be close to the optimal one.
Possible ways of adjusting the learning rate depending on the overfitting results:
- There is no overfitting on the last iterations of training (the training does not converge) ā increase the learning rate.
- Overfitting is detected ā decrease the learning rate.
Parameters
**Command-line version parameters:** `-w`, `--learning-rate`
**Python parameters:** `learning_rate`
**R parameters:** `learning_rate`
#### Description
The learning rate. Used for reducing the gradient step.
## Tree depth
In most cases, the optimal depth ranges from 4 to 10. Values in the range from 6 to 10 are recommended.
Note
The maximum depth of the trees is limited to 8 for pairwise modes (YetiRank, PairLogitPairwise and QueryCrossEntropy) when the training is performed on GPU.
Parameters
**Command-line version parameters:** `-n`, `--depth`
**Python parameters:** `depth`
**R parameters:** `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 8 pairwise modes (YetiRank, PairLogitPairwise and QueryCrossEntropy) and up to 16 for all other loss functions.
## L2 regularization
Try different values for the regularizer to find the best possible.
Parameters
**Command-line version parameters:** `--l2-leaf-reg`
**Python parameters:** `l2_leaf_reg`
**R parameters:** `l2_leaf_reg`
#### Description
Coefficient at the L2 regularization term of the cost function.
Any positive value is allowed.
## Random strength
Try setting different values for the `random_strength` parameter.
Parameters
**Command-line version parameters:** `--random-strength`
**Python parameters:** `random_strength`
**R parameters:** `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
## Bagging temperature
Try setting different values for the `bagging_temperature` parameter
Parameters
**Command-line version parameters:** `--bagging-temperature`
**Python parameters:** `bagging_temperature`
**R parameters:** `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.
## Border count
The number of splits for numerical features.
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
The value of this parameter significantly impacts the speed of training on GPU. The smaller the value, the faster the training is performed (refer to the [Number of splits for numerical features](https://catboost.ai/docs/en/concepts/speed-up-training) section for details).
128 splits are enough for many datasets. However, try to set the value of this parameter to 254 when training on GPU if the best possible quality is required.
The value of this parameter does not significantly impact the speed of training on CPU. Try to set it to 254 for the best possible quality.
Parameters
**Command-line version parameters:** `-x`, `--border-count`
**Python parameters:** `border_count`
*Alias:*`max_bin`
**R parameters:** `border_count`
#### Description
Recommended values are up to 255. Larger values slow down the training.
The number of splits for numerical features. Allowed values are integers from 1 to 65535 inclusively.
## Internal dataset order
Use this option if the objects in your dataset are given in the required order. In this case, random permutations are not performed during the [Transforming categorical features to numerical features](https://catboost.ai/docs/en/concepts/algorithm-main-stages_cat-to-numberic) and [Choosing the tree structure](https://catboost.ai/docs/en/concepts/algorithm-main-stages_choose-tree-structure) stages.
Parameters
**Command-line version parameters:** `--has-time`
**Python parameters:** `--has-time`
**R parameters:** `--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](https://catboost.ai/docs/en/concepts/algorithm-main-stages_cat-to-numberic) and [Choosing the tree structure](https://catboost.ai/docs/en/concepts/algorithm-main-stages_choose-tree-structure) stages).
The Timestamp column type is used to determine the order of objects if specified in the [input data](https://catboost.ai/docs/en/concepts/input-data).
## Tree growing policy
By default, CatBoost uses symmetric trees, which are built if the growing policy is set to SymmetricTree.
Such trees are 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.
Symmetric trees have a very good prediction speed (roughly 10 times faster than non-symmetric trees) and give better quality in many cases.
However, in some cases, other tree growing strategies can give better results than growing symmetric trees.
Try to analyze the results obtained with different growing trees strategies.
Specifics: Symmetric trees, that are used by default, can be applied much faster (up to 10 times faster).
Parameters
**Command-line version parameters:** `--grow-policy`
**Python parameters:** `grow_policy`
**R parameters:** `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.
**Command-line version parameters:** `--min-data-in-leaf`
**Python parameters:** `min_data_in_leaf`
*Alias:*`min_child_samples`
**R parameters:** `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.
**Command-line version parameters:** `--max-leaves`
**Python parameters:** `max_leaves`
*Alias:*`num_leaves`
**R parameters:** `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.
## Golden features
If the dataset has a feature, which is a strong predictor of the result, the pre-quantisation of this feature may decrease the information that the model can get from it. It is recommended to use an increased number of borders (1024) for this feature.
Note
An increased number of borders should not be set for all features. It is recommended to set it for one or two golden features.
Command-line
Python
R
| Parameter | Description |
|---|---|
| `--per-float-feature-quantization` | A semicolon separated list of quantization descriptions. Format: `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 0:border_count=1024;1:border_count=1024
```
In this example, features indexed 0 and 1 have 1024 borders.
| Parameter | Description |
|---|---|
| `per_float_feature_quantization` | 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=['0:border_count=1024', '1:border_count=1024']
```
In this example, features indexed 0 and 1 have 1024 borders.
| Parameter | Description |
|---|---|
| `per_float_feature_quantization` | 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.
## Methods for hyperparameter search
The Python package provides Grid and Randomized search methods for searching optimal parameter values for training the model with the given dataset.
Parameters
| Class | Method | Description |
|---|---|---|
| [CatBoost](https://catboost.ai/docs/en/concepts/python-reference_catboost) | [grid\_search](https://catboost.ai/docs/en/concepts/python-reference_catboost_grid_search) | A simple grid search over specified parameter values for a model. |
| [CatBoost](https://catboost.ai/docs/en/concepts/python-reference_catboost) | [randomized\_search](https://catboost.ai/docs/en/concepts/python-reference_catboost_randomized_search) | A simple randomized search on hyperparameters. |
| [CatBoostClassifier](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier) | [grid\_search](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_grid_search) | A simple grid search over specified parameter values for a model. |
| [CatBoostClassifier](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier) | [randomized\_search](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_randomized_search) | A simple randomized search on hyperparameters. |
| [CatBoostRegressor](https://catboost.ai/docs/en/concepts/python-reference_catboostregressor) | [grid\_search](https://catboost.ai/docs/en/concepts/python-reference_catboostregressor_grid_search) | A simple grid search over specified parameter values for a model. |
| [CatBoostRegressor](https://catboost.ai/docs/en/concepts/python-reference_catboostregressor) | [randomized\_search](https://catboost.ai/docs/en/concepts/python-reference_catboostregressor_randomized_search) | A simple randomized search on hyperparameters. |
## Methods for hyperparameter search by optuna
Optuna is a famous hyperparameter optimization framework.
Optuna enables efficient hyperparameter optimization by adopting state-of-the-art algorithms for sampling hyperparameters and pruning efficiently unpromising trials.
Catboost supports to stop unpromising trial of hyperparameter by callbacking after iteration functionality. [Pull Request](https://github.com/catboost/catboost/pull/1697/files#diff-ccca44461ac6b094190f29fec157a227996e226ea483213680dd0a152cd412eaR9679)
The following is an optuna example that demonstrates a pruner for CatBoost. [Example](https://github.com/optuna/optuna-examples/blob/main/catboost/catboost_pruning.py) | |||||||||
| ML Classification | ||||||||||
| ML Categories |
Raw JSON{
"/Computers_and_Electronics": 969,
"/Computers_and_Electronics/Software": 880,
"/Computers_and_Electronics/Software/Software_Utilities": 760
} | |||||||||
| ML Page Types |
Raw JSON{
"/Article": 501,
"/Article/Tutorial_or_Guide": 486
} | |||||||||
| ML Intent Types |
Raw JSON{
"Informational": 985
} | |||||||||
| Content Metadata | ||||||||||
| Language | en | |||||||||
| Author | null | |||||||||
| Publish Time | not set | |||||||||
| Original Publish Time | 2024-11-18 16:12:15 (1 year ago) | |||||||||
| Republished | No | |||||||||
| Word Count (Total) | 2,527 | |||||||||
| Word Count (Content) | 2,354 | |||||||||
| Links | ||||||||||
| External Links | 2 | |||||||||
| Internal Links | 27 | |||||||||
| Technical SEO | ||||||||||
| Meta Nofollow | No | |||||||||
| Meta Noarchive | No | |||||||||
| JS Rendered | No | |||||||||
| Redirect Target | null | |||||||||
| Performance | ||||||||||
| Download Time (ms) | 947 | |||||||||
| TTFB (ms) | 723 | |||||||||
| Download Size (bytes) | 266,835 | |||||||||
| Shard | 169 (laksa) | |||||||||
| Root Hash | 17435841955170310369 | |||||||||
| Unparsed URL | ai,catboost!/docs/en/concepts/parameter-tuning s443 | |||||||||