---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.3
alternate:
  - https://catboost.ai/docs/en/concepts/loss-functions-multilabel-classification.md
---
> **Documentation Index:** Fetch the complete configuration index at https://catboost.ai/docs/en/llms.txt

# MultiLabel Classification: objectives and metrics

- [Objectives and metrics](#objectives-and-metrics)
- [Used for optimization](#usage-information)

## Objectives and metrics

### MultiLogloss {#MultiLogloss}

  $\displaystyle\frac{-\sum\limits_{j=0}^{M-1} \sum\limits_{i=1}^{N} w_{i} (c_{ij} \log p_{ij} + (1-c_{ij}) \log (1 - p_{ij}) )}{M\sum\limits_{i=1}^{N}w_{i}} { ,}$

  where $p_{ij} = \sigma(a_{ij}) = \frac{e^{a_{ij}}}{1 + e^{a_{ij}}}$ and $c_{ij} \in {0, 1}$

**Usage information**  See [more](#usage-information).

**User-defined parameters**

<!-- source: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->
{% cut "use_weights" %}

Use object/group weights to calculate metrics if the specified value is <q>true</q> and set all weights to <q>1</q> regardless of the input data if the specified value is <q>false</q>.

_Default:_ true

{% endcut %}
<!-- endsource: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->

### MultiCrossEntropy {#MultiCrossEntropy}

$\displaystyle\frac{-\sum\limits_{j=0}^{M-1} \sum\limits_{i=1}^{N} w_{i} (t_{ij} \log p_{ij} + (1-t_{ij}) \log (1 - p_{ij}) )}{M\sum\limits_{i=1}^{N}w_{i}} { ,}$

  where $p_{ij} = \sigma(a_{ij}) = \frac{e^{a_{ij}}}{1 + e^{a_{ij}}}$ and $t_{ij} \in [0, 1]$

**Usage information**  See [more](#usage-information).

**User-defined parameters**

<!-- source: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->
{% cut "use_weights" %}

Use object/group weights to calculate metrics if the specified value is <q>true</q> and set all weights to <q>1</q> regardless of the input data if the specified value is <q>false</q>.

_Default:_ true

{% endcut %}
<!-- endsource: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->


### Precision {#Precision}

<!-- source: en/_includes/work_src/reusage/loss-function__for-multiclass.md -->
This function is calculated separately for each class k numbered from 0 to M – 1.
<!-- endsource: en/_includes/work_src/reusage/loss-function__for-multiclass.md -->

$\frac{TP}{TP + FP}$

**Can't be used for optimization.**  See [more](#usage-information).

**User-defined parameters**

<!-- source: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->
{% cut "use_weights" %}

Use object/group weights to calculate metrics if the specified value is <q>true</q> and set all weights to <q>1</q> regardless of the input data if the specified value is <q>false</q>.

_Default:_ true

{% endcut %}
<!-- endsource: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->


### Recall {#Recall}

<!-- source: en/_includes/work_src/reusage/loss-function__for-multiclass.md -->
This function is calculated separately for each class k numbered from 0 to M – 1.
<!-- endsource: en/_includes/work_src/reusage/loss-function__for-multiclass.md -->

$\frac{TP}{TP+FN}$

**Can't be used for optimization.**  See [more](#usage-information).

**User-defined parameters**

<!-- source: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->
{% cut "use_weights" %}

Use object/group weights to calculate metrics if the specified value is <q>true</q> and set all weights to <q>1</q> regardless of the input data if the specified value is <q>false</q>.

_Default:_ true

{% endcut %}
<!-- endsource: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->

### F {#F}

<!-- source: en/_includes/work_src/reusage/loss-function__for-multiclass.md -->
This function is calculated separately for each class k numbered from 0 to M – 1.
<!-- endsource: en/_includes/work_src/reusage/loss-function__for-multiclass.md -->

$(1 + \beta^2) \cdot  \frac{Precision * Recall}{(\beta^2 \cdot Precision) + Recall}$

**Can't be used for optimization.**  See [more](#usage-information).

**User-defined parameters**

<!-- source: en/_includes/work_src/reusage-loss-functions/beta_for_F__desc.md -->
{% cut "beta" %}

The $\beta$ parameter of the F metric.

Valid values are real numbers in the following range:  $(0; +\infty)$.

_Default:_ This parameter is obligatory (the default value is not defined)

{% endcut %}
<!-- endsource: en/_includes/work_src/reusage-loss-functions/beta_for_F__desc.md -->

<!-- source: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->
{% cut "use_weights" %}

Use object/group weights to calculate metrics if the specified value is <q>true</q> and set all weights to <q>1</q> regardless of the input data if the specified value is <q>false</q>.

_Default:_ true

{% endcut %}
<!-- endsource: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->

### F1 {#F1}

<!-- source: en/_includes/work_src/reusage/loss-function__for-multiclass.md -->
This function is calculated separately for each class k numbered from 0 to M – 1.
<!-- endsource: en/_includes/work_src/reusage/loss-function__for-multiclass.md -->

$2 \frac{Precision * Recall}{Precision + Recall}$

**Can't be used for optimization.**  See [more](#usage-information).

**User-defined parameters**

<!-- source: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->
{% cut "use_weights" %}

Use object/group weights to calculate metrics if the specified value is <q>true</q> and set all weights to <q>1</q> regardless of the input data if the specified value is <q>false</q>.

_Default:_ true

{% endcut %}
<!-- endsource: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->

### Accuracy {#Accuracy}

The formula depends on the value of the $type$ parameter:

#### Classic

$\displaystyle\frac{\sum\limits_{i=1}^{N}w_{i} \prod\limits_{j=0}^{M-1} [[p_{ij} > 0.5]==t_{ij}]}{\sum\limits_{i=1}^{N}w_{i}} { , }$

where $p_{ij} = \sigma(a_{ij}) = \frac{e^{a_{ij}}}{1 + e^{a_{ij}}}$

#### PerClass

<!-- source: en/_includes/work_src/reusage/loss-function__for-multiclass.md -->
This function is calculated separately for each class k numbered from 0 to M – 1.
<!-- endsource: en/_includes/work_src/reusage/loss-function__for-multiclass.md -->

$\frac{TP + TN}{\sum\limits_{i=1}^{N} w_{i}}$

**Can't be used for optimization.**  See [more](#usage-information).

**User-defined parameters**

{% cut "type" %}

The type of calculated accuracy.

_Default:_ `Classic`.
_Possible values_: `Classic`, `PerClass`.

{% endcut %}


### HammingLoss {#HammingLoss}

$\displaystyle\frac{\sum\limits_{j=0}^{M-1} \sum\limits_{i = 1}^{N} w_{i} [[p_{ij} > 0.5] == t_{ij}]]}{M \sum\limits_{i=1}^{N} w_{i}}$

**Can't be used for optimization.**  See [more](#usage-information).

**User-defined parameters**

<!-- source: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->
{% cut "use_weights" %}

Use object/group weights to calculate metrics if the specified value is <q>true</q> and set all weights to <q>1</q> regardless of the input data if the specified value is <q>false</q>.

_Default:_ true

{% endcut %}
<!-- endsource: en/_includes/work_src/reusage-loss-functions/use-weights__desc__with__default__value.md -->



## Used for optimization {#usage-information}

| Name                                                          | Optimization            | GPU Support             |
----------------------------------------------------------------|-------------------------|-------------------------|
[MultiLogloss](#MultiLogloss)             |     +                   |     +                   |
[MultiCrossEntropy](#MultiCrossEntropy)   |     +                   |     +                   |
[Precision](#Precision)                   |     -                   |     -                   |
[Recall](#Recall)                         |     -                   |     -                   |
[F](#F)                                   |     -                   |     -                   |
[F1](#F1)                                 |     -                   |     -                   |
[Accuracy](#Accuracy)                     |     -                   |     -                   |
[HammingLoss](#HammingLoss)               |     -                   |     -                   |
