ℹ️ 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/references/ndcg |
| Last Crawled | 2026-04-17 04:36:42 (47 minutes ago) |
| First Indexed | 2024-11-20 03:17:28 (1 year ago) |
| HTTP Status Code | 200 |
| Meta Title | NDCG | CatBoost |
| Meta Description | This function is usually used to assess the quality of ranking. Calculation principles. User-defined parameters. Calculation principles. |
| Meta Canonical | null |
| Boilerpipe Text | This function is usually used to assess the quality of ranking.
Calculation principles
User-defined parameters
Calculation principles
The calculation of this function consists of the following steps:
The objects in each group are sorted in descending order of predicted relevancies (
a
i
a_{i}
).
The DCG metric is calculated for each group (
g
r
o
u
p
∈
g
r
o
u
p
s
group \in groups
) with sorted objects (see step
1
).
The calculation principle depends on the specified value of the
type
and
denominator
parameters:
type/denominator
LogPosition
Position
Base
D
C
G
(
g
r
o
u
p
,
t
o
p
)
=
∑
i
=
1
t
o
p
t
g
(
i
,
g
r
o
u
p
)
l
o
g
2
(
i
+
1
)
DCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{t_{g(i,group)}}{log_{2}(i+1)}
D
C
G
(
g
r
o
u
p
,
t
o
p
)
=
∑
i
=
1
t
o
p
t
g
(
i
,
g
r
o
u
p
)
i
DCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{t_{g(i,group)}}{i}
Exp
D
C
G
(
g
r
o
u
p
,
t
o
p
)
=
∑
i
=
1
t
o
p
2
t
g
(
i
,
g
r
o
u
p
)
−
1
l
o
g
2
(
i
+
1
)
DCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{2^{t_{g(i,group)}} - 1}{log_{2}(i+1)}
D
C
G
(
g
r
o
u
p
,
t
o
p
)
=
∑
i
=
1
t
o
p
2
t
g
(
i
,
g
r
o
u
p
)
−
1
i
DCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{2^{t_{g(i,group)}} - 1}{i}
t
g
(
i
,
g
r
o
u
p
)
t_{g(i,group)}
is the label value for the i-th object in the group.
The objects in each group are sorted in descending order of target relevancies (
t
i
t_{i}
).
The iDCG metric is calculated for each group (
g
r
o
u
p
∈
g
r
o
u
p
s
group \in groups
) with sorted objects (see step
3
).
The calculation principle depends on the specified value of the
type
and
denominator
parameters:
type/denominator
LogPosition
Position
Base
I
D
C
G
(
g
r
o
u
p
,
t
o
p
)
=
∑
i
=
1
t
o
p
t
g
(
i
,
g
r
o
u
p
)
l
o
g
2
(
i
+
1
)
IDCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{t_{g(i,group)}}{log_{2}(i+1)}
I
D
C
G
(
g
r
o
u
p
,
t
o
p
)
=
∑
i
=
1
t
o
p
t
g
(
i
,
g
r
o
u
p
)
i
IDCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{t_{g(i,group)}}{i}
Exp
I
D
C
G
(
g
r
o
u
p
,
t
o
p
)
=
∑
i
=
1
t
o
p
2
t
g
(
i
,
g
r
o
u
p
)
−
1
l
o
g
2
(
i
+
1
)
IDCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{2^{t_{g(i,group)}} - 1}{log_{2}(i+1)}
I
D
C
G
(
g
r
o
u
p
,
t
o
p
)
=
∑
i
=
1
t
o
p
2
t
g
(
i
,
g
r
o
u
p
)
−
1
i
IDCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{2^{t_{g(i,group)}} - 1}{i}
The NDCG metric is calculated for each group:
n
D
C
G
(
g
r
o
u
p
,
t
o
p
)
=
D
C
G
i
D
C
G
nDCG(group,top) = \displaystyle\frac{DCG}{iDCG}
The aggregated value of the metric for all groups is calculated as follows:
n
D
C
G
(
t
o
p
)
=
∑
g
r
o
u
p
∈
g
r
o
u
p
s
n
D
C
G
(
g
r
o
u
p
,
t
o
p
)
∗
w
g
r
o
u
p
∑
g
r
o
u
p
∈
g
r
o
u
p
s
w
g
r
o
u
p
nDCG(top) = \frac{\sum\limits_{group \in groups} nDCG(group, top) * w_{group}}{\sum\limits_{group \in groups} w_{group}}
User-defined parameters
top
Description
The number of top samples in a group that are used to calculate the ranking metric. Top samples are either the samples with the largest approx values or the ones with the lowest target values if approx values are the same.
Default
: –1 (all label values are used)
use_weights
Description
Use object/group weights to calculate metrics if the specified value is
true
and set all weights to
1
regardless of the input data if the specified value is
false
.
Default
: true
type
Description
Metric calculation principles.
Possible values:
Base
Exp
Default
: Base
denominator
Description
Metric denominator type.
Possible values:
LogPosition
Position
Default
: LogPosition |
| Markdown | [](https://catboost.ai/ "CatBoost")
- Installation
- [Overview](https://catboost.ai/docs/en/references/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/references/en/concepts/parameter-tuning)
- [Speeding up the training](https://catboost.ai/docs/en/references/en/concepts/speed-up-training)
- Data visualization
- Algorithm details
- [FAQ](https://catboost.ai/docs/en/references/en/concepts/faq)
- Educational materials
- [Development and contributions](https://catboost.ai/docs/en/references/en/concepts/development-and-contributions)
- [Contacts](https://catboost.ai/docs/en/references/en/concepts/contacts)
NDCG
## In this article:
- [Calculation principles](https://catboost.ai/docs/en/references/en/references/ndcg#calculation)
- [User-defined parameters](https://catboost.ai/docs/en/references/en/references/ndcg#user-defined-parameters)
- [top](https://catboost.ai/docs/en/references/en/references/ndcg#top)
- [use\_weights](https://catboost.ai/docs/en/references/en/references/ndcg#use_weights)
- [type](https://catboost.ai/docs/en/references/en/references/ndcg#type)
- [denominator](https://catboost.ai/docs/en/references/en/references/ndcg#denominator)
# NDCG
- [Calculation principles](https://catboost.ai/docs/en/references/en/references/ndcg#calculation)
- [User-defined parameters](https://catboost.ai/docs/en/references/en/references/ndcg#user-defined-parameters)
- [top](https://catboost.ai/docs/en/references/en/references/ndcg#top)
- [use\_weights](https://catboost.ai/docs/en/references/en/references/ndcg#use_weights)
- [type](https://catboost.ai/docs/en/references/en/references/ndcg#type)
- [denominator](https://catboost.ai/docs/en/references/en/references/ndcg#denominator)
This function is usually used to assess the quality of ranking.
- [Calculation principles](https://catboost.ai/docs/en/references/en/references/ndcg#calculation)
- [User-defined parameters](https://catboost.ai/docs/en/references/en/references/ndcg#user-defined-parameters)
## Calculation principles
The calculation of this function consists of the following steps:
1. The objects in each group are sorted in descending order of predicted relevancies (a i a\_{i} ai).
2. The DCG metric is calculated for each group (g r o u p ∈ g r o u p s group \\in groups group∈groups) with sorted objects (see step [1](https://catboost.ai/docs/en/references/en/references/ndcg#ndcg__calc-principles__sort-predicted-relevancies)).
The calculation principle depends on the specified value of the `type` and `denominator` parameters:
| type/denominator | LogPosition | Position |
|---|---|---|
| **Base** | D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p t g ( i , g r o u p ) l o g 2 ( i \+ 1 ) DCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{t\_{g(i,group)}}{log\_{2}(i+1)} DCG(group,top)\=i\=1∑toplog2(i\+1)tg(i,group) | D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p t g ( i , g r o u p ) i DCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{t\_{g(i,group)}}{i} DCG(group,top)\=i\=1∑topitg(i,group) |
| **Exp** | D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p 2 t g ( i , g r o u p ) − 1 l o g 2 ( i \+ 1 ) DCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{2^{t\_{g(i,group)}} - 1}{log\_{2}(i+1)} DCG(group,top)\=i\=1∑toplog2(i\+1)2tg(i,group)−1 | D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p 2 t g ( i , g r o u p ) − 1 i DCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{2^{t\_{g(i,group)}} - 1}{i} DCG(group,top)\=i\=1∑topi2tg(i,group)−1 |
t g ( i , g r o u p ) t\_{g(i,group)} tg(i,group) is the label value for the i-th object in the group.
3. The objects in each group are sorted in descending order of target relevancies (t i t\_{i} ti).
4. The iDCG metric is calculated for each group (g r o u p ∈ g r o u p s group \\in groups group∈groups) with sorted objects (see step [3](https://catboost.ai/docs/en/references/en/references/ndcg#ndcg__calc-principles__sort-target-relevancies)).
The calculation principle depends on the specified value of the `type` and `denominator` parameters:
| type/denominator | LogPosition | Position |
|---|---|---|
| **Base** | I D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p t g ( i , g r o u p ) l o g 2 ( i \+ 1 ) IDCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{t\_{g(i,group)}}{log\_{2}(i+1)} IDCG(group,top)\=i\=1∑toplog2(i\+1)tg(i,group) | I D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p t g ( i , g r o u p ) i IDCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{t\_{g(i,group)}}{i} IDCG(group,top)\=i\=1∑topitg(i,group) |
| **Exp** | I D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p 2 t g ( i , g r o u p ) − 1 l o g 2 ( i \+ 1 ) IDCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{2^{t\_{g(i,group)}} - 1}{log\_{2}(i+1)} IDCG(group,top)\=i\=1∑toplog2(i\+1)2tg(i,group)−1 | I D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p 2 t g ( i , g r o u p ) − 1 i IDCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{2^{t\_{g(i,group)}} - 1}{i} IDCG(group,top)\=i\=1∑topi2tg(i,group)−1 |
5. The NDCG metric is calculated for each group:
n D C G ( g r o u p , t o p ) \= D C G i D C G nDCG(group,top) = \\displaystyle\\frac{DCG}{iDCG} nDCG(group,top)\=iDCGDCG
6. The aggregated value of the metric for all groups is calculated as follows:
n D C G ( t o p ) \= ∑ g r o u p ∈ g r o u p s n D C G ( g r o u p , t o p ) ∗ w g r o u p ∑ g r o u p ∈ g r o u p s w g r o u p nDCG(top) = \\frac{\\sum\\limits\_{group \\in groups} nDCG(group, top) \* w\_{group}}{\\sum\\limits\_{group \\in groups} w\_{group}} nDCG(top)\=group∈groups∑wgroupgroup∈groups∑nDCG(group,top)∗wgroup
## User-defined parameters
### top
#### Description
The number of top samples in a group that are used to calculate the ranking metric. Top samples are either the samples with the largest approx values or the ones with the lowest target values if approx values are the same.
*Default*: –1 (all label values are used)
### use\_weights
#### Description
Use object/group weights to calculate metrics if the specified value is "true" and set all weights to "1" regardless of the input data if the specified value is "false".
*Default*: true
### type
#### Description
Metric calculation principles.
Possible values:
- Base
- Exp
*Default*: Base
### denominator
#### Description
Metric denominator type.
Possible values:
- LogPosition
- Position
*Default*: LogPosition
### Was the article helpful?
Yes
No
 |
| Readable Markdown | This function is usually used to assess the quality of ranking.
- [Calculation principles](https://catboost.ai/docs/en/references/ndcg#calculation)
- [User-defined parameters](https://catboost.ai/docs/en/references/ndcg#user-defined-parameters)
## Calculation principles
The calculation of this function consists of the following steps:
1. The objects in each group are sorted in descending order of predicted relevancies (a i a\_{i}).
2. The DCG metric is calculated for each group (g r o u p ∈ g r o u p s group \\in groups) with sorted objects (see step [1](https://catboost.ai/docs/en/references/ndcg#ndcg__calc-principles__sort-predicted-relevancies)).
The calculation principle depends on the specified value of the `type` and `denominator` parameters:
| type/denominator | LogPosition | Position |
|---|---|---|
| **Base** | D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p t g ( i , g r o u p ) l o g 2 ( i \+ 1 ) DCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{t\_{g(i,group)}}{log\_{2}(i+1)} | D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p t g ( i , g r o u p ) i DCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{t\_{g(i,group)}}{i} |
| **Exp** | D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p 2 t g ( i , g r o u p ) − 1 l o g 2 ( i \+ 1 ) DCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{2^{t\_{g(i,group)}} - 1}{log\_{2}(i+1)} | D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p 2 t g ( i , g r o u p ) − 1 i DCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{2^{t\_{g(i,group)}} - 1}{i} |
t g ( i , g r o u p ) t\_{g(i,group)} is the label value for the i-th object in the group.
3. The objects in each group are sorted in descending order of target relevancies (t i t\_{i}).
4. The iDCG metric is calculated for each group (g r o u p ∈ g r o u p s group \\in groups) with sorted objects (see step [3](https://catboost.ai/docs/en/references/ndcg#ndcg__calc-principles__sort-target-relevancies)).
The calculation principle depends on the specified value of the `type` and `denominator` parameters:
| type/denominator | LogPosition | Position |
|---|---|---|
| **Base** | I D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p t g ( i , g r o u p ) l o g 2 ( i \+ 1 ) IDCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{t\_{g(i,group)}}{log\_{2}(i+1)} | I D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p t g ( i , g r o u p ) i IDCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{t\_{g(i,group)}}{i} |
| **Exp** | I D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p 2 t g ( i , g r o u p ) − 1 l o g 2 ( i \+ 1 ) IDCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{2^{t\_{g(i,group)}} - 1}{log\_{2}(i+1)} | I D C G ( g r o u p , t o p ) \= ∑ i \= 1 t o p 2 t g ( i , g r o u p ) − 1 i IDCG(group,top) = \\sum\\limits\_{i=1}^{top}\\displaystyle\\frac{2^{t\_{g(i,group)}} - 1}{i} |
5. The NDCG metric is calculated for each group:
n D C G ( g r o u p , t o p ) \= D C G i D C G nDCG(group,top) = \\displaystyle\\frac{DCG}{iDCG}
6. The aggregated value of the metric for all groups is calculated as follows:
n D C G ( t o p ) \= ∑ g r o u p ∈ g r o u p s n D C G ( g r o u p , t o p ) ∗ w g r o u p ∑ g r o u p ∈ g r o u p s w g r o u p nDCG(top) = \\frac{\\sum\\limits\_{group \\in groups} nDCG(group, top) \* w\_{group}}{\\sum\\limits\_{group \\in groups} w\_{group}}
## User-defined parameters
### top
#### Description
The number of top samples in a group that are used to calculate the ranking metric. Top samples are either the samples with the largest approx values or the ones with the lowest target values if approx values are the same.
*Default*: –1 (all label values are used)
### use\_weights
#### Description
Use object/group weights to calculate metrics if the specified value is "true" and set all weights to "1" regardless of the input data if the specified value is "false".
*Default*: true
### type
#### Description
Metric calculation principles.
Possible values:
- Base
- Exp
*Default*: Base
### denominator
#### Description
Metric denominator type.
Possible values:
- LogPosition
- Position
*Default*: LogPosition |
| Shard | 169 (laksa) |
| Root Hash | 17435841955170310369 |
| Unparsed URL | ai,catboost!/docs/en/references/ndcg s443 |