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

# Implemented metrics

CatBoost provides built-in metrics for various machine learning problems. These functions can be used for model optimization or reference purposes. See the [Objectives and metrics](https://catboost.ai/docs/en/concepts/loss-functions.md) section for details on the calculation principles.

<!-- source: en/_includes/work_src/reusage-common-phrases/choose-the-required-implementation-for-more-details.md -->
Choose the implementation for more details.
<!-- endsource: en/_includes/work_src/reusage-common-phrases/choose-the-required-implementation-for-more-details.md -->

- [python](#python)
- [r-package](#r-package)
- [cli](#command-line-version)

## Python package

<!-- source: en/_includes/work_src/reusage-common-phrases/classes-params-can-be-used-for-train.md -->
The following parameters can be set for the corresponding classes and are used when the model is trained.
<!-- endsource: en/_includes/work_src/reusage-common-phrases/classes-params-can-be-used-for-train.md -->

### Parameters for trained model

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

#### loss-function

<!-- source: en/_includes/work_src/reusage/loss-function-short-desc.md -->
The [metric](https://catboost.ai/docs/en/concepts/loss-functions.md) 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](https://catboost.ai/docs/en/concepts/loss-functions.md) section for details on each metric).
<!-- endsource: en/_includes/work_src/reusage/loss-function-short-desc.md -->

<!-- source: en/_includes/work_src/reusage/loss-function-format.md -->
Format:
```
<Metric>[:<parameter 1>=<value>;..;<parameter N>=<value>]
```
<!-- endsource: en/_includes/work_src/reusage/loss-function-format.md -->

{% cut "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

{% endcut %}

A custom python object can also be set as the value of this parameter (see an [example](https://catboost.ai/docs/en/concepts/python-usages-examples.md)).

<!-- source: en/_includes/work_src/reusage/loss-function--example.md -->
For example, use the following construction to calculate the value of Quantile with the coefficient $\alpha = 0.1$:
```
Quantile:alpha=0.1
```
<!-- endsource: en/_includes/work_src/reusage/loss-function--example.md -->


#### custom_metric

<!-- source: en/_includes/work_src/reusage/custom-loss--basic.md -->
[Metric](https://catboost.ai/docs/en/concepts/loss-functions.md) 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](https://catboost.ai/docs/en/concepts/loss-functions.md) section for details on each metric).
<!-- endsource: en/_includes/work_src/reusage/custom-loss--basic.md -->

<!-- source: en/_includes/work_src/reusage/loss-function-format.md -->
Format:
```
<Metric>[:<parameter 1>=<value>;..;<parameter N>=<value>]
```
<!-- endsource: en/_includes/work_src/reusage/loss-function-format.md -->

[Supported metrics](https://catboost.ai/docs/en/references/custom-metric__supported-metrics.md)

Examples:
- Calculate the value of CrossEntropy

    ```
    CrossEntropy
    ```

- Calculate the value of Quantile with the coefficient $\alpha = 0.1$
    ```
    Quantile:alpha=0.1
    ```


- Calculate the values of Logloss and AUC
    ```python
    ['Logloss', 'AUC']
    ```

<!-- source: en/_includes/work_src/reusage/custom-loss--values-saved-to.md -->
Values of all custom metrics for learn and validation datasets are saved to the [Metric](https://catboost.ai/docs/en/concepts/output-data_loss-function.md) output files (`learn_error.tsv` and `test_error.tsv` respectively). The directory for these files is specified in the `--train-dir` (`train_dir`) parameter.
<!-- endsource: en/_includes/work_src/reusage/custom-loss--values-saved-to.md -->


Use the [visualization tools](https://catboost.ai/docs/en/features/visualization.md) to see a live chart with the dynamics of the specified metrics.

#### use-best-model

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.
1. 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.

#### eval-metric

<!-- source: en/_includes/work_src/reusage/eval-metric--basic.md -->
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.md) section for details on each metric).
<!-- endsource: en/_includes/work_src/reusage/eval-metric--basic.md -->

<!-- source: en/_includes/work_src/reusage/eval-metric--format.md -->
Format:
```
<Metric>[:<parameter 1>=<value>;..;<parameter N>=<value>]
```
<!-- endsource: en/_includes/work_src/reusage/eval-metric--format.md -->

[Supported metrics](https://catboost.ai/docs/en/references/eval-metric__supported-metrics.md)

A user-defined function can also be set as the value (see an [example](https://catboost.ai/docs/en/concepts/python-usages-examples.md)).

<!-- source: en/_includes/work_src/reusage/eval-metric--examples.md -->
Examples:
```
R2
```
<!-- endsource: en/_includes/work_src/reusage/eval-metric--examples.md -->

<!-- source: en/_includes/work_src/reusage-common-phrases/method-params-training-and-applying.md -->
The following parameters can be set for the corresponding methods and are used when the model is trained or applied.
<!-- endsource: en/_includes/work_src/reusage-common-phrases/method-params-training-and-applying.md -->

### Parameters for trained or applied model

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

Classes:
- [fit](https://catboost.ai/docs/en/concepts/python-reference_catboost_fit.md) ([CatBoost](https://catboost.ai/docs/en/concepts/python-reference_catboost.md))
- [fit](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_fit.md) ([CatBoostClassifier](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier.md))
- [fit](https://catboost.ai/docs/en/concepts/python-reference_catboostregressor_fit.md) ([CatBoostRegressor](https://catboost.ai/docs/en/concepts/python-reference_catboostregressor.md))


#### use_best_model

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.
1. 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.

#### verbose

Output the measured evaluation metric to stderr.


#### plot

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


## R package

<!-- source: en/_includes/work_src/reusage-common-phrases/method-params-training-and-applying.md -->
The following parameters can be set for the corresponding methods and are used when the model is trained or applied.
<!-- endsource: en/_includes/work_src/reusage-common-phrases/method-params-training-and-applying.md -->

Method:  [catboost.train](https://catboost.ai/docs/en/concepts/r-reference_catboost-train.md)

### loss_function

**Description**

<!-- source: en/_includes/work_src/reusage/loss-function-short-desc.md -->
The [metric](https://catboost.ai/docs/en/concepts/loss-functions.md) 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](https://catboost.ai/docs/en/concepts/loss-functions.md) section for details on each metric).
<!-- endsource: en/_includes/work_src/reusage/loss-function-short-desc.md -->

<!-- source: en/_includes/work_src/reusage/loss-function-format.md -->
Format:
```
<Metric>[:<parameter 1>=<value>;..;<parameter N>=<value>]
```
<!-- endsource: en/_includes/work_src/reusage/loss-function-format.md -->

{% cut "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

{% endcut %}

<!-- source: en/_includes/work_src/reusage/loss-function--example.md -->
For example, use the following construction to calculate the value of Quantile with the coefficient $\alpha = 0.1$:
```
Quantile:alpha=0.1
```
<!-- endsource: en/_includes/work_src/reusage/loss-function--example.md -->

### custom_loss

**Parameters**

<!-- source: en/_includes/work_src/reusage/custom-loss--basic.md -->
[Metric](https://catboost.ai/docs/en/concepts/loss-functions.md) 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](https://catboost.ai/docs/en/concepts/loss-functions.md) section for details on each metric).
<!-- endsource: en/_includes/work_src/reusage/custom-loss--basic.md -->

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

[Supported metrics](https://catboost.ai/docs/en/references/custom-metric__supported-metrics.md)

Examples:
- Calculate the value of CrossEntropy

    ```no-highlight
    c('CrossEntropy')
    ```

    Or simply:
    ```
    'CrossEntropy'
    ```

- Calculate the values of Logloss and AUC

    ```
    c('Logloss', 'AUC')
    ```

- Calculate the value of Quantile with the coefficient $\alpha = 0.1$
    ```no-highlight
    c('Quantilealpha=0.1')
    ```

<!-- source: en/_includes/work_src/reusage/custom-loss--values-saved-to.md -->
Values of all custom metrics for learn and validation datasets are saved to the [Metric](https://catboost.ai/docs/en/concepts/output-data_loss-function.md) output files (`learn_error.tsv` and `test_error.tsv` respectively). The directory for these files is specified in the `--train-dir` (`train_dir`) parameter.
<!-- endsource: en/_includes/work_src/reusage/custom-loss--values-saved-to.md -->

### use-best-model

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.
1. 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.

### eval-metric

**Parameters**

<!-- source: en/_includes/work_src/reusage/eval-metric--basic.md -->
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.md) section for details on each metric).
<!-- endsource: en/_includes/work_src/reusage/eval-metric--basic.md -->

<!-- source: en/_includes/work_src/reusage/eval-metric--format.md -->
Format:
```
<Metric>[:<parameter 1>=<value>;..;<parameter N>=<value>]
```
<!-- endsource: en/_includes/work_src/reusage/eval-metric--format.md -->

[Supported metrics](https://catboost.ai/docs/en/references/eval-metric__supported-metrics.md)

```
Quantile:alpha=0.3
```

## Command-line version

<!-- source: en/_includes/work_src/reusage-common-phrases/command-keys-trained-or-applied.md -->
The following command keys can be specified for the corresponding commands and are used when the model is trained or applied.
<!-- endsource: en/_includes/work_src/reusage-common-phrases/command-keys-trained-or-applied.md -->

Params for the [catboost fit](https://catboost.ai/docs/en/references/training-parameters/index.md) command:

### --loss-function

The [metric](https://catboost.ai/docs/en/concepts/loss-functions.md) 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](https://catboost.ai/docs/en/concepts/loss-functions.md) section for details on each metric).

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

{% cut "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

{% endcut %}

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

### --custom-metric

[Metric](https://catboost.ai/docs/en/concepts/loss-functions.md) 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](https://catboost.ai/docs/en/concepts/loss-functions.md) section for details on each metric).

Format:
```
<Metric 1>[:<parameter 1>=<value>;..;<parameter N>=<value>],<Metric 2>[:<parameter 1>=<value>;..;<parameter N>=<value>],..,<Metric N>[:<parameter 1>=<value>;..;<parameter N>=<value>]
```

[Supported metrics](https://catboost.ai/docs/en/references/custom-metric__supported-metrics.md)

Examples:
- Calculate the value of CrossEntropy

    ```no-highlight
    CrossEntropy
    ```

- Calculate the value of Quantile with the coefficient $\alpha = 0.1$
    ```
    Quantilealpha=0.1
    ```

Values of all custom metrics for learn and validation datasets are saved to the [Metric](https://catboost.ai/docs/en/concepts/output-data_loss-function.md) output files (`learn_error.tsv` and `test_error.tsv` respectively). The directory for these files is specified in the `--train-dir` (`train_dir`) parameter.

### --use-best-model

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.
1. 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.


### --eval-metric

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.md) 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.md)

Examples:
```
R2
```

```
Quantile:alpha=0.3
```


### --logging-level

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.
