• Overview
  • Parameter tuning
  • Speeding up the training
  • FAQ
  • Development and contributions
  • Contacts

NDCG

This function is usually used to assess the quality of ranking.

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 (aia_{i}).

  2. The DCG metric is calculated for each group (groupgroupsgroup \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 DCG(group,top)=i=1toptg(i,group)log2(i+1)DCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{t_{g(i,group)}}{log_{2}(i+1)} DCG(group,top)=i=1toptg(i,group)iDCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{t_{g(i,group)}}{i}
    Exp DCG(group,top)=i=1top2tg(i,group)1log2(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=1top2tg(i,group)1iDCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{2^{t_{g(i,group)}} - 1}{i}

    tg(i,group)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 (tit_{i}).

  4. The iDCG metric is calculated for each group (groupgroupsgroup \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 IDCG(group,top)=i=1toptg(i,group)log2(i+1)IDCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{t_{g(i,group)}}{log_{2}(i+1)} IDCG(group,top)=i=1toptg(i,group)iIDCG(group,top) = \sum\limits_{i=1}^{top}\displaystyle\frac{t_{g(i,group)}}{i}
    Exp IDCG(group,top)=i=1top2tg(i,group)1log2(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=1top2tg(i,group)1iIDCG(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:
    nDCG(group,top)=DCGiDCGnDCG(group,top) = \displaystyle\frac{DCG}{iDCG}

  6. The aggregated value of the metric for all groups is calculated as follows:
    nDCG(top)=groupgroupsnDCG(group,top)wgroupgroupgroupswgroupnDCG(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