Skip to content

unseen_values

Count the categorical values in the dataset that are absent from the training data.

These are the values the unknown_category parameter acts on. A missing value is never unseen.

Method call format

unseen_values(X, *, sample_weight=None, exposure=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

sample_weight, exposure

Description

The weight and the exposure of each object. When either is given, the result has a mass column. A string names a column of a polars X.

Possible types

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

Default value

None

Return value

A polars DataFrame with one row per (feature, value), sorted by feature (in input order) and then by the number of objects, descending:

  • feature — The feature name.
  • value — The unseen value, as the string t-boost matches on (a numeric category 1 is "1").
  • rows — The number of objects with the value.
  • mass — Their total sample_weight * exposure (only when one of them is given).

Usage examples

print(model.unseen_values(new_business))