Skip to content

score

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

The metric compares y with predict, which for a model with a log link is the rate per unit of exposure. For a model trained with an exposure, use the deviances of the t_boost.metrics module instead.

Method call format

score(X, y, sample_weight=None)

Parameters

X

Description

Feature values data.

Possible types

  • polars.DataFrame
  • polars.LazyFrame
  • numpy.ndarray of shape (object_count, feature_count)
  • other array-like data of the same shape

Default value

Required parameter

y

Description

The target values of the objects.

Possible types

  • numpy.ndarray of shape (object_count,)
  • polars.Series
  • list

Default value

Required parameter

sample_weight

Description

The weight of each object. By default, it is set to 1 for all objects.

Possible types

  • numpy.ndarray of shape (object_count,)
  • polars.Series
  • list

Default value

None

Return value

float