score

Calculate the Accuracy metric for the objects in the given dataset.

Method call format

score(X, y)

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.array, pandas.DataFrame, pandas.Series

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 training dataset.

Must be in the form of a one-dimensional array. The type of data in the array depends on the machine learning task being solved:

  • Regression , multiregression and ranking  — Numeric values.

  • Binary classification — Numeric values.

    The interpretation of numeric values depends on the selected loss function:

    • Logloss — The value is considered a positive class if it is strictly greater than the value of the `` parameter of the loss function. Otherwise, it is considered a negative class.
    • CrossEntropy — The value is interpreted as the probability that the dataset object belongs to the positive class. Possible values are in the range [0; 1].
  • Multiclassification — Integers or strings that represents the labels of the classes.

Note

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

Possible types

  • list
  • numpy.array
  • pandas.DataFrame
  • pandas.Series

Default value

None

Type of return value

float