score

Calculate the NDCG@top metric for the objects in the given dataset.

Method call format

score(X,
      y=None,
      group_id=None,
      top=None,
      type=None,
      denominator=None,
      group_weight=None,
      thread_count=-1)

Parameters

X

Description

The description is different for each group of possible types.

Possible types

catboost.Pool

The input training dataset.

Note

If a nontrivial value of the cat_features parameter is specified in the constructor of this class, CatBoost checks the equivalence of categorical features indices specification from the constructor parameters and in this Pool class.

list, numpy.ndarray, pandas.DataFrame, pandas.Series

The input training dataset in the form of a two-dimensional feature matrix.

pandas.SparseDataFrame, scipy.sparse.spmatrix (all subclasses except dia_matrix)

The input training dataset in the form of a two-dimensional sparse feature matrix.

Default value

Required parameter

y

Description

The target variables (in other words, the objects' label values) for the evaluation dataset.

Must be in the form of a one-dimensional array of numeric values.

Note

Do not use this parameter if the input training dataset (specified in the X parameter) type is catboost.Pool.

Possible types

  • list
  • numpy.ndarray
  • pandas.Series

Default value

None

Supported processing units

CPU and GPU

group_id

Description

A ranking group.

Note

Do not use this parameter if the input training dataset (specified in the X parameter) type is catboost.Pool.

Possible types

  • numpy.ndarray
  • pandas.DataFrame
  • pandas.Series

Default value

None

top

Description

NDCG, Number of top-ranked objects to calculate NDCG

Possible types

  • unsigned integer, up to pow(2, 32) / 2 - 1

Default value

None

type

Description

Metric type: Base or Exp.

Possible types

  • str

Default value

None

denominator

Description

Denominator type.

Possible types

  • str

Default value

None

group_weight

Description

The weights of all objects within the defined groups from the input data in the form of one-dimensional array-like data.
Used for calculating the final values of trees. By default, it is set to one for all objects in all groups.
Only a weight or group_weight parameter can be used at the time.

Possible types

  • list
  • numpy.ndarray
  • pandas.DataFrame
  • pandas.Series

Default value

None

thread_count

Description

The number of threads to use.

Optimizes the speed of execution. This parameter doesn't affect results.

Possible types

  • int

Default value

-1 (the number of threads is equal to the number of processor cores)

Type of return value

float