predict¶
Apply the model to the given dataset to predict the class labels.
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¶
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 labels from classes_. For
binary classification, the label is classes_[1] where predict_proba(X)[:, 1] >= 0.5 and
classes_[0] otherwise. For multiclassification, it is the class with the highest probability.