Skip to content

predict_raw

Apply the model to the given dataset and return the raw score: the prediction on the link scale, before the inverse of the link function is applied.

For the squared_error objective this is the same as predict. For the poisson, gamma and tweedie objectives it is the logarithm of the rate.

Note

The model prediction results will be correct only if the X parameter with feature values contains all the features used in the model. For a polars DataFrame or LazyFrame, the features are matched by name: extra columns are ignored and the order of the columns does not matter (a LazyFrame collects only the columns the model needs). For other types, and for a model trained without feature names, the features must be in the same number and order as the columns provided during the training.

Method call format

predict_raw(X, *, offset=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

offset

Description

The link-scale offset to add to the raw score of each object, as passed to the offset parameter of fit. A string names a column of a polars X. If omitted, the objects are scored with a zero offset.

Possible types

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

Default value

None

Return value

A one-dimensional numpy.ndarray of shape (object_count,) with the raw score of each object, as float64.